Updated user32-rawinput-mouse patchset

https://bugs.winehq.org/show_bug.cgi?id=56410
https://bugs.winehq.org/show_bug.cgi?id=56413
This commit is contained in:
Alistair Leslie-Hughes 2024-03-10 07:36:54 +11:00
parent eb8cc143d6
commit 50bad5b9af
2 changed files with 44 additions and 25 deletions

View File

@ -1,18 +1,37 @@
From 25e8368ac3671ab0407e66bac00c19106296d474 Mon Sep 17 00:00:00 2001
From d3a25a9ead93caf3d25ad34591683675b3d1ae0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 8 Mar 2024 11:15:57 +0100
Subject: [PATCH 3/7] winex11: Add support for absolute position in RawMotion
Subject: [PATCH] winex11: Add support for absolute position in RawMotion
events.
---
dlls/winex11.drv/mouse.c | 36 ++++++++++++++++++++++++++++++------
1 file changed, 30 insertions(+), 6 deletions(-)
dlls/winex11.drv/mouse.c | 41 ++++++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 45619d4970d..87007b837bd 100644
index 45619d4970d..d3c97468fdb 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -240,12 +240,18 @@ static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes
@@ -30,6 +30,7 @@
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include <stdarg.h>
+#include <stdint.h>
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
#include <X11/extensions/XInput2.h>
#endif
@@ -66,6 +67,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(cursor);
#define Button7Mask (1<<14)
#endif
+#ifndef UINT16_MAX
+# define UINT16_MAX (65535)
+#endif
+
#define NB_BUTTONS 9 /* Windows can handle 5 buttons and the wheel too */
static const UINT button_down_flags[NB_BUTTONS] =
@@ -240,12 +245,18 @@ static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes
{
valuator = (XIValuatorClassInfo *)classes[num_classes];
if (classes[num_classes]->type != XIValuatorClass) continue;
@ -33,7 +52,7 @@ index 45619d4970d..87007b837bd 100644
thread_data->x_valuator.value = 0;
thread_data->y_valuator.value = 0;
@@ -1670,6 +1676,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
@@ -1670,6 +1681,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
XIValuatorClassInfo *x = &thread_data->x_valuator, *y = &thread_data->y_valuator;
@ -41,7 +60,7 @@ index 45619d4970d..87007b837bd 100644
double x_value = 0, y_value = 0, x_scale, y_scale;
const double *values = event->valuators.values;
RECT virtual_rect;
@@ -1680,7 +1687,15 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
@@ -1680,7 +1692,15 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
if (!xinput2_available) return FALSE;
if (event->deviceid != thread_data->xinput2_pointer) return FALSE;
@ -58,7 +77,7 @@ index 45619d4970d..87007b837bd 100644
if (x->max <= x->min) x_scale = 1;
else x_scale = (virtual_rect.right - virtual_rect.left) / (x->max - x->min);
@@ -1693,17 +1708,26 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
@@ -1693,17 +1713,26 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
if (i == x->number)
{
x_value = *values;

View File

@ -1,7 +1,7 @@
From f1a3f71d4de4721ec1760236215a213088961594 Mon Sep 17 00:00:00 2001
From c984dc72cccf9ca667bad9b1c334204fb45ad851 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 5/7] winex11: Keep track of mouse device and pointer button
Subject: [PATCH] winex11: Keep track of mouse device and pointer button
mappings.
We are going to receive raw button events and we will need to apply the
@ -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 2b16df17bb8..93f6d57e686 100644
index 0b8d37fa21b..425a20d73c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1201,6 +1201,7 @@ then
@@ -1203,6 +1203,7 @@ then
dnl *** All of the following tests require X11/Xlib.h
AC_CHECK_HEADERS([X11/extensions/shape.h \
@ -71,20 +71,20 @@ index 23f07b851a7..130b7e516a2 100644
/***********************************************************************
* VkKeyScanEx (X11DRV.@)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 87007b837bd..f10d3cfb2d6 100644
index d3c97468fdb..5a5ec51e370 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -30,6 +30,9 @@
#include <X11/Xlib.h>
@@ -31,6 +31,9 @@
#include <X11/cursorfont.h>
#include <stdarg.h>
#include <stdint.h>
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+#include <X11/extensions/XInput.h>
+#endif
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
#include <X11/extensions/XInput2.h>
#endif
@@ -137,6 +140,14 @@ MAKE_FUNCPTR(XISelectEvents);
@@ -142,6 +145,14 @@ MAKE_FUNCPTR(XISelectEvents);
#undef MAKE_FUNCPTR
#endif
@ -99,7 +99,7 @@ index 87007b837bd..f10d3cfb2d6 100644
/***********************************************************************
* X11DRV_Xcursor_Init
*
@@ -224,6 +235,75 @@ void set_window_cursor( Window window, HCURSOR handle )
@@ -229,6 +240,75 @@ void set_window_cursor( Window window, HCURSOR handle )
XFlush( gdi_display );
}
@ -175,7 +175,7 @@ index 87007b837bd..f10d3cfb2d6 100644
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
/***********************************************************************
* update_relative_valuators
@@ -1669,6 +1749,8 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
@@ -1674,6 +1754,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 87007b837bd..f10d3cfb2d6 100644
return TRUE;
}
@@ -1817,7 +1899,7 @@ static BOOL X11DRV_TouchEvent( HWND hwnd, XGenericEventCookie *xev )
@@ -1822,7 +1904,7 @@ static BOOL X11DRV_TouchEvent( HWND hwnd, XGenericEventCookie *xev )
*/
void x11drv_xinput2_load(void)
{
@ -193,7 +193,7 @@ index 87007b837bd..f10d3cfb2d6 100644
int event, error;
void *libxi_handle = dlopen( SONAME_LIBXI, RTLD_NOW );
@@ -1833,11 +1915,20 @@ void x11drv_xinput2_load(void)
@@ -1838,11 +1920,20 @@ void x11drv_xinput2_load(void)
return; \
}
@ -215,10 +215,10 @@ index 87007b837bd..f10d3cfb2d6 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 2f46522f59f..655c6847b92 100644
index 2f5721d2b8b..05ae23dcfdb 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -684,6 +684,7 @@ extern void retry_grab_clipping_window(void);
@@ -688,6 +688,7 @@ extern void retry_grab_clipping_window(void);
extern void ungrab_clipping_window(void);
extern void move_resize_window( HWND hwnd, int dir );
extern void X11DRV_InitKeyboard( Display *display );
@ -227,10 +227,10 @@ index 2f46522f59f..655c6847b92 100644
extern HWND *build_hwnd_list(void);
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 0925fe54b9c..4b4d5563b60 100644
index 19419644940..32f23e64378 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -699,6 +699,7 @@ static NTSTATUS x11drv_init( void *arg )
@@ -700,6 +700,7 @@ static NTSTATUS x11drv_init( void *arg )
XkbUseExtension( gdi_display, NULL, NULL );
X11DRV_InitKeyboard( gdi_display );