pass QS_POSTMESSAGE to GetQueueStatus() instead of QS_ALLINPUT.

QS_ALLINPUT is a meta-flag that includes QS_POINTER and QS_TOUCH, both
of which can cause GetQueueStatus() to return 0 even when there are
pending messages.

fixes #4
This commit is contained in:
walker0643 2018-01-29 18:12:50 -05:00
parent ce8c65f8f9
commit dbfb04a6ec
1 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,7 @@ MSWindowsEventQueueBuffer::waitForEvent(double timeout)
// MsgWaitForMultipleObjects() will block even if the queue isn't // MsgWaitForMultipleObjects() will block even if the queue isn't
// empty if the messages in the queue were there before the last // empty if the messages in the queue were there before the last
// call to GetMessage()/PeekMessage(). // call to GetMessage()/PeekMessage().
if (HIWORD(GetQueueStatus(QS_ALLINPUT)) != 0) { if (!isEmpty()) {
return; return;
} }
@ -128,7 +128,9 @@ MSWindowsEventQueueBuffer::addEvent(UInt32 dataID)
bool bool
MSWindowsEventQueueBuffer::isEmpty() const MSWindowsEventQueueBuffer::isEmpty() const
{ {
return (HIWORD(GetQueueStatus(QS_ALLINPUT)) == 0); // don't use QS_POINTER, QS_TOUCH, or any meta-flags that include them (like QS_ALLINPUT)
// because they can cause GetQueueStatus() to always return 0 and we miss events
return (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) == 0);
} }
EventQueueTimer* EventQueueTimer*