Module: wine Branch: master Commit: 43197e6641591c4b2955f086df7e880fbdb2d7ae URL: http://source.winehq.org/git/wine.git/?a=commit;h=43197e6641591c4b2955f086df...
Author: Qian Hong qhong@codeweavers.com Date: Wed Dec 30 17:13:49 2015 +0800
user32: Properly handle WM_DEVICECHANGE in is_pointer_message().
Signed-off-by: Qian Hong qhong@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/message.c | 15 ++++++++------- dlls/user32/tests/msg.c | 12 +++++------- 2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 96e7f2e..ba3f4c6 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -422,9 +422,10 @@ static const unsigned int message_unicode_flags[] = };
/* check whether a given message type includes pointers */ -static inline BOOL is_pointer_message( UINT message ) +static inline BOOL is_pointer_message( UINT message, WPARAM wparam ) { if (message >= 8*sizeof(message_pointer_flags)) return FALSE; + if (message == WM_DEVICECHANGE && !(wparam & 0x8000)) return FALSE; return (message_pointer_flags[message / 32] & SET(message)) != 0; }
@@ -3490,7 +3491,7 @@ BOOL WINAPI SendNotifyMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara { struct send_message_info info;
- if (is_pointer_message(msg)) + if (is_pointer_message( msg, wparam )) { SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; @@ -3515,7 +3516,7 @@ BOOL WINAPI SendNotifyMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara { struct send_message_info info;
- if (is_pointer_message(msg)) + if (is_pointer_message( msg, wparam )) { SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; @@ -3540,7 +3541,7 @@ BOOL WINAPI SendMessageCallbackA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa { struct send_message_info info;
- if (is_pointer_message(msg)) + if (is_pointer_message( msg, wparam )) { SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; @@ -3568,7 +3569,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa { struct send_message_info info;
- if (is_pointer_message(msg)) + if (is_pointer_message( msg, wparam )) { SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; @@ -3638,7 +3639,7 @@ BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { struct send_message_info info;
- if (is_pointer_message( msg )) + if (is_pointer_message( msg, wparam )) { SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; @@ -3687,7 +3688,7 @@ BOOL WINAPI PostThreadMessageW( DWORD thread, UINT msg, WPARAM wparam, LPARAM lp { struct send_message_info info;
- if (is_pointer_message( msg )) + if (is_pointer_message( msg, wparam )) { SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 7204d19..bf1dab2 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -4553,13 +4553,11 @@ static void test_WM_DEVICECHANGE(HWND hwnd) } else { - todo_wine { - ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE); - ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret); - memset(&msg, 0, sizeof(msg)); - ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "PeekMessage should succeed\n"); - ok(msg.message == WM_DEVICECHANGE, "got %04x instead of WM_DEVICECHANGE\n", msg.message); - } + ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE); + ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret); + memset(&msg, 0, sizeof(msg)); + ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "PeekMessage should succeed\n"); + ok(msg.message == WM_DEVICECHANGE, "got %04x instead of WM_DEVICECHANGE\n", msg.message); } } }