SDL and windows.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SDL and windows.

stepharo
(sending to you, since i don't have a email of the guy who
asked me about it)

So, in short the problem was: on Windows, SDL was generating text input
events twice.
As i predicted, the bug was interference between old-style event handling
and SDL event handling, basically forcing SDL to process same event twice,
that then turns into twice as much text input events on image side.

Once i changed that, it no longer produces same events twice:

     if(ioCheckForEventsHooks)
     {
         /* HACK for SDL 2 */
         ioCheckForEventsHooks();
     }
     else
     {

         while(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) {
             GetMessage(&msg,NULL,0,0);
# ifndef NO_PLUGIN_SUPPORT
             if (msg.hwnd == NULL)
                 pluginHandleEvent(&msg);
# endif
             TranslateMessage(&msg);
             DispatchMessage(&msg);

         }
     }

Now this code works in following way:
  - if SDL is not used, the VM will behave in 'legacy' mode.
  - but once event hook is installed, VM then places all responsibility
on external event handler (SDL in our case) and does not processes any
events by itself anymore.

That actually what i predicted before: that we will be unable to support
legacy event handling alongside SDL without interfering with each other,
e.g. we can have one or another, but not both.

So far, i will keep this code, since i obviously need to finish image
conversion to work well with SDL, before i can completely throw away
legacy event handling in VM.

--
Best regards,