From dbfb04a6ec3060b6f8e8b696b86c38aeb899bb84 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Mon, 29 Jan 2018 18:12:50 -0500 Subject: [PATCH] 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 --- src/lib/platform/MSWindowsEventQueueBuffer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/platform/MSWindowsEventQueueBuffer.cpp b/src/lib/platform/MSWindowsEventQueueBuffer.cpp index 694f4a5f..f6de1573 100644 --- a/src/lib/platform/MSWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/MSWindowsEventQueueBuffer.cpp @@ -62,7 +62,7 @@ MSWindowsEventQueueBuffer::waitForEvent(double timeout) // MsgWaitForMultipleObjects() will block even if the queue isn't // empty if the messages in the queue were there before the last // call to GetMessage()/PeekMessage(). - if (HIWORD(GetQueueStatus(QS_ALLINPUT)) != 0) { + if (!isEmpty()) { return; } @@ -128,7 +128,9 @@ MSWindowsEventQueueBuffer::addEvent(UInt32 dataID) bool 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*