From 016dcb390598f7d3670334d3ab9efe161306237c Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 13 Jun 2011 12:20:31 -0500 Subject: [PATCH 1/7] user32: Ignore painting messages in the hotkey test using a wndproc. --- dlls/user32/tests/msg.c | 61 +++++++++++++++++++++++++++++++++------------- 1 files changed, 44 insertions(+), 17 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 62acf8a..83ed951 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -7712,6 +7712,37 @@ static LRESULT WINAPI PaintLoopProcA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM return DefWindowProcA(hWnd,msg,wParam,lParam); } +static LRESULT WINAPI HotkeyMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static LONG defwndproc_counter = 0; + LRESULT ret; + struct recvd_message msg; + + if (ignore_message( message )) return 0; + + if ((message >= WM_KEYFIRST && message <= WM_KEYLAST) || + message == WM_HOTKEY || message >= WM_APP) + { + msg.hwnd = hwnd; + msg.message = message; + msg.flags = sent|wparam|lparam; + if (defwndproc_counter) msg.flags |= defwinproc; + msg.wParam = wParam; + msg.lParam = lParam; + msg.descr = "HotkeyMsgCheckProcA"; + add_message(&msg); + } + + defwndproc_counter++; + ret = DefWindowProcA(hwnd, message, wParam, lParam); + defwndproc_counter--; + + if (message == WM_APP) + PostMessageA(hwnd, WM_APP+1, 0, 0); + + return ret; +} + static BOOL RegisterWindowClasses(void) { WNDCLASSA cls; @@ -7729,6 +7760,10 @@ static BOOL RegisterWindowClasses(void) cls.lpszClassName = "TestWindowClass"; if(!RegisterClassA(&cls)) return FALSE; + cls.lpfnWndProc = HotkeyMsgCheckProcA; + cls.lpszClassName = "HotkeyWindowClass"; + if(!RegisterClassA(&cls)) return FALSE; + cls.lpfnWndProc = ShowWindowProcA; cls.lpszClassName = "ShowWindowClass"; if(!RegisterClassA(&cls)) return FALSE; @@ -13089,7 +13124,7 @@ static void test_hotkey(void) return; } - test_window = CreateWindowEx(0, "TestWindowClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE, + test_window = CreateWindowEx(0, "HotkeyWindowClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, NULL); flush_sequence(); @@ -13158,14 +13193,12 @@ static void test_hotkey(void) /* Inject the appropriate key sequence */ keybd_event(VK_LWIN, 0, 0, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg); ok_sequence(WmHotkeyPressLWIN, "window hotkey press LWIN", FALSE); keybd_event(hotkey_letter, 0, 0, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_HOTKEY) { @@ -13180,14 +13213,12 @@ static void test_hotkey(void) ok((key_state & 0x8000) == 0x8000, "unexpected key state %x\n", key_state); keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg); ok_sequence(WmHotkeyRelease, "window hotkey release", FALSE); keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg); ok_sequence(WmHotkeyReleaseLWIN, "window hotkey release LWIN", FALSE); @@ -13211,8 +13242,7 @@ static void test_hotkey(void) /* Inject the appropriate key sequence */ keybd_event(VK_LWIN, 0, 0, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message); DispatchMessage(&msg); @@ -13220,8 +13250,7 @@ static void test_hotkey(void) ok_sequence(WmHotkeyPressLWIN, "thread hotkey press LWIN", FALSE); keybd_event(hotkey_letter, 0, 0, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_HOTKEY) { @@ -13242,8 +13271,7 @@ static void test_hotkey(void) ok_sequence(WmHotkeyPress, "thread hotkey press", FALSE); keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message); DispatchMessage(&msg); @@ -13251,8 +13279,7 @@ static void test_hotkey(void) ok_sequence(WmHotkeyRelease, "thread hotkey release", FALSE); keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0); - while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || - PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message); DispatchMessage(&msg); -- 1.7.2.5