From 10a0e0b89e0ec1c230124678e671a342967c795f Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 22 Aug 2023 10:39:59 +1000 Subject: [PATCH] Updated user32-rawinput-mouse patchset --- ...-Split-XInput2-thread-initialization.patch | 24 ++--- ...ort-XInput2-events-for-individual-wi.patch | 11 +-- ...dvertise-XInput2-version-2.1-support.patch | 18 ++-- ...-track-of-pointer-and-device-button-.patch | 20 ++--- ...hardware_message-flags-for-rawinput-.patch | 26 +++--- ...HWMSG_RAWINPUT-flags-only-when-RAWIN.patch | 26 +++--- ...ending-RIM_TYPEMOUSE-through-__wine_.patch | 12 +-- ...en-to-RawMotion-and-RawButton-events.patch | 87 +++++++++---------- ...nex11-Fixup-virtual-windows-creation.patch | 60 ------------- 9 files changed, 112 insertions(+), 172 deletions(-) delete mode 100644 patches/user32-rawinput-mouse/0009-winex11-Fixup-virtual-windows-creation.patch diff --git a/patches/user32-rawinput-mouse/0001-winex11.drv-Split-XInput2-thread-initialization.patch b/patches/user32-rawinput-mouse/0001-winex11.drv-Split-XInput2-thread-initialization.patch index 4a98955c..09fe11fc 100644 --- a/patches/user32-rawinput-mouse/0001-winex11.drv-Split-XInput2-thread-initialization.patch +++ b/patches/user32-rawinput-mouse/0001-winex11.drv-Split-XInput2-thread-initialization.patch @@ -1,4 +1,4 @@ -From a96d0f2e49227bab4a3181ce083afabb65adb950 Mon Sep 17 00:00:00 2001 +From e25ad836af126afcff4cdc12dbebb410722806dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 17 Jan 2020 16:33:11 +0100 Subject: [PATCH] winex11.drv: Split XInput2 thread initialization. @@ -11,10 +11,10 @@ And rename the library and function loader to x11drv_xinput_load. 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index c34f5fde77e..f9cf4a33255 100644 +index 3ddcf609549..a28746b9aef 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -278,6 +278,32 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator +@@ -253,6 +253,32 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator } @@ -47,7 +47,7 @@ index c34f5fde77e..f9cf4a33255 100644 /*********************************************************************** * enable_xinput2 */ -@@ -289,19 +315,9 @@ static void enable_xinput2(void) +@@ -264,19 +290,9 @@ static void enable_xinput2(void) unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; int count; @@ -69,7 +69,7 @@ index c34f5fde77e..f9cf4a33255 100644 if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return; mask.mask = mask_bits; -@@ -342,9 +358,9 @@ static void disable_xinput2(void) +@@ -317,9 +333,9 @@ static void disable_xinput2(void) struct x11drv_thread_data *data = x11drv_thread_data(); XIEventMask mask; @@ -80,7 +80,7 @@ index c34f5fde77e..f9cf4a33255 100644 data->xi2_state = xi_disabled; mask.mask = NULL; -@@ -1954,9 +1970,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1753,9 +1769,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) /*********************************************************************** @@ -93,10 +93,10 @@ index c34f5fde77e..f9cf4a33255 100644 #if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H) int event, error; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 9ceec5ee6d8..dbdb9c530bb 100644 +index 9ee6498a02e..16fc2843880 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -258,7 +258,8 @@ extern void X11DRV_ThreadDetach(void) DECLSPEC_HIDDEN; +@@ -261,7 +261,8 @@ extern void X11DRV_ThreadDetach(void) DECLSPEC_HIDDEN; /* X11 driver internal functions */ extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN; @@ -107,10 +107,10 @@ index 9ceec5ee6d8..dbdb9c530bb 100644 extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 3a1e1973b24..6457c0a0b93 100644 +index c4d537d6ada..fc341c32f77 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c -@@ -704,7 +704,7 @@ static NTSTATUS x11drv_init( void *arg ) +@@ -700,7 +700,7 @@ static NTSTATUS x11drv_init( void *arg ) #ifdef SONAME_LIBXCOMPOSITE X11DRV_XComposite_Init(); #endif @@ -119,7 +119,7 @@ index 3a1e1973b24..6457c0a0b93 100644 XkbUseExtension( gdi_display, NULL, NULL ); X11DRV_InitKeyboard( gdi_display ); -@@ -794,6 +794,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) +@@ -790,6 +790,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) if (use_xim) xim_thread_attach( data ); @@ -129,5 +129,5 @@ index 3a1e1973b24..6457c0a0b93 100644 } -- -2.40.0 +2.40.1 diff --git a/patches/user32-rawinput-mouse/0002-winex11.drv-Support-XInput2-events-for-individual-wi.patch b/patches/user32-rawinput-mouse/0002-winex11.drv-Support-XInput2-events-for-individual-wi.patch index b0e4aaf7..09da63cf 100644 --- a/patches/user32-rawinput-mouse/0002-winex11.drv-Support-XInput2-events-for-individual-wi.patch +++ b/patches/user32-rawinput-mouse/0002-winex11.drv-Support-XInput2-events-for-individual-wi.patch @@ -1,4 +1,4 @@ -From 02e3cc8520790ddbae90b5b38421aa6218ca2b1e Mon Sep 17 00:00:00 2001 +From 5c869c2c59231cd9028d35511259618339c1a8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 23 Jan 2020 11:00:19 +0100 Subject: [PATCH] winex11.drv: Support XInput2 events for individual windows. @@ -8,10 +8,10 @@ which can bring additional information. --- dlls/winex11.drv/desktop.c | 2 ++ dlls/winex11.drv/event.c | 7 +++++ - dlls/winex11.drv/mouse.c | 58 +++++++++++++++++++++++++++----------- + dlls/winex11.drv/mouse.c | 59 +++++++++++++++++++++++++++----------- dlls/winex11.drv/window.c | 3 ++ dlls/winex11.drv/x11drv.h | 12 +++++++- - 5 files changed, 65 insertions(+), 17 deletions(-) + 5 files changed, 66 insertions(+), 17 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 687c0cf5a4c..01bd6a1b74a 100644 @@ -45,7 +45,7 @@ index c3c8d9a4070..f6d9041ca65 100644 case MotionNotify: case EnterNotify: diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index a28746b9aef..c8c94733122 100644 +index a28746b9aef..f11e73f436b 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -280,20 +280,32 @@ void x11drv_xinput_init(void) @@ -176,11 +176,12 @@ index a28746b9aef..c8c94733122 100644 return FALSE; } clip_rect = *clip; -@@ -452,7 +479,6 @@ void ungrab_clipping_window(void) +@@ -452,7 +479,7 @@ void ungrab_clipping_window(void) if (clipping_cursor) XUngrabPointer( data->display, CurrentTime ); clipping_cursor = FALSE; data->clipping_cursor = FALSE; - disable_xinput2(); ++ x11drv_xinput_disable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); } /*********************************************************************** diff --git a/patches/user32-rawinput-mouse/0003-winex11.drv-Advertise-XInput2-version-2.1-support.patch b/patches/user32-rawinput-mouse/0003-winex11.drv-Advertise-XInput2-version-2.1-support.patch index 718ae761..cb3f500c 100644 --- a/patches/user32-rawinput-mouse/0003-winex11.drv-Advertise-XInput2-version-2.1-support.patch +++ b/patches/user32-rawinput-mouse/0003-winex11.drv-Advertise-XInput2-version-2.1-support.patch @@ -1,4 +1,4 @@ -From d16f519ea4973bfbdb91819c9a63046375ef2a96 Mon Sep 17 00:00:00 2001 +From 9e5a2e10d466cbd51338a46d0385457bcb612b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 24 Oct 2021 22:30:56 +0200 Subject: [PATCH] winex11.drv: Advertise XInput2 version 2.1 support. @@ -22,10 +22,10 @@ device events only and get rid of slave device id tracking. 2 files changed, 5 insertions(+), 40 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index fbd463ce85d..83e19493333 100644 +index f11e73f436b..ff91aecb67f 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -261,7 +261,7 @@ void x11drv_xinput_init(void) +@@ -260,7 +260,7 @@ void x11drv_xinput_init(void) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H struct x11drv_thread_data *data = x11drv_thread_data(); @@ -34,7 +34,7 @@ index fbd463ce85d..83e19493333 100644 if (data->xi2_state != xi_unknown) return; -@@ -274,7 +274,7 @@ void x11drv_xinput_init(void) +@@ -273,7 +273,7 @@ void x11drv_xinput_init(void) else { data->xi2_state = xi_unavailable; @@ -43,7 +43,7 @@ index fbd463ce85d..83e19493333 100644 } #endif } -@@ -310,7 +310,7 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) +@@ -309,7 +309,7 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); @@ -52,7 +52,7 @@ index fbd463ce85d..83e19493333 100644 memset( mask_bits, 0, sizeof(mask_bits) ); XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); -@@ -323,16 +323,6 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) +@@ -322,16 +322,6 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) update_relative_valuators( pointer_info->classes, pointer_info->num_classes ); pXIFreeDeviceInfo( pointer_info ); @@ -69,7 +69,7 @@ index fbd463ce85d..83e19493333 100644 data->xi2_state = xi_enabled; } -@@ -365,19 +355,16 @@ void x11drv_xinput_disable( Display *display, Window window, long event_mask ) +@@ -364,19 +354,16 @@ void x11drv_xinput_disable( Display *display, Window window, long event_mask ) mask.mask = NULL; mask.mask_len = 0; @@ -126,10 +126,10 @@ index fbd463ce85d..83e19493333 100644 virtual_rect = NtUserGetVirtualScreenRect(); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index d8f7fa1441b..8b401080bc5 100644 +index e8cc85a15bd..fc3231ed40d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -405,12 +405,9 @@ struct x11drv_thread_data +@@ -402,12 +402,9 @@ struct x11drv_thread_data BOOL clipping_cursor; /* whether thread is currently clipping the cursor */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H enum xi2_state xi2_state; /* XInput2 state */ diff --git a/patches/user32-rawinput-mouse/0004-winex11.drv-Keep-track-of-pointer-and-device-button-.patch b/patches/user32-rawinput-mouse/0004-winex11.drv-Keep-track-of-pointer-and-device-button-.patch index af90c2e6..b6d5e7de 100644 --- a/patches/user32-rawinput-mouse/0004-winex11.drv-Keep-track-of-pointer-and-device-button-.patch +++ b/patches/user32-rawinput-mouse/0004-winex11.drv-Keep-track-of-pointer-and-device-button-.patch @@ -1,4 +1,4 @@ -From baca91ec583435db0ab89dbe12791fcb277d1154 Mon Sep 17 00:00:00 2001 +From 1d38a722177d02eb836ff8f9aa9857d00e6a7ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 19 Dec 2019 22:34:44 +0100 Subject: [PATCH] winex11.drv: Keep track of pointer and device button @@ -16,10 +16,10 @@ Original patch by Andrew Eikum . 4 files changed, 106 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c -index 195cc65eddb..83169a9bb4d 100644 +index b240b228ff0..b54ca795954 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c -@@ -1811,13 +1811,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event ) +@@ -1809,13 +1809,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event ) { HWND hwnd; @@ -51,7 +51,7 @@ index 195cc65eddb..83169a9bb4d 100644 } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 83e19493333..20d57aa76f3 100644 +index ff91aecb67f..33f6ac24af8 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -30,6 +30,9 @@ @@ -64,7 +64,7 @@ index 83e19493333..20d57aa76f3 100644 #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H #include #endif -@@ -138,6 +141,14 @@ MAKE_FUNCPTR(XISelectEvents); +@@ -137,6 +140,14 @@ MAKE_FUNCPTR(XISelectEvents); #undef MAKE_FUNCPTR #endif @@ -79,7 +79,7 @@ index 83e19493333..20d57aa76f3 100644 /*********************************************************************** * X11DRV_Xcursor_Init * -@@ -225,6 +236,70 @@ void set_window_cursor( Window window, HCURSOR handle ) +@@ -224,6 +235,70 @@ void set_window_cursor( Window window, HCURSOR handle ) XFlush( gdi_display ); } @@ -196,10 +196,10 @@ index 83e19493333..20d57aa76f3 100644 xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 8b401080bc5..d147add9d68 100644 +index fc3231ed40d..8bbac23f88e 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -695,6 +695,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN; +@@ -691,6 +691,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN; extern void ungrab_clipping_window(void) DECLSPEC_HIDDEN; extern void move_resize_window( HWND hwnd, int dir ) DECLSPEC_HIDDEN; extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN; @@ -208,10 +208,10 @@ index 8b401080bc5..d147add9d68 100644 extern HWND *build_hwnd_list(void) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 2691f40d750..fbff380c2b0 100644 +index fc341c32f77..b0e306e3ac8 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c -@@ -705,6 +705,7 @@ static NTSTATUS x11drv_init( void *arg ) +@@ -704,6 +704,7 @@ static NTSTATUS x11drv_init( void *arg ) XkbUseExtension( gdi_display, NULL, NULL ); X11DRV_InitKeyboard( gdi_display ); diff --git a/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch b/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch index 29bdcbcf..e8275399 100644 --- a/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch +++ b/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch @@ -1,4 +1,4 @@ -From f13bfd6f599ae272f698bb06491d689bd6d5d142 Mon Sep 17 00:00:00 2001 +From 5afa48387aee90fcc968ae049a1d047271cf4ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 26 Aug 2019 14:37:20 +0200 Subject: [PATCH] server: Add send_hardware_message flags for rawinput @@ -11,10 +11,10 @@ Subject: [PATCH] server: Add send_hardware_message flags for rawinput 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c -index ad3d8e85cd2..bad69c18142 100644 +index d15f9af3f9f..5f7ac9189c3 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c -@@ -2627,6 +2627,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r +@@ -3463,6 +3463,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.mouse.flags = input->mi.dwFlags; req->input.mouse.time = input->mi.time; req->input.mouse.info = input->mi.dwExtraInfo; @@ -22,7 +22,7 @@ index ad3d8e85cd2..bad69c18142 100644 affects_key_state = !!(input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_MIDDLEDOWN | MOUSEEVENTF_MIDDLEUP | -@@ -2638,6 +2639,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r +@@ -3474,6 +3475,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.kbd.flags = input->ki.dwFlags; req->input.kbd.time = input->ki.time; req->input.kbd.info = input->ki.dwExtraInfo; @@ -31,10 +31,10 @@ index ad3d8e85cd2..bad69c18142 100644 break; case INPUT_HARDWARE: diff --git a/server/protocol.def b/server/protocol.def -index a4660a21aca..9e6ba5317fd 100644 +index 919297c818c..416fdf020fd 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -2082,6 +2082,7 @@ enum message_type +@@ -2143,6 +2143,7 @@ enum message_type int new_y; @END #define SEND_HWMSG_INJECTED 0x01 @@ -43,10 +43,10 @@ index a4660a21aca..9e6ba5317fd 100644 /* Get a message from the current queue */ diff --git a/server/queue.c b/server/queue.c -index 61cbeec75dd..f5dbe0e733e 100644 +index fcc946ff0cb..f62593b096a 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1794,7 +1794,7 @@ done: +@@ -1845,7 +1845,7 @@ done: /* queue a hardware message for a mouse event */ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, @@ -55,7 +55,7 @@ index 61cbeec75dd..f5dbe0e733e 100644 { const struct rawinput_device *device; struct hardware_msg_data *msg_data; -@@ -1849,7 +1849,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1900,7 +1900,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons y = desktop->cursor.y; } @@ -64,7 +64,7 @@ index 61cbeec75dd..f5dbe0e733e 100644 { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; -@@ -1908,7 +1908,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1960,7 +1960,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons /* queue a hardware message for a keyboard event */ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, @@ -73,7 +73,7 @@ index 61cbeec75dd..f5dbe0e733e 100644 { struct hw_msg_source source = { IMDT_KEYBOARD, origin }; const struct rawinput_device *device; -@@ -1986,7 +1986,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c +@@ -2038,7 +2038,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c break; } @@ -82,7 +82,7 @@ index 61cbeec75dd..f5dbe0e733e 100644 { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; -@@ -2617,10 +2617,10 @@ DECL_HANDLER(send_hardware_message) +@@ -2664,10 +2664,10 @@ DECL_HANDLER(send_hardware_message) switch (req->input.type) { case INPUT_MOUSE: @@ -96,5 +96,5 @@ index 61cbeec75dd..f5dbe0e733e 100644 case INPUT_HARDWARE: queue_custom_hardware_message( desktop, req->win, origin, &req->input ); -- -2.39.2 +2.40.1 diff --git a/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch b/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch index 8d425191..9c87b541 100644 --- a/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch +++ b/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch @@ -1,4 +1,4 @@ -From 563e36d041a509b71fb7f889dee52dee151a7442 Mon Sep 17 00:00:00 2001 +From 1c5763ee8859e76c72b2247a846bdf9addf9b138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Mar 2021 23:29:28 +0100 Subject: [PATCH] user32: Set SEND_HWMSG_RAWINPUT flags only when RAWINPUT is @@ -19,7 +19,7 @@ __wine_send_input with INPUT_HARDWARE input type and a rawinput. 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c -index 7eb8e59a5fb..53fec064842 100644 +index 1f9e48423fc..dc8f44ee910 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -655,6 +655,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) @@ -40,10 +40,10 @@ index 7eb8e59a5fb..53fec064842 100644 case INPUT_HARDWARE: RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c -index 179b801a9f8..3fb36f4762c 100644 +index 5f7ac9189c3..b60afaad475 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c -@@ -2669,7 +2669,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r +@@ -3463,7 +3463,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.mouse.flags = input->mi.dwFlags; req->input.mouse.time = input->mi.time; req->input.mouse.info = input->mi.dwExtraInfo; @@ -52,7 +52,7 @@ index 179b801a9f8..3fb36f4762c 100644 affects_key_state = !!(input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_MIDDLEDOWN | MOUSEEVENTF_MIDDLEUP | -@@ -2681,7 +2681,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r +@@ -3475,7 +3475,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.kbd.flags = input->ki.dwFlags; req->input.kbd.time = input->ki.time; req->input.kbd.info = input->ki.dwExtraInfo; @@ -176,10 +176,10 @@ index b54ca795954..231af33fd48 100644 diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index d8e9b8155fb..61b1870ba5a 100644 +index 33f6ac24af8..ca0092f21c1 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -625,6 +625,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x +@@ -626,6 +626,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input ) { struct x11drv_win_data *data; @@ -187,7 +187,7 @@ index d8e9b8155fb..61b1870ba5a 100644 input->type = INPUT_MOUSE; -@@ -632,7 +633,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -633,7 +634,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU { struct x11drv_thread_data *thread_data = x11drv_thread_data(); if (!thread_data->clipping_cursor || thread_data->clip_window != window) return; @@ -196,7 +196,7 @@ index d8e9b8155fb..61b1870ba5a 100644 return; } -@@ -659,7 +660,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -660,7 +661,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU SERVER_END_REQ; } @@ -205,7 +205,7 @@ index d8e9b8155fb..61b1870ba5a 100644 } #ifdef SONAME_LIBXCURSOR -@@ -1587,6 +1588,7 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1588,6 +1589,7 @@ void move_resize_window( HWND hwnd, int dir ) { MSG msg; INPUT input; @@ -213,7 +213,7 @@ index d8e9b8155fb..61b1870ba5a 100644 int x, y, rootX, rootY; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; -@@ -1602,7 +1604,7 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1603,7 +1605,7 @@ void move_resize_window( HWND hwnd, int dir ) input.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.mi.time = NtGetTickCount(); input.mi.dwExtraInfo = 0; @@ -222,7 +222,7 @@ index d8e9b8155fb..61b1870ba5a 100644 } while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) -@@ -1815,6 +1817,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) +@@ -1816,6 +1818,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { XIRawEvent *event = xev->data; @@ -230,7 +230,7 @@ index d8e9b8155fb..61b1870ba5a 100644 INPUT input; if (broken_rawevents && is_old_motion_event( xev->serial )) -@@ -1832,7 +1835,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1833,7 +1836,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE; diff --git a/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch b/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch index e8ea6b2c..70c27c5d 100644 --- a/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch +++ b/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch @@ -1,4 +1,4 @@ -From 565e6c2d8207d6014bd8d22015419fc587329e0e Mon Sep 17 00:00:00 2001 +From 72c71236311247110b966356e35501da26eeab52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 25 Mar 2021 14:26:35 +0100 Subject: [PATCH] user32: Support sending RIM_TYPEMOUSE through @@ -10,10 +10,10 @@ Subject: [PATCH] user32: Support sending RIM_TYPEMOUSE through 2 files changed, 9 insertions(+) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c -index 60deeb38bce..0167c35b53b 100644 +index b60afaad475..d622ae8aea8 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c -@@ -2622,6 +2622,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r +@@ -3488,6 +3488,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.hw.rawinput.type = rawinput->header.dwType; switch (rawinput->header.dwType) { @@ -27,10 +27,10 @@ index 60deeb38bce..0167c35b53b 100644 req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice ); req->input.hw.rawinput.hid.param = rawinput->header.wParam; diff --git a/server/queue.c b/server/queue.c -index bec57c85d1a..a7b8ce35347 100644 +index f62593b096a..cdd02d1534d 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -2042,6 +2042,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ +@@ -2132,6 +2132,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ msg_data->size = sizeof(*msg_data) + report_size; msg_data->rawinput = input->hw.rawinput; @@ -41,5 +41,5 @@ index bec57c85d1a..a7b8ce35347 100644 return; } -- -2.35.1 +2.40.1 diff --git a/patches/user32-rawinput-mouse/0008-winex11.drv-Listen-to-RawMotion-and-RawButton-events.patch b/patches/user32-rawinput-mouse/0008-winex11.drv-Listen-to-RawMotion-and-RawButton-events.patch index 33bca2ad..bd9ac41e 100644 --- a/patches/user32-rawinput-mouse/0008-winex11.drv-Listen-to-RawMotion-and-RawButton-events.patch +++ b/patches/user32-rawinput-mouse/0008-winex11.drv-Listen-to-RawMotion-and-RawButton-events.patch @@ -1,4 +1,4 @@ -From cf4f812de02820e94c30758a9267872bd5429ac0 Mon Sep 17 00:00:00 2001 +From 1bf08ef753b4f7fc43e72aa71c20c1b952b83bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 25 Oct 2021 11:45:47 +0200 Subject: [PATCH] winex11.drv: Listen to RawMotion and RawButton* events in the @@ -8,14 +8,14 @@ We still need to send "normal" input from the clipping window thread to trigger low-level hooks callbacks when clipping cursor. This is for instance used in our dinput implementation. --- - dlls/winex11.drv/event.c | 10 +++- - dlls/winex11.drv/mouse.c | 106 ++++++++++++++++++++++++++++++--- - dlls/winex11.drv/x11drv.h | 1 + - dlls/winex11.drv/x11drv_main.c | 4 ++ - 4 files changed, 112 insertions(+), 9 deletions(-) + dlls/winex11.drv/event.c | 10 +++- + dlls/winex11.drv/mouse.c | 105 +++++++++++++++++++++++++++++++++++--- + dlls/winex11.drv/window.c | 4 ++ + dlls/winex11.drv/x11drv.h | 1 + + 4 files changed, 111 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c -index e5021eb38ff..9cf7969dce2 100644 +index f6d9041ca65..d11f75cf1a6 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -318,6 +318,10 @@ static enum event_merge_action merge_raw_motion_events( XIRawEvent *prev, XIRawE @@ -54,30 +54,36 @@ index e5021eb38ff..9cf7969dce2 100644 #endif } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 61b1870ba5a..27916622ed8 100644 +index ca0092f21c1..0a1ce16381c 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -388,7 +388,18 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) +@@ -388,7 +388,16 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) memset( mask_bits, 0, sizeof(mask_bits) ); XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); - XISetMask( mask_bits, XI_ButtonPress ); + -+ if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) ++ if (data->xi2_rawinput_only) + { + XISetMask( mask_bits, XI_RawButtonPress ); + XISetMask( mask_bits, XI_RawButtonRelease ); -+ data->xi2_rawinput_only = TRUE; + } + else + { + XISetMask( mask_bits, XI_ButtonPress ); -+ data->xi2_rawinput_only = FALSE; + } pXISelectEvents( display, DefaultRootWindow( display ), &mask, 1 ); -@@ -625,7 +636,6 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x +@@ -415,6 +424,7 @@ void x11drv_xinput_disable( Display *display, Window window, long event_mask ) + TRACE( "state:%d window:%lx event_mask:%lx\n", xi2_state, window, event_mask ); + + if (xi2_state == xi_unavailable) return; ++ if (data->xi2_rawinput_only) return; + + if (window != DefaultRootWindow( display )) + { +@@ -626,7 +636,6 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input ) { struct x11drv_win_data *data; @@ -85,7 +91,7 @@ index 61b1870ba5a..27916622ed8 100644 input->type = INPUT_MOUSE; -@@ -633,7 +643,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -634,7 +643,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU { struct x11drv_thread_data *thread_data = x11drv_thread_data(); if (!thread_data->clipping_cursor || thread_data->clip_window != window) return; @@ -94,7 +100,7 @@ index 61b1870ba5a..27916622ed8 100644 return; } -@@ -660,7 +670,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -661,7 +670,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU SERVER_END_REQ; } @@ -103,7 +109,7 @@ index 61b1870ba5a..27916622ed8 100644 } #ifdef SONAME_LIBXCURSOR -@@ -1588,7 +1598,6 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1589,7 +1598,6 @@ void move_resize_window( HWND hwnd, int dir ) { MSG msg; INPUT input; @@ -111,7 +117,7 @@ index 61b1870ba5a..27916622ed8 100644 int x, y, rootX, rootY; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; -@@ -1604,7 +1613,7 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1605,7 +1613,7 @@ void move_resize_window( HWND hwnd, int dir ) input.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.mi.time = NtGetTickCount(); input.mi.dwExtraInfo = 0; @@ -120,7 +126,7 @@ index 61b1870ba5a..27916622ed8 100644 } while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) -@@ -1816,6 +1825,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) +@@ -1817,6 +1825,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) */ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { @@ -128,7 +134,7 @@ index 61b1870ba5a..27916622ed8 100644 XIRawEvent *event = xev->data; RAWINPUT rawinput; INPUT input; -@@ -1835,7 +1845,85 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1836,7 +1845,85 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE; @@ -215,7 +221,7 @@ index 61b1870ba5a..27916622ed8 100644 return TRUE; } -@@ -1911,6 +1999,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) +@@ -1912,6 +1999,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) case XI_RawMotion: ret = X11DRV_RawMotion( event ); break; @@ -226,11 +232,26 @@ index 61b1870ba5a..27916622ed8 100644 default: TRACE( "Unhandled event %#x\n", event->evtype ); +diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c +index f043e64047e..bf7afe0e8bf 100644 +--- a/dlls/winex11.drv/window.c ++++ b/dlls/winex11.drv/window.c +@@ -1999,6 +1999,10 @@ BOOL X11DRV_CreateWindow( HWND hwnd ) + struct x11drv_thread_data *data = x11drv_init_thread_data(); + XSetWindowAttributes attr; + ++ /* listen to raw xinput event in the desktop window thread */ ++ data->xi2_rawinput_only = TRUE; ++ x11drv_xinput_enable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); ++ + /* create the cursor clipping window */ + attr.override_redirect = TRUE; + attr.event_mask = StructureNotifyMask | FocusChangeMask; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 5778a7eceb4..36ed7810700 100644 +index 8bbac23f88e..55b3049a7cc 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -408,6 +408,7 @@ struct x11drv_thread_data +@@ -405,6 +405,7 @@ struct x11drv_thread_data XIValuatorClassInfo x_valuator; XIValuatorClassInfo y_valuator; int xi2_core_pointer; /* XInput2 core pointer id */ @@ -238,28 +259,6 @@ index 5778a7eceb4..36ed7810700 100644 #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ }; -diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index fbff380c2b0..b434e03c8fd 100644 ---- a/dlls/winex11.drv/x11drv_main.c -+++ b/dlls/winex11.drv/x11drv_main.c -@@ -725,6 +725,8 @@ void X11DRV_ThreadDetach(void) - if (data) - { - vulkan_thread_detach(); -+ if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) -+ x11drv_xinput_disable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); - if (data->xim) XCloseIM( data->xim ); - if (data->font_set) XFreeFontSet( data->display, data->font_set ); - XCloseDisplay( data->display ); -@@ -793,6 +795,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) - if (use_xim) xim_thread_attach( data ); - - x11drv_xinput_init(); -+ if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) -+ x11drv_xinput_enable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); - - return data; - } -- 2.40.1 diff --git a/patches/user32-rawinput-mouse/0009-winex11-Fixup-virtual-windows-creation.patch b/patches/user32-rawinput-mouse/0009-winex11-Fixup-virtual-windows-creation.patch deleted file mode 100644 index c34269c5..00000000 --- a/patches/user32-rawinput-mouse/0009-winex11-Fixup-virtual-windows-creation.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 6071310090160f128f05b2ea8ef050e35170f037 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Aida=20Jonikien=C4=97?= -Date: Mon, 14 Aug 2023 08:52:55 +1000 -Subject: [PATCH] winex11: Fixup virtual windows creation - ---- - dlls/winex11.drv/window.c | 10 ++++++++-- - dlls/winex11.drv/x11drv_main.c | 2 +- - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c -index 9d3afc8ed13..e008ec1a890 100644 ---- a/dlls/winex11.drv/window.c -+++ b/dlls/winex11.drv/window.c -@@ -1905,6 +1905,7 @@ static BOOL create_desktop_win_data( Window win, HWND hwnd ) - void X11DRV_SetDesktopWindow( HWND hwnd ) - { - unsigned int width, height; -+ Display *display; - - /* retrieve the real size of the desktop */ - SERVER_START_REQ( get_window_rectangles ) -@@ -1943,14 +1944,19 @@ void X11DRV_SetDesktopWindow( HWND hwnd ) - { - ERR( "Failed to create virtual desktop window data\n" ); - root_window = DefaultRootWindow( gdi_display ); -+ return; - } -- else if (is_desktop_fullscreen()) -+ -+ display = x11drv_thread_data()->display; -+ if (is_desktop_fullscreen()) - { -- Display *display = x11drv_thread_data()->display; - TRACE("setting desktop to fullscreen\n"); - XChangeProperty( display, root_window, x11drv_atom(_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, - (unsigned char*)&x11drv_atom(_NET_WM_STATE_FULLSCREEN), 1 ); - } -+ -+ FIXME("Enabling xinput in desktop thread\n"); -+ x11drv_xinput_enable( display, DefaultRootWindow( display ), PointerMotionMask ); - } - else - { -diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 26cf404731b..0dc350b3a1b 100644 ---- a/dlls/winex11.drv/x11drv_main.c -+++ b/dlls/winex11.drv/x11drv_main.c -@@ -881,7 +881,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) - if (use_xim) xim_thread_attach( data ); - - x11drv_xinput_init(); -- if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) -+ if (NtUserGetWindowThread( UlongToHandle( NtUserGetThreadInfo()->top_window ), NULL ) == GetCurrentThreadId()) - x11drv_xinput_enable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); - - return data; --- -2.40.1 -