Commit 311fea4e authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

user32/tests: Use empty_message_queue with timeouts.

parent a697d99d
......@@ -360,11 +360,24 @@ static void test_Input_whitebox(void)
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;
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
int diff = 200;
int min_timeout = 50;
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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment