user32/tests: Use empty_message_queue with timeouts.
This commit is contained in:
parent
a697d99d66
commit
311fea4ec4
|
@ -360,11 +360,24 @@ static void test_Input_whitebox(void)
|
||||||
DestroyWindow(hWndTest);
|
DestroyWindow(hWndTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void empty_message_queue(void) {
|
/* try to make sure pending X events have been processed before continuing */
|
||||||
|
static void empty_message_queue(void)
|
||||||
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
int diff = 200;
|
||||||
TranslateMessage(&msg);
|
int min_timeout = 50;
|
||||||
DispatchMessage(&msg);
|
DWORD time = GetTickCount() + diff;
|
||||||
|
|
||||||
|
while (diff > 0)
|
||||||
|
{
|
||||||
|
if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) break;
|
||||||
|
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
diff = time - GetTickCount();
|
||||||
|
min_timeout = 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue