Rebase against cf6bdfd2260b4e2a29e72a241ad60f6f39712fa3.

This commit is contained in:
Alistair Leslie-Hughes
2025-03-29 15:44:58 +11:00
parent d88d44f1d9
commit c103bbb0b6
12 changed files with 80 additions and 321 deletions

View File

@@ -1,4 +1,4 @@
From 14dc22e926e64a1ab824278ba245caabe7e1449b Mon Sep 17 00:00:00 2001
From fbd5deecb137fa6ef4b0161266d3fb4b157ad069 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 19 Dec 2019 22:34:44 +0100
Subject: [PATCH] winex11: Keep track of mouse device and pointer button
@@ -17,10 +17,10 @@ Original patch by Andrew Eikum <aeikum@codeweavers.com>.
5 files changed, 114 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 51b453b9af4..7dcc220aecb 100644
index 1923499cf9c..3c4b09d61fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1209,6 +1209,7 @@ then
@@ -1231,6 +1231,7 @@ then
dnl *** All of the following tests require X11/Xlib.h
AC_CHECK_HEADERS([X11/extensions/shape.h \
@@ -29,10 +29,10 @@ index 51b453b9af4..7dcc220aecb 100644
X11/extensions/XShm.h \
X11/extensions/Xfixes.h \
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index 7b7371ed696..fdca9d67e0b 100644
index 8a5ef62f57d..24188e25d98 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -1820,11 +1820,7 @@ BOOL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags)
@@ -1825,11 +1825,7 @@ BOOL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags)
return TRUE;
}
@@ -45,7 +45,7 @@ index 7b7371ed696..fdca9d67e0b 100644
{
HWND hwnd;
@@ -1838,6 +1834,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
@@ -1843,6 +1839,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
return TRUE;
}
@@ -71,7 +71,7 @@ index 7b7371ed696..fdca9d67e0b 100644
/***********************************************************************
* VkKeyScanEx (X11DRV.@)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 501a8e5ebc2..ad8b86c1e61 100644
index cbf5835b75c..59a9835e9b4 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -31,6 +31,9 @@
@@ -175,7 +175,7 @@ index 501a8e5ebc2..ad8b86c1e61 100644
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
/***********************************************************************
* update_relative_valuators
@@ -1664,6 +1744,8 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
@@ -1670,6 +1750,8 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
if (event->deviceid != data->xinput2_pointer) return FALSE;
update_relative_valuators( event->classes, event->num_classes );
@@ -184,7 +184,7 @@ index 501a8e5ebc2..ad8b86c1e61 100644
return TRUE;
}
@@ -1812,7 +1894,7 @@ static BOOL X11DRV_TouchEvent( HWND hwnd, XGenericEventCookie *xev )
@@ -1818,7 +1900,7 @@ static BOOL X11DRV_TouchEvent( HWND hwnd, XGenericEventCookie *xev )
*/
void x11drv_xinput2_load(void)
{
@@ -193,7 +193,7 @@ index 501a8e5ebc2..ad8b86c1e61 100644
int event, error;
void *libxi_handle = dlopen( SONAME_LIBXI, RTLD_NOW );
@@ -1828,11 +1910,20 @@ void x11drv_xinput2_load(void)
@@ -1834,11 +1916,20 @@ void x11drv_xinput2_load(void)
return; \
}
@@ -215,22 +215,22 @@ index 501a8e5ebc2..ad8b86c1e61 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 625e37eecc5..fbc7efc4ffa 100644
index 75dd3c1711a..f48c3782e53 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -701,6 +701,7 @@ extern void reapply_cursor_clipping(void);
@@ -719,6 +719,7 @@ extern void reapply_cursor_clipping(void);
extern void ungrab_clipping_window(void);
extern void move_resize_window( HWND hwnd, int dir, POINT pos );
extern void X11DRV_InitKeyboard( Display *display );
+extern void X11DRV_InitMouse( Display *display );
extern BOOL X11DRV_ProcessEvents( DWORD mask );
extern HWND *build_hwnd_list(void);
typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void *arg );
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 7f05acccea6..40157645c53 100644
index e27202eb2bf..629c8fc172c 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -672,6 +672,7 @@ static NTSTATUS x11drv_init( void *arg )
@@ -669,6 +669,7 @@ static NTSTATUS x11drv_init( void *arg )
XkbUseExtension( gdi_display, NULL, NULL );
X11DRV_InitKeyboard( gdi_display );
@@ -239,5 +239,5 @@ index 7f05acccea6..40157645c53 100644
init_user_driver();
--
2.45.2
2.47.2

View File

@@ -1,8 +1,8 @@
From 1c3132e5307aead682883f5f7613d5811d38b53a Mon Sep 17 00:00:00 2001
From 55847e702591ebe10754ab4789ebc48c7c036181 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 25 Oct 2021 11:45:47 +0200
Subject: [PATCH 6/7] winex11: Listen to Raw(Motion|Button) events in the
desktop thread.
Subject: [PATCH] winex11: Listen to Raw(Motion|Button) events in the desktop
thread.
We still need to send "normal" input from the clipping window thread
to trigger low-level hooks callbacks when clipping cursor. This is for
@@ -15,10 +15,10 @@ instance used in our dinput implementation.
4 files changed, 81 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 8b02361aaff..f4e290f8b8f 100644
index a9e9f25b422..da0e2362d10 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -315,6 +315,10 @@ static enum event_merge_action merge_raw_motion_events( XIRawEvent *prev, XIRawE
@@ -378,6 +378,10 @@ static enum event_merge_action merge_raw_motion_events( XIRawEvent *prev, XIRawE
*/
static enum event_merge_action merge_events( XEvent *prev, XEvent *next )
{
@@ -29,7 +29,7 @@ index 8b02361aaff..f4e290f8b8f 100644
switch (prev->type)
{
case ConfigureNotify:
@@ -346,19 +350,21 @@ static enum event_merge_action merge_events( XEvent *prev, XEvent *next )
@@ -409,19 +413,21 @@ static enum event_merge_action merge_events( XEvent *prev, XEvent *next )
case GenericEvent:
if (next->xcookie.extension != xinput2_opcode) break;
if (next->xcookie.evtype != XI_RawMotion) break;
@@ -54,10 +54,10 @@ index 8b02361aaff..f4e290f8b8f 100644
#endif
}
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index f10d3cfb2d6..6557331df22 100644
index 59a9835e9b4..9107ecaaadc 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -343,6 +343,7 @@ static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes
@@ -348,6 +348,7 @@ static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes
*/
void x11drv_xinput2_enable( Display *display, Window window )
{
@@ -65,7 +65,7 @@ index f10d3cfb2d6..6557331df22 100644
XIEventMask mask;
unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)];
@@ -357,7 +358,13 @@ void x11drv_xinput2_enable( Display *display, Window window )
@@ -362,7 +363,13 @@ void x11drv_xinput2_enable( Display *display, Window window )
{
XISetMask( mask_bits, XI_DeviceChanged );
XISetMask( mask_bits, XI_RawMotion );
@@ -80,7 +80,7 @@ index f10d3cfb2d6..6557331df22 100644
}
else
{
@@ -375,10 +382,12 @@ void x11drv_xinput2_enable( Display *display, Window window )
@@ -380,10 +387,12 @@ void x11drv_xinput2_enable( Display *display, Window window )
*/
void x11drv_xinput2_disable( Display *display, Window window )
{
@@ -93,7 +93,7 @@ index f10d3cfb2d6..6557331df22 100644
mask.mask = mask_bits;
mask.mask_len = sizeof(mask_bits);
@@ -632,7 +641,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;
@@ -102,7 +102,7 @@ index f10d3cfb2d6..6557331df22 100644
return;
}
@@ -659,7 +668,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
@@ -658,7 +667,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
SERVER_END_REQ;
}
@@ -111,7 +111,7 @@ index f10d3cfb2d6..6557331df22 100644
}
#ifdef SONAME_LIBXCURSOR
@@ -1602,7 +1611,7 @@ void move_resize_window( HWND hwnd, int dir )
@@ -1597,7 +1606,7 @@ void move_resize_window( HWND hwnd, int dir, POINT pos )
input.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.mi.time = NtGetTickCount();
input.mi.dwExtraInfo = 0;
@@ -120,7 +120,7 @@ index f10d3cfb2d6..6557331df22 100644
}
while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
@@ -1830,6 +1839,8 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
@@ -1831,6 +1840,8 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
*/
static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
{
@@ -129,7 +129,7 @@ index f10d3cfb2d6..6557331df22 100644
XIRawEvent *event = xev->data;
INPUT input;
@@ -1849,7 +1860,55 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
@@ -1850,7 +1861,55 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
if (!map_raw_event_coords( event, &input )) return FALSE;
if (!(input.mi.dwFlags & MOUSEEVENTF_MOVE)) return FALSE;
@@ -186,7 +186,7 @@ index f10d3cfb2d6..6557331df22 100644
return TRUE;
}
@@ -1964,6 +2023,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
@@ -1965,6 +2024,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
case XI_RawMotion:
ret = X11DRV_RawMotion( event );
break;
@@ -198,10 +198,10 @@ index f10d3cfb2d6..6557331df22 100644
case XI_TouchBegin:
case XI_TouchUpdate:
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index cbe4fc197d1..03ad33060ae 100644
index 51b64e8e83c..813480e7e95 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2040,6 +2040,10 @@ BOOL X11DRV_CreateWindow( HWND hwnd )
@@ -2446,6 +2446,10 @@ BOOL X11DRV_CreateWindow( HWND hwnd )
struct x11drv_thread_data *data = x11drv_init_thread_data();
XSetWindowAttributes attr;
@@ -213,17 +213,17 @@ index cbe4fc197d1..03ad33060ae 100644
attr.override_redirect = TRUE;
attr.event_mask = StructureNotifyMask | FocusChangeMask;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 655c6847b92..37bd1d9d91c 100644
index f48c3782e53..5786d0152af 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -395,6 +395,7 @@ struct x11drv_thread_data
@@ -407,6 +407,7 @@ struct x11drv_thread_data
XIValuatorClassInfo x_valuator;
XIValuatorClassInfo y_valuator;
int xinput2_pointer; /* XInput2 master pointer device id */
+ int xinput2_rawinput; /* XInput2 rawinput-only thread */
#endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */
};
struct display_state desired_state; /* display state tracking the desired / win32 state */
--
2.43.0
2.47.2