wine-staging/patches/user32-rawinput-mouse/0007-winex11-Send-relative-RawMotion-events-position-unpr.patch

92 lines
3.8 KiB
Diff
Raw Permalink Normal View History

From 63298efb1ad8f04f38f7e1bc518bec7786192d26 Mon Sep 17 00:00:00 2001
2021-10-28 01:37:27 -07:00
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 8 Mar 2024 11:11:27 +0100
Subject: [PATCH 7/7] winex11: Send relative RawMotion events position
unprocessed.
2021-10-28 01:37:27 -07:00
This makes relative raw input independent from cursor speed, as it is
the case on Windows. Absolute raw input is already translated to
virtual desktop space, and cursor speed is meaningless in this case.
This does not support mixed relative/absolute X/Y axis.
---
dlls/winex11.drv/mouse.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
2021-10-28 01:37:27 -07:00
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 6557331df22..d26ed5d794b 100644
2021-10-28 01:37:27 -07:00
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -1763,13 +1763,13 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
return TRUE;
2021-10-28 01:37:27 -07:00
}
-static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
+static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input, BOOL send_raw )
2021-10-28 01:37:27 -07:00
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
XIValuatorClassInfo *x = &thread_data->x_valuator, *y = &thread_data->y_valuator;
+ const double *values = event->valuators.values, *raw_values = event->raw_values;
const UINT absolute_flags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
2021-10-28 01:37:27 -07:00
- double x_value = 0, y_value = 0, x_scale, y_scale;
- const double *values = event->valuators.values;
+ double x_raw = 0, y_raw = 0, x_value = 0, y_value = 0, x_scale, y_scale;
RECT virtual_rect;
int i;
@@ -1798,16 +1798,19 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
2021-10-28 01:37:27 -07:00
if (!XIMaskIsSet( event->valuators.mask, i )) continue;
if (i == x->number)
{
+ x_raw = *raw_values;
x_value = *values;
if (x->mode == XIModeRelative) x->value += x_value * x_scale;
else x->value = (x_value - x->min) * x_scale;
}
if (i == y->number)
{
+ y_raw = *raw_values;
y_value = *values;
if (y->mode == XIModeRelative) y->value += y_value * y_scale;
else y->value = (y_value - y->min) * y_scale;
}
+ raw_values++;
values++;
}
@@ -1818,6 +1821,13 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
TRACE( "event %f,%f value %f,%f absolute input %d,%d\n", x_value, y_value, x->value, y->value,
(int)input->mi.dx, (int)input->mi.dy );
}
+ else if (send_raw)
+ {
+ input->mi.dx = round( x_raw );
+ input->mi.dy = round( y_raw );
+ TRACE( "event %f,%f raw value %f,%f, raw input %d,%d\n", x_value, y_value, x_raw, y_raw,
+ (int)input->mi.dx, (int)input->mi.dy );
+ }
else if (!(input->mi.dx = round( x->value )) && !(input->mi.dy = round( y->value )))
{
TRACE( "event %f,%f value %f,%f, accumulating motion\n", x_value, y_value, x->value, y->value );
@@ -1857,7 +1867,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
input.mi.dwExtraInfo = 0;
input.mi.dx = 0;
input.mi.dy = 0;
2021-10-28 01:37:27 -07:00
- if (!map_raw_event_coords( event, &input )) return FALSE;
+ if (!map_raw_event_coords( event, &input, flags & SEND_HWMSG_NO_MSG )) return FALSE;
if (!(input.mi.dwFlags & MOUSEEVENTF_MOVE)) return FALSE;
2021-10-28 01:37:27 -07:00
NtUserSendHardwareInput( 0, flags, &input, 0 );
@@ -1906,7 +1916,7 @@ static BOOL X11DRV_RawButtonEvent( XGenericEventCookie *cookie )
input.mi.dwExtraInfo = 0;
input.mi.dx = 0;
input.mi.dy = 0;
- map_raw_event_coords( event, &input );
+ map_raw_event_coords( event, &input, TRUE );
2021-10-28 01:37:27 -07:00
NtUserSendHardwareInput( 0, SEND_HWMSG_NO_MSG, &input, 0 );
return TRUE;
2021-10-28 01:37:27 -07:00
--
2.43.0
2021-10-28 01:37:27 -07:00