1
0
Fork 0

Platform/Unix/X11EventQueue: Fix bug where messeges where not flushed to the event queue.

XEventsQueued(disp, QueuedAlready) only returns the number of events currently in the queue and
does not flush new events. So this must happen elsewhere and if it does not we
will never see any events. i noticed this bug when removing the call to glXSwapBuffers().

Fix this by using XPending() instead as this flushes new events
if the queue is empty before returning the length.

see https://tronche.com/gui/x/xlib/event-handling/XEventsQueued.html
and https://tronche.com/gui/x/xlib/event-handling/XPending.html
This commit is contained in:
Henrik Hautakoski 2020-10-14 13:18:18 +02:00
parent 4193b3b719
commit 7356bdebdd

View file

@ -28,7 +28,7 @@ bool X11EventQueue::poll(Event& event)
return false;
}
if (XEventsQueued(m_disp, QueuedAlready)) {
if (XPending(m_disp)) {
XEvent xevent;
XNextEvent(m_disp, &xevent);
@ -63,6 +63,7 @@ bool X11EventQueue::poll(Event& event)
break;
default:
// Pass to window.
Log::info("X11: Window Event");
X11WindowEventHandler::process(m_disp, xevent);
}
}