From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/tests/device8.c | 11 +++++++++++ dlls/win32u/input.c | 9 +++++++++ dlls/win32u/message.c | 13 +++---------- dlls/win32u/ntuser_private.h | 11 +++++++++++ server/protocol.def | 1 + server/queue.c | 6 ++++++ 6 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index 7fb0ef538e0..6bfc88f01cc 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -2038,6 +2038,9 @@ static void test_hid_touch_screen(void) ret = RegisterRawInputDevices( &rawdevice, 1, sizeof(RAWINPUTDEVICE) ); ok( ret, "RegisterRawInputDevices failed, error %lu\n", GetLastError() );
+ res = GetQueueStatus( QS_RAWINPUT ); + ok( res == 0, "got res %#lx\n", res ); + bus_send_hid_input( file, &desc, &touch_multiple, sizeof(touch_multiple) ); bus_wait_hid_input( file, &desc, 5000 ); bus_send_hid_input( file, &desc, &touch_release, sizeof(touch_release) ); @@ -2046,6 +2049,10 @@ static void test_hid_touch_screen(void) res = MsgWaitForMultipleObjects( 0, NULL, FALSE, 500, QS_POINTER ); ok( !res, "MsgWaitForMultipleObjects returned %#lx\n", res );
+ res = GetQueueStatus( QS_RAWINPUT ); + ok( LOWORD(res) == QS_RAWINPUT, "got res %#lx\n", res ); + ok( HIWORD(res) == QS_RAWINPUT, "got res %#lx\n", res ); + memset( rawbuffer, 0, sizeof(rawbuffer) ); rawinput = (RAWINPUT *)rawbuffer; rawbuffer_size = sizeof(rawbuffer); @@ -2064,6 +2071,10 @@ static void test_hid_touch_screen(void) ok( !memcmp( rawinput->data.hid.bRawData, touch_multiple.report_buf, desc.caps.InputReportByteLength ), "got unexpected report data\n" );
+ res = GetQueueStatus( QS_RAWINPUT ); + ok( LOWORD(res) == 0, "got res %#lx\n", res ); + ok( HIWORD(res) == 0, "got res %#lx\n", res ); + rawdevice.dwFlags = RIDEV_REMOVE; rawdevice.hwndTarget = 0; ret = RegisterRawInputDevices( &rawdevice, 1, sizeof(RAWINPUTDEVICE) ); diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 4a7c04f66c5..1886ff979d7 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -791,8 +791,17 @@ BOOL WINAPI NtUserGetCursorInfo( CURSORINFO *info )
static void check_for_events( UINT flags ) { + struct peek_message_filter filter = + { + .internal = TRUE, + .flags = PM_REMOVE, + }; + MSG msg; + if (!user_driver->pProcessEvents( flags )) flush_window_surfaces( TRUE ); + + peek_message( &msg, &filter ); }
/********************************************************************** diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 6c2335dedee..84625f82964 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2691,15 +2691,6 @@ static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardwar return ret; }
-struct peek_message_filter -{ - HWND hwnd; - UINT first; - UINT last; - UINT mask; - UINT flags; -}; - /*********************************************************************** * peek_message * @@ -2707,7 +2698,7 @@ struct peek_message_filter * available; -1 on error. * All pending sent messages are processed before returning. */ -static int peek_message( MSG *msg, const struct peek_message_filter *filter ) +int peek_message( MSG *msg, const struct peek_message_filter *filter ) { LRESULT result; HWND hwnd = filter->hwnd; @@ -2734,6 +2725,7 @@ static int peek_message( MSG *msg, const struct peek_message_filter *filter )
SERVER_START_REQ( get_message ) { + req->internal = filter->internal; req->flags = flags; req->get_win = wine_server_user_handle( hwnd ); req->get_first = first; @@ -2919,6 +2911,7 @@ static int peek_message( MSG *msg, const struct peek_message_filter *filter ) .first = info.msg.message, .last = info.msg.message, .mask = filter->mask, + .internal = filter->internal, }; peek_message( msg, &new_filter ); } diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 3b6cab5bdc9..bb2169998b6 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -238,6 +238,17 @@ extern void free_dce( struct dce *dce, HWND hwnd ); extern void invalidate_dce( WND *win, const RECT *extra_rect );
/* message.c */ +struct peek_message_filter +{ + HWND hwnd; + UINT first; + UINT last; + UINT mask; + UINT flags; + BOOL internal; +}; + +extern int peek_message( MSG *msg, const struct peek_message_filter *filter ); extern BOOL set_keyboard_auto_repeat( BOOL enable );
/* systray.c */ diff --git a/server/protocol.def b/server/protocol.def index 13aea96e796..d76390ce308 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2149,6 +2149,7 @@ enum message_type unsigned int hw_id; /* id of the previous hardware message (or 0) */ unsigned int wake_mask; /* wakeup bits mask */ unsigned int changed_mask; /* changed bits mask */ + unsigned int internal; /* get internal messages only */ @REPLY user_handle_t win; /* window handle */ unsigned int msg; /* message code */ diff --git a/server/queue.c b/server/queue.c index c884e9f7f55..ed099b3b989 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2994,6 +2994,12 @@ DECL_HANDLER(get_message) WM_WINE_LAST_DRIVER_MSG, req->flags, reply )) return;
+ if (req->internal) /* check for internal messages only, leave queue flags unchanged */ + { + set_error( STATUS_PENDING ); + return; + } + queue->last_get_msg = current_time; if (!filter) filter = QS_ALLINPUT;