From 45b24af4b2a9b7a050608028a5dd39b7dab13c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincas=20Mili=C5=ABnas?= Date: Mon, 4 Jul 2011 15:12:11 +0300 Subject: [PATCH 20/20] server+user32: Added RIDEV_NOLEGACY raw input device flag implementation (try 16) --- dlls/user32/input.c | 1 - dlls/user32/tests/input.c | 4 ++-- server/queue.c | 11 ++++++++++- server/raw_input.c | 14 ++++++++++++++ server/raw_input.h | 3 +++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index bbef25f..89bcd47 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -585,7 +585,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(PRAWINPUTDEVICE pRawInputD } else if ((device_flags & RIDEV_NOLEGACY) == RIDEV_NOLEGACY) { - FIXME("RIDEV_NOLEGACY support is not implemented\n"); device_flags &= ~RIDEV_NOLEGACY; registration_flags |= RAW_INPUT_DEVICE_FLAG_NOLEGACY; diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index e1ce96f..b0f495a 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -2766,7 +2766,7 @@ static void test_get_raw_input_data_simulation(void) hWnd = test_get_raw_input_data_simulation_setup(hInstance, wclass.lpszClassName, &device, mouse_input, 5); - todo_wine ok(!legacy_mouse_message_recieved, + ok(!legacy_mouse_message_recieved, "Did receive legacy mouse messages, while was expecting not to\n"); test_get_raw_input_data_simulation_teardown(hWnd, &device); @@ -2776,7 +2776,7 @@ static void test_get_raw_input_data_simulation(void) hWnd = test_get_raw_input_data_simulation_setup(hInstance, wclass.lpszClassName, &device, &keyboard_input, 1); - todo_wine ok(!legacy_keyboard_message_recieved, + ok(!legacy_keyboard_message_recieved, "Did receive legacy mouse messages, while was expecting not to\n"); test_get_raw_input_data_simulation_teardown(hWnd, &device); } diff --git a/server/queue.c b/server/queue.c index f1b7e03..1db320d 100644 --- a/server/queue.c +++ b/server/queue.c @@ -440,6 +440,12 @@ static inline int is_keyboard_msg( struct message *msg ) return (msg->msg >= WM_KEYFIRST && msg->msg <= WM_KEYLAST); } +/* check whether msg is a mouse message */ +static inline int is_mouse_msg( struct message *msg ) +{ + return (msg->msg >= WM_MOUSEFIRST && msg->msg <= WM_MOUSELAST); +} + /* check if message is matched by the filter */ static inline int check_msg_filter( unsigned int msg, unsigned int first, unsigned int last ) { @@ -1460,7 +1466,10 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg if (win != desktop->cursor.win) always_queue = 1; desktop->cursor.win = win; - if (!always_queue || merge_message( input, msg )) free_message( msg ); + if ((is_keyboard_msg( msg ) && is_nolegacy_set_for_raw_input_keyboard()) || + (is_mouse_msg( msg ) && is_nolegacy_set_for_raw_input_mouse()) || + !always_queue || merge_message( input, msg )) + free_message( msg ); else { msg->unique_id = 0; /* will be set once we return it to the app */ diff --git a/server/raw_input.c b/server/raw_input.c index 6fd0d82..4618425 100644 --- a/server/raw_input.c +++ b/server/raw_input.c @@ -424,6 +424,20 @@ void queue_keyboard_raw_input( unsigned int flags, unsigned int info, unsigned i queue_raw_input( input, registration, focus ); } +/* Check if nolegacy flag is set for a mouse device registration */ +BOOL is_nolegacy_set_for_raw_input_mouse(void) +{ + struct raw_registration *registration = find_registered_usage( HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_MOUSE ); + return registration ? registration->flags & RAW_INPUT_DEVICE_FLAG_NOLEGACY : FALSE; +} + +/* Check if nolegacy flag is set for a keyboard device registration */ +BOOL is_nolegacy_set_for_raw_input_keyboard(void) +{ + struct raw_registration *registration = find_registered_usage( HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_KEYBOARD ); + return registration ? registration->flags & RAW_INPUT_DEVICE_FLAG_NOLEGACY : FALSE; +} + /* Get the raw input device list */ DECL_HANDLER(get_raw_input_device_list) { diff --git a/server/raw_input.h b/server/raw_input.h index d881585..4a4acf0 100644 --- a/server/raw_input.h +++ b/server/raw_input.h @@ -32,4 +32,7 @@ extern void queue_mouse_raw_input( unsigned int flags, unsigned int info, extern void queue_keyboard_raw_input( unsigned int flags, unsigned int info, unsigned int vk_code, unsigned int scan_code, user_handle_t focus ); +extern BOOL is_nolegacy_set_for_raw_input_mouse(void); +extern BOOL is_nolegacy_set_for_raw_input_keyboard(void); + #endif /* __WINE_SERVER_RAW_INPUT_H */ -- 1.7.3.4