From eb5a19f4fd9d683056a2c205a63c8ab645e2d888 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 16 Jun 2023 08:55:47 +1000 Subject: [PATCH] Rebase against 272f712b605174e946da1dc65f927a23ee92a572. --- ...ort-XInput2-events-for-individual-wi.patch | 40 +++++++++--------- ...dvertise-XInput2-version-2.1-support.patch | 22 +++++----- ...-track-of-pointer-and-device-button-.patch | 20 ++++----- ...HWMSG_RAWINPUT-flags-only-when-RAWIN.patch | 24 +++++------ ...en-to-RawMotion-and-RawButton-events.patch | 42 +++++++++++-------- ...v-Add-support-for-_NET_ACTIVE_WINDOW.patch | 40 +++++++++--------- staging/upstream-commit | 2 +- 7 files changed, 99 insertions(+), 91 deletions(-) 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 a0a32a6f..d940e022 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 7d60bf3ed45a7ad0d08fa94f3f28c0ca499c8641 Mon Sep 17 00:00:00 2001 +From 2efe896d8b1b48a20a6f33691b0a2d12181124ca 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. @@ -27,7 +27,7 @@ index 8a5682c1acb..6a5770c7671 100644 X11DRV_init_desktop( win, width, height ); diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c -index 2d46d516c69..d56634104e1 100644 +index a7793f0c399..e5021eb38ff 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -235,6 +235,13 @@ static Bool filter_event( Display *display, XEvent *event, char *arg ) @@ -45,10 +45,10 @@ index 2d46d516c69..d56634104e1 100644 case MotionNotify: case EnterNotify: diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 41cb1de8bbb..23b12a81215 100644 +index 25077973f26..fbd463ce85d 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -305,20 +305,32 @@ void x11drv_xinput_init(void) +@@ -281,20 +281,32 @@ void x11drv_xinput_init(void) /*********************************************************************** @@ -86,7 +86,7 @@ index 41cb1de8bbb..23b12a81215 100644 mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); -@@ -328,8 +340,9 @@ static void enable_xinput2(void) +@@ -304,8 +316,9 @@ static void enable_xinput2(void) XISetMask( mask_bits, XI_RawMotion ); XISetMask( mask_bits, XI_ButtonPress ); @@ -97,7 +97,7 @@ index 41cb1de8bbb..23b12a81215 100644 pointer_info = pXIQueryDevice( data->display, data->xi2_core_pointer, &count ); update_relative_valuators( pointer_info->classes, pointer_info->num_classes ); pXIFreeDeviceInfo( pointer_info ); -@@ -338,7 +351,7 @@ static void enable_xinput2(void) +@@ -314,7 +327,7 @@ static void enable_xinput2(void) * no XI_DeviceChanged events happened. If any hierarchy change occurred that * might be relevant here (eg. user switching mice after (un)plugging), a * XI_DeviceChanged event will point us to the right slave. So this list is @@ -106,7 +106,7 @@ index 41cb1de8bbb..23b12a81215 100644 */ if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices ); data->xi2_devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count ); -@@ -350,24 +363,37 @@ static void enable_xinput2(void) +@@ -326,24 +339,37 @@ static void enable_xinput2(void) #endif /*********************************************************************** @@ -150,7 +150,7 @@ index 41cb1de8bbb..23b12a81215 100644 pXIFreeDeviceInfo( data->xi2_devices ); data->x_valuator.number = -1; data->y_valuator.number = -1; -@@ -376,6 +402,7 @@ static void disable_xinput2(void) +@@ -352,6 +378,7 @@ static void disable_xinput2(void) data->xi2_devices = NULL; data->xi2_core_pointer = 0; data->xi2_current_slave = 0; @@ -158,34 +158,34 @@ index 41cb1de8bbb..23b12a81215 100644 #endif } -@@ -420,7 +447,7 @@ static BOOL grab_clipping_window( const RECT *clip ) +@@ -384,7 +411,7 @@ static BOOL grab_clipping_window( const RECT *clip ) } /* enable XInput2 unless we are already clipping */ -- if (!data->clip_hwnd) enable_xinput2(); -+ if (!data->clip_hwnd) x11drv_xinput_enable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); +- if (!data->clipping_cursor) enable_xinput2(); ++ if (!data->clipping_cursor) x11drv_xinput_enable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); if (data->xi2_state != xi_enabled) { -@@ -450,7 +477,7 @@ static BOOL grab_clipping_window( const RECT *clip ) +@@ -424,7 +451,7 @@ static BOOL grab_clipping_window( const RECT *clip ) if (!clipping_cursor) { - disable_xinput2(); + x11drv_xinput_disable( data->display, DefaultRootWindow( data->display ), PointerMotionMask ); - NtUserDestroyWindow( msg_hwnd ); return FALSE; } -@@ -483,7 +510,6 @@ static void ungrab_clipping_window(void) + clip_rect = *clip; +@@ -453,7 +480,6 @@ void ungrab_clipping_window(void) + if (clipping_cursor) XUngrabPointer( data->display, CurrentTime ); clipping_cursor = FALSE; - NtUserDestroyWindow( data->clip_hwnd ); - data->clip_hwnd = 0; + data->clipping_cursor = FALSE; - disable_xinput2(); } /*********************************************************************** diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c -index facf4f88e17..b3e42548f12 100644 +index 177cdc0faa3..e915ef4fe8b 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -362,6 +362,7 @@ static void sync_window_style( struct x11drv_win_data *data ) @@ -204,7 +204,7 @@ index facf4f88e17..b3e42548f12 100644 set_initial_wm_hints( data->display, data->whole_window ); set_wm_hints( data ); -@@ -1982,6 +1984,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd ) +@@ -1980,6 +1982,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd ) data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0, InputOnly, default_visual.visual, CWOverrideRedirect | CWEventMask, &attr ); @@ -213,7 +213,7 @@ index facf4f88e17..b3e42548f12 100644 NtUserSetProp( hwnd, clip_window_prop, (HANDLE)data->clip_window ); X11DRV_DisplayDevices_RegisterEventHandlers(); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 57dc9fdeb3c..c3f58f49b7d 100644 +index 4343a23f4d0..d8f7fa1441b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -264,6 +264,8 @@ extern void X11DRV_ThreadDetach(void) DECLSPEC_HIDDEN; @@ -242,7 +242,7 @@ index 57dc9fdeb3c..c3f58f49b7d 100644 Display *display; @@ -394,7 +404,7 @@ struct x11drv_thread_data Window clip_window; /* window used for cursor clipping */ - HWND clip_hwnd; /* message window stored in desktop while clipping is active */ + BOOL clipping_cursor; /* whether thread is currently clipping the cursor */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H - enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */ + enum xi2_state xi2_state; /* XInput2 state */ 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 1870ad4e..718ae761 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 0df09be29ae67643b6a08986fa88bcee2026cd48 Mon Sep 17 00:00:00 2001 +From d16f519ea4973bfbdb91819c9a63046375ef2a96 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 608142a32e6..2d4453e320a 100644 +index fbd463ce85d..83e19493333 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -285,7 +285,7 @@ void x11drv_xinput_init(void) +@@ -261,7 +261,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 608142a32e6..2d4453e320a 100644 if (data->xi2_state != xi_unknown) return; -@@ -298,7 +298,7 @@ void x11drv_xinput_init(void) +@@ -274,7 +274,7 @@ void x11drv_xinput_init(void) else { data->xi2_state = xi_unavailable; @@ -43,7 +43,7 @@ index 608142a32e6..2d4453e320a 100644 } #endif } -@@ -334,7 +334,7 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) +@@ -310,7 +310,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 608142a32e6..2d4453e320a 100644 memset( mask_bits, 0, sizeof(mask_bits) ); XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); -@@ -347,16 +347,6 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) +@@ -323,16 +323,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 608142a32e6..2d4453e320a 100644 data->xi2_state = xi_enabled; } -@@ -389,19 +379,16 @@ void x11drv_xinput_disable( Display *display, Window window, long event_mask ) +@@ -365,19 +355,16 @@ void x11drv_xinput_disable( Display *display, Window window, long event_mask ) mask.mask = NULL; mask.mask_len = 0; @@ -90,7 +90,7 @@ index 608142a32e6..2d4453e320a 100644 data->xi2_state = xi_disabled; #endif } -@@ -1736,7 +1723,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev ) +@@ -1688,7 +1675,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev ) if (event->reason != XISlaveSwitch) return FALSE; update_relative_valuators( event->classes, event->num_classes ); @@ -98,7 +98,7 @@ index 608142a32e6..2d4453e320a 100644 return TRUE; } -@@ -1752,25 +1738,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) +@@ -1704,25 +1690,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) if (x->number < 0 || y->number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; if (thread_data->xi2_state != xi_enabled) return FALSE; @@ -126,11 +126,11 @@ index 608142a32e6..2d4453e320a 100644 virtual_rect = NtUserGetVirtualScreenRect(); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index c3f58f49b7d..225b1534159 100644 +index d8f7fa1441b..8b401080bc5 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -405,12 +405,9 @@ struct x11drv_thread_data - HWND clip_hwnd; /* message window stored in desktop while clipping is active */ + BOOL clipping_cursor; /* whether thread is currently clipping the cursor */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H enum xi2_state xi2_state; /* XInput2 state */ - void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */ 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 3ba4801e..af90c2e6 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 14edfa85b447be28ec0f47396c6ef03348c89586 Mon Sep 17 00:00:00 2001 +From baca91ec583435db0ab89dbe12791fcb277d1154 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 @@ -51,7 +51,7 @@ index 195cc65eddb..83169a9bb4d 100644 } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 6e7cdb642ff..9158e75b20d 100644 +index 83e19493333..20d57aa76f3 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -30,6 +30,9 @@ @@ -64,7 +64,7 @@ index 6e7cdb642ff..9158e75b20d 100644 #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H #include #endif -@@ -141,6 +144,14 @@ MAKE_FUNCPTR(XISelectEvents); +@@ -138,6 +141,14 @@ MAKE_FUNCPTR(XISelectEvents); #undef MAKE_FUNCPTR #endif @@ -79,7 +79,7 @@ index 6e7cdb642ff..9158e75b20d 100644 /*********************************************************************** * X11DRV_Xcursor_Init * -@@ -228,6 +239,70 @@ void set_window_cursor( Window window, HCURSOR handle ) +@@ -225,6 +236,70 @@ void set_window_cursor( Window window, HCURSOR handle ) XFlush( gdi_display ); } @@ -150,7 +150,7 @@ index 6e7cdb642ff..9158e75b20d 100644 #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H /*********************************************************************** * update_relative_valuators -@@ -1699,6 +1774,8 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev ) +@@ -1675,6 +1750,8 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev ) if (event->reason != XISlaveSwitch) return FALSE; update_relative_valuators( event->classes, event->num_classes ); @@ -159,7 +159,7 @@ index 6e7cdb642ff..9158e75b20d 100644 return TRUE; } -@@ -1786,13 +1863,12 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1762,13 +1839,12 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ @@ -174,7 +174,7 @@ index 6e7cdb642ff..9158e75b20d 100644 int event, error; void *libxi_handle = dlopen( SONAME_LIBXI, RTLD_NOW ); -@@ -1808,11 +1884,20 @@ void x11drv_xinput_load(void) +@@ -1784,11 +1860,20 @@ void x11drv_xinput_load(void) return; \ } @@ -196,11 +196,11 @@ index 6e7cdb642ff..9158e75b20d 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 f84b1c20752..d3f74c63df0 100644 +index 8b401080bc5..d147add9d68 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -693,6 +693,7 @@ extern void set_window_cursor( Window window, HCURSOR handle ) DECLSPEC_HIDDEN; - extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN; +@@ -695,6 +695,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; +extern void X11DRV_InitMouse( Display *display ) DECLSPEC_HIDDEN; 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 102d0036..e45fccde 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 0ecc6d7db43e68d9d8d6a9ce2db7e664af8eecd7 Mon Sep 17 00:00:00 2001 +From 89e3ab4eceaa473697590e2264b0a1d7ccd149f4 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 @@ -176,10 +176,10 @@ index 83169a9bb4d..ecd513ee2a4 100644 diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 9158e75b20d..f745054ca64 100644 +index 20d57aa76f3..7925a2f4070 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -647,6 +647,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,16 +187,16 @@ index 9158e75b20d..f745054ca64 100644 input->type = INPUT_MOUSE; -@@ -657,7 +658,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU - - if (!clip_hwnd) return; - if (thread_data->clip_window != window) return; +@@ -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; - __wine_send_input( hwnd, input, NULL ); + __wine_send_input( hwnd, input, &rawinput ); return; } -@@ -684,7 +685,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 9158e75b20d..f745054ca64 100644 } #ifdef SONAME_LIBXCURSOR -@@ -1612,6 +1613,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 9158e75b20d..f745054ca64 100644 int x, y, rootX, rootY; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; -@@ -1627,7 +1629,7 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1603,7 +1605,7 @@ void move_resize_window( HWND hwnd, int dir ) input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.u.mi.time = NtGetTickCount(); input.u.mi.dwExtraInfo = 0; @@ -222,7 +222,7 @@ index 9158e75b20d..f745054ca64 100644 } while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) -@@ -1840,6 +1842,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 9158e75b20d..f745054ca64 100644 INPUT input; if (broken_rawevents && is_old_motion_event( xev->serial )) -@@ -1857,7 +1860,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1833,7 +1836,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE; 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 865f1dc0..b5699f32 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 8a0662e0e65a8e9ebf0cf3e3123bc8cac071251d Mon Sep 17 00:00:00 2001 +From 8cfe8a261f9138c6227610fd0c9bc222bc0b1871 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 @@ -9,13 +9,13 @@ 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 | 105 +++++++++++++++++++++++++++++++-- + dlls/winex11.drv/mouse.c | 106 ++++++++++++++++++++++++++++++--- dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 4 ++ - 4 files changed, 112 insertions(+), 8 deletions(-) + 4 files changed, 112 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c -index d56634104e1..6193717e82f 100644 +index e5021eb38ff..9cf7969dce2 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,10 +54,10 @@ index d56634104e1..6193717e82f 100644 #endif } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index f745054ca64..81c474d6605 100644 +index 7925a2f4070..fce58d2b48a 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -392,7 +392,18 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask ) +@@ -389,7 +389,18 @@ 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 ); @@ -77,16 +77,24 @@ index f745054ca64..81c474d6605 100644 pXISelectEvents( display, DefaultRootWindow( display ), &mask, 1 ); -@@ -658,7 +669,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -626,7 +637,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; +- RAWINPUT rawinput; - if (!clip_hwnd) return; - if (thread_data->clip_window != window) return; + input->type = INPUT_MOUSE; + +@@ -634,7 +644,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; - __wine_send_input( hwnd, input, &rawinput ); -+ __wine_send_input( hwnd, input, NULL ); ++ __wine_send_input( hwnd, input, NULL ); return; } -@@ -685,7 +696,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -661,7 +671,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU SERVER_END_REQ; } @@ -95,7 +103,7 @@ index f745054ca64..81c474d6605 100644 } #ifdef SONAME_LIBXCURSOR -@@ -1613,7 +1624,6 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1589,7 +1599,6 @@ void move_resize_window( HWND hwnd, int dir ) { MSG msg; INPUT input; @@ -103,7 +111,7 @@ index f745054ca64..81c474d6605 100644 int x, y, rootX, rootY; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; -@@ -1629,7 +1639,7 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1605,7 +1614,7 @@ void move_resize_window( HWND hwnd, int dir ) input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.u.mi.time = NtGetTickCount(); input.u.mi.dwExtraInfo = 0; @@ -112,7 +120,7 @@ index f745054ca64..81c474d6605 100644 } while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) -@@ -1841,6 +1851,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) +@@ -1817,6 +1826,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) */ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { @@ -120,7 +128,7 @@ index f745054ca64..81c474d6605 100644 XIRawEvent *event = xev->data; RAWINPUT rawinput; INPUT input; -@@ -1860,7 +1871,85 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1836,7 +1846,85 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE; @@ -207,7 +215,7 @@ index f745054ca64..81c474d6605 100644 return TRUE; } -@@ -1936,6 +2025,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) +@@ -1912,6 +2000,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) case XI_RawMotion: ret = X11DRV_RawMotion( event ); break; @@ -219,7 +227,7 @@ index f745054ca64..81c474d6605 100644 default: TRACE( "Unhandled event %#x\n", event->evtype ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index d3f74c63df0..a072b01fc7e 100644 +index d147add9d68..30486210df5 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -408,6 +408,7 @@ struct x11drv_thread_data diff --git a/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch b/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch index 319b7f39..6d96ea0c 100644 --- a/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch +++ b/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch @@ -1,4 +1,4 @@ -From b7fbd9046a0478532bad38ff443cf2631c8d821c Mon Sep 17 00:00:00 2001 +From 2dedad4a62b8d8b829a690d0d00a5405b4dd2ea1 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 10 Feb 2016 15:09:29 +0800 Subject: [PATCH] winex11.drv: Add support for _NET_ACTIVE_WINDOW. (v2) @@ -18,10 +18,10 @@ For bug #2155. 8 files changed, 67 insertions(+) diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c -index 7a2e4c3bcdd..06d856f2eb6 100644 +index ed2e0973d39..79c4714f15a 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c -@@ -838,6 +838,10 @@ static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) +@@ -837,6 +837,10 @@ static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) hdc, rect.left - dx, rect.top - dy, SRCCOPY, 0, 0 ); } @@ -32,7 +32,7 @@ index 7a2e4c3bcdd..06d856f2eb6 100644 static void nulldrv_SetCapture( HWND hwnd, UINT flags ) { } -@@ -1241,6 +1245,7 @@ static const struct user_driver_funcs lazy_load_driver = +@@ -1240,6 +1244,7 @@ static const struct user_driver_funcs lazy_load_driver = nulldrv_ProcessEvents, nulldrv_ReleaseDC, nulldrv_ScrollDC, @@ -40,7 +40,7 @@ index 7a2e4c3bcdd..06d856f2eb6 100644 nulldrv_SetCapture, loaderdrv_SetDesktopWindow, nulldrv_SetFocus, -@@ -1320,6 +1325,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version +@@ -1319,6 +1324,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version SET_USER_FUNC(ProcessEvents); SET_USER_FUNC(ReleaseDC); SET_USER_FUNC(ScrollDC); @@ -49,10 +49,10 @@ index 7a2e4c3bcdd..06d856f2eb6 100644 SET_USER_FUNC(SetDesktopWindow); SET_USER_FUNC(SetFocus); diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c -index 15dd41182b9..313b798d78e 100644 +index b286298bf73..5acb17db7ea 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c -@@ -1887,6 +1887,8 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) +@@ -1889,6 +1889,8 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) NtUserPostMessage( get_desktop_window(), WM_PARENTNOTIFY, WM_NCACTIVATE, (LPARAM)hwnd ); } @@ -62,7 +62,7 @@ index 15dd41182b9..313b798d78e 100644 if (focus) { diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c -index 701d0c1faf6..b33fd6e0390 100644 +index c3c8d9a4070..a7793f0c399 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -576,6 +576,9 @@ static void set_focus( Display *display, HWND hwnd, Time time ) @@ -75,9 +75,9 @@ index 701d0c1faf6..b33fd6e0390 100644 TRACE( "setting foreground window to %p\n", hwnd ); NtUserSetForegroundWindow( hwnd ); -@@ -833,6 +836,8 @@ static void focus_out( Display *display , HWND hwnd ) +@@ -818,6 +821,8 @@ static void focus_out( Display *display , HWND hwnd ) - if (!focus_win) + if (!is_current_process_focused()) { + x11drv_thread_data()->active_window = 0; + @@ -85,10 +85,10 @@ index 701d0c1faf6..b33fd6e0390 100644 Foreground window, because in most cases the messages sent above must have already changed the foreground window, in which diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c -index 1f1b6fcf7e1..b28529f6669 100644 +index 813532eff53..fe40582dc89 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c -@@ -421,6 +421,7 @@ static const struct user_driver_funcs x11drv_funcs = +@@ -420,6 +420,7 @@ static const struct user_driver_funcs x11drv_funcs = .pProcessEvents = X11DRV_ProcessEvents, .pReleaseDC = X11DRV_ReleaseDC, .pScrollDC = X11DRV_ScrollDC, @@ -97,10 +97,10 @@ index 1f1b6fcf7e1..b28529f6669 100644 .pSetDesktopWindow = X11DRV_SetDesktopWindow, .pSetFocus = X11DRV_SetFocus, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c -index 4fa4fb59c90..63827aa1aa6 100644 +index 974bd376fe6..177cdc0faa3 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c -@@ -2431,6 +2431,54 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) +@@ -2429,6 +2429,54 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) } @@ -156,7 +156,7 @@ index 4fa4fb59c90..63827aa1aa6 100644 * SetCapture (X11DRV.@) */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 2ebed5cbd52..ea3323cabce 100644 +index 4350f894aca..27ad4d9d19b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -231,6 +231,7 @@ extern void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect, @@ -175,7 +175,7 @@ index 2ebed5cbd52..ea3323cabce 100644 HWND last_focus; /* last window that had focus */ XIM xim; /* input method */ HWND last_xic_hwnd; /* last xic window */ -@@ -488,6 +490,7 @@ enum x11drv_atoms +@@ -486,6 +488,7 @@ enum x11drv_atoms XATOM__ICC_PROFILE, XATOM__KDE_NET_WM_STATE_SKIP_SWITCHER, XATOM__MOTIF_WM_HINTS, @@ -184,10 +184,10 @@ index 2ebed5cbd52..ea3323cabce 100644 XATOM__NET_STARTUP_INFO, XATOM__NET_SUPPORTED, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 5b79e6ce7c7..c16f38286a6 100644 +index c4d537d6ada..9c56d7df56a 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c -@@ -154,6 +154,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = +@@ -153,6 +153,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "_ICC_PROFILE", "_KDE_NET_WM_STATE_SKIP_SWITCHER", "_MOTIF_WM_HINTS", @@ -196,10 +196,10 @@ index 5b79e6ce7c7..c16f38286a6 100644 "_NET_STARTUP_INFO", "_NET_SUPPORTED", diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h -index 8561d0fc52b..cb0a8b1a957 100644 +index c4e859f21e5..24df7ea0b25 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h -@@ -316,6 +316,7 @@ struct user_driver_funcs +@@ -320,6 +320,7 @@ struct user_driver_funcs BOOL (*pProcessEvents)(DWORD); void (*pReleaseDC)(HWND,HDC); BOOL (*pScrollDC)(HDC,INT,INT,HRGN); diff --git a/staging/upstream-commit b/staging/upstream-commit index 50315429..48a112ce 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -766448f8ffe51b83105bd0795a5cbc7b8f7c8894 +272f712b605174e946da1dc65f927a23ee92a572