Hi,
I am recently working on the lite-xl editor, a fork of rxi/lite.
I have a long-standing problem with the SDL_WaitEvent function because it doesn’t block waiting for a new event but continuously polls the event queue with a 1ms delay (see src/events/SDL_events.c). I understand that this is not a issue for a game but it is a problem for a desktop application that is not supposed to use the CPU when idle.
I have prepared a patch to fix this problem. It is currently located in the blocking-wait-event branch. You can look here the diff.
What the patch does is to actually make SDL_WaitEvent blocks waiting for an event. Please note that this doesn’t change the behavior of the library because in any case the function does not return until an event is available.
I would love to have some feedback about this change. Is it something that could be possibly accepted ?
I would appreciate also if someone could test my patch on Mac OS X. I tested on Windows and on Linux using the X11 video subsystem and everything seems fine.
Currently I lack also the implementation the the new video device function on many subsystems but I fallback to using SDL_WaitEventWithTimeout when not implemented.
Thanks in advance for any help.
Kind regards
Francesco