Skip to content

Commit dbfb04a

Browse files
author
walker0643
committed
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
1 parent ce8c65f commit dbfb04a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib/platform/MSWindowsEventQueueBuffer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ MSWindowsEventQueueBuffer::waitForEvent(double timeout)
6262
// MsgWaitForMultipleObjects() will block even if the queue isn't
6363
// empty if the messages in the queue were there before the last
6464
// call to GetMessage()/PeekMessage().
65-
if (HIWORD(GetQueueStatus(QS_ALLINPUT)) != 0) {
65+
if (!isEmpty()) {
6666
return;
6767
}
6868

@@ -128,7 +128,9 @@ MSWindowsEventQueueBuffer::addEvent(UInt32 dataID)
128128
bool
129129
MSWindowsEventQueueBuffer::isEmpty() const
130130
{
131-
return (HIWORD(GetQueueStatus(QS_ALLINPUT)) == 0);
131+
// don't use QS_POINTER, QS_TOUCH, or any meta-flags that include them (like QS_ALLINPUT)
132+
// because they can cause GetQueueStatus() to always return 0 and we miss events
133+
return (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) == 0);
132134
}
133135

134136
EventQueueTimer*

0 commit comments

Comments
 (0)