Commit 9eb6af79 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

user32: Ignore painting messages in the hotkey test using a wndproc.

parent a4212786
...@@ -7712,6 +7712,37 @@ static LRESULT WINAPI PaintLoopProcA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM ...@@ -7712,6 +7712,37 @@ static LRESULT WINAPI PaintLoopProcA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
return DefWindowProcA(hWnd,msg,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) static BOOL RegisterWindowClasses(void)
{ {
WNDCLASSA cls; WNDCLASSA cls;
...@@ -7729,6 +7760,10 @@ static BOOL RegisterWindowClasses(void) ...@@ -7729,6 +7760,10 @@ static BOOL RegisterWindowClasses(void)
cls.lpszClassName = "TestWindowClass"; cls.lpszClassName = "TestWindowClass";
if(!RegisterClassA(&cls)) return FALSE; if(!RegisterClassA(&cls)) return FALSE;
cls.lpfnWndProc = HotkeyMsgCheckProcA;
cls.lpszClassName = "HotkeyWindowClass";
if(!RegisterClassA(&cls)) return FALSE;
cls.lpfnWndProc = ShowWindowProcA; cls.lpfnWndProc = ShowWindowProcA;
cls.lpszClassName = "ShowWindowClass"; cls.lpszClassName = "ShowWindowClass";
if(!RegisterClassA(&cls)) return FALSE; if(!RegisterClassA(&cls)) return FALSE;
...@@ -13090,7 +13125,7 @@ static void test_hotkey(void) ...@@ -13090,7 +13125,7 @@ static void test_hotkey(void)
return; 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); 100, 100, 200, 200, 0, 0, 0, NULL);
flush_sequence(); flush_sequence();
...@@ -13159,14 +13194,12 @@ static void test_hotkey(void) ...@@ -13159,14 +13194,12 @@ static void test_hotkey(void)
/* Inject the appropriate key sequence */ /* Inject the appropriate key sequence */
keybd_event(VK_LWIN, 0, 0, 0); keybd_event(VK_LWIN, 0, 0, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
DispatchMessage(&msg); DispatchMessage(&msg);
ok_sequence(WmHotkeyPressLWIN, "window hotkey press LWIN", FALSE); ok_sequence(WmHotkeyPressLWIN, "window hotkey press LWIN", FALSE);
keybd_event(hotkey_letter, 0, 0, 0); keybd_event(hotkey_letter, 0, 0, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
{ {
if (msg.message == WM_HOTKEY) if (msg.message == WM_HOTKEY)
{ {
...@@ -13181,14 +13214,12 @@ static void test_hotkey(void) ...@@ -13181,14 +13214,12 @@ static void test_hotkey(void)
ok((key_state & 0x8000) == 0x8000, "unexpected key state %x\n", key_state); ok((key_state & 0x8000) == 0x8000, "unexpected key state %x\n", key_state);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0); keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
DispatchMessage(&msg); DispatchMessage(&msg);
ok_sequence(WmHotkeyRelease, "window hotkey release", FALSE); ok_sequence(WmHotkeyRelease, "window hotkey release", FALSE);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0); keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
DispatchMessage(&msg); DispatchMessage(&msg);
ok_sequence(WmHotkeyReleaseLWIN, "window hotkey release LWIN", FALSE); ok_sequence(WmHotkeyReleaseLWIN, "window hotkey release LWIN", FALSE);
...@@ -13212,8 +13243,7 @@ static void test_hotkey(void) ...@@ -13212,8 +13243,7 @@ static void test_hotkey(void)
/* Inject the appropriate key sequence */ /* Inject the appropriate key sequence */
keybd_event(VK_LWIN, 0, 0, 0); keybd_event(VK_LWIN, 0, 0, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
{ {
ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message); ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message);
DispatchMessage(&msg); DispatchMessage(&msg);
...@@ -13221,8 +13251,7 @@ static void test_hotkey(void) ...@@ -13221,8 +13251,7 @@ static void test_hotkey(void)
ok_sequence(WmHotkeyPressLWIN, "thread hotkey press LWIN", FALSE); ok_sequence(WmHotkeyPressLWIN, "thread hotkey press LWIN", FALSE);
keybd_event(hotkey_letter, 0, 0, 0); keybd_event(hotkey_letter, 0, 0, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
{ {
if (msg.message == WM_HOTKEY) if (msg.message == WM_HOTKEY)
{ {
...@@ -13243,8 +13272,7 @@ static void test_hotkey(void) ...@@ -13243,8 +13272,7 @@ static void test_hotkey(void)
ok_sequence(WmHotkeyPress, "thread hotkey press", FALSE); ok_sequence(WmHotkeyPress, "thread hotkey press", FALSE);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0); keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
{ {
ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message); ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message);
DispatchMessage(&msg); DispatchMessage(&msg);
...@@ -13252,8 +13280,7 @@ static void test_hotkey(void) ...@@ -13252,8 +13280,7 @@ static void test_hotkey(void)
ok_sequence(WmHotkeyRelease, "thread hotkey release", FALSE); ok_sequence(WmHotkeyRelease, "thread hotkey release", FALSE);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0); keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) || while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
PeekMessage(&msg, NULL, WM_HOTKEY, WM_HOTKEY, PM_REMOVE))
{ {
ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message); ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message);
DispatchMessage(&msg); DispatchMessage(&msg);
......
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