Before anything.. sorry for my english.. hope this is understandable..
I thanks caedes for all the work and support.
I would like to explain what were the changes we need to make (and some attempts) to fix the event system in the python binding. Hope this helps to understand the patch (not so difficult..) and helps if other bindings needs fix too.
The patch is in CVS, and in a few hours an improvement will be there to anonymous CVSers too..
These are the changes, with a sort description. Ask if need details for anything.. I'll try to answer. Keep in mind I'm not swig expert nor C++ (far from it) Due to this maybe some technical words are missused. Sorry about that.
.The ignore/rename in cspace.i was rewriten because the parameters changed.
."no constructor defined" error
This was raised because the struct fails to complete the new virtual functions created in the eventHandler system change.
-included SCF_IMPLEMENTS_INTERFACE(iEventHandler). Good.
-derived from scfImplementation1<_csPyEventHandler,iEventHandler>. Create constructor but the instance is not detected as iEventHandler from swig and fails to match a constructor. Bad.
-derived from iEventHandler and complete the interface with macro but swig doesn't honor functions in the macro, or the macro is too complex, or something else... "No constructor defined". Bad.
-derived from iEventHandler, manual writting of functions but now fails to match the list with csEventID. This is a good step.
"crystalspace.cspython" is used for StaticHandlerName() any name suggestion is welcome..
.Converting the list into array
-change some csev* in the list that are incorrect. Good.
-added constant CS_EVENTLIST_END for list termination. Good.
-try to create a typemap for csEventID parameter with some macros that Rene wrote, but failed to do, even with some modifications. Bad.
-created the typemap(in), based on Rene code and swig docs, and the list is correctly converted to an array and swig executes SetupEventHandler from Rene wrapping code (class csPyEventHandler, etc..). Good. Maybe swig allows this to be more simple, but this works and swig is huge.. Any suggestion is, of course, welcome.
.Then, only python code: the tutorials. Here the changes are straightforward..
-change some cscmd* -> csev* and .Type -> .Name / used some 'cache' vars as res2k suggested, thanks.
-delete duplicated if() about KeyboardDown
-GetFactory() was removed from iThingState so we need to addapt the code (release notes explains this change)
-Grouped the not recomended cscmdProcess and cscmdFinalProcess into csevFrame. This is done roughly and I think that, for this examples, is fine, but others uses needs other technique (see Release notes in CS manual)
Note that some tutorials give an assert when exiting..
PD: I'll post this to ML too when my SF account works (it seems it takes some time)