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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue