wine-staging/patches/user32-rawinput-mouse-experimental/0006-winex11.drv-Send-relative-RawMotion-events-unprocess.patch

99 lines
3.7 KiB
Diff
Raw Normal View History

From 7e0df0539b242a4a87b8189232eefb3164fe4617 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: Mon, 25 Oct 2021 11:48:00 +0200
Subject: [PATCH] winex11.drv: Send relative RawMotion events 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 | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
2021-10-28 01:37:27 -07:00
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index e691f75465d..d6890a384e3 100644
2021-10-28 01:37:27 -07:00
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -1972,12 +1972,12 @@ 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, RAWINPUT *rawinput )
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
XIValuatorClassInfo *x = &thread_data->x_valuator, *y = &thread_data->y_valuator;
- double x_value = 0, y_value = 0, x_scale, y_scale;
- const double *values = event->valuators.values;
+ const double *values = event->valuators.values, *raw_values = event->raw_values;
+ double x_raw = 0, y_raw = 0, x_value = 0, y_value = 0, x_scale, y_scale;
RECT virtual_rect;
int i;
@@ -2006,34 +2006,36 @@ 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++;
}
input->u.mi.dx = round( x->value );
input->u.mi.dy = round( y->value );
+ if (x->mode != XIModeAbsolute) rawinput->data.mouse.lLastX = x_raw;
+ else rawinput->data.mouse.lLastX = input->u.mi.dx;
+ if (y->mode != XIModeAbsolute) rawinput->data.mouse.lLastY = y_raw;
+ else rawinput->data.mouse.lLastY = input->u.mi.dy;
+
TRACE( "event %f,%f value %f,%f input %d,%d\n", x_value, y_value, x->value, y->value,
(int)input->u.mi.dx, (int)input->u.mi.dy );
2021-10-28 01:37:27 -07:00
x->value -= input->u.mi.dx;
y->value -= input->u.mi.dy;
- if (!(input->u.mi.dwFlags & MOUSEEVENTF_ABSOLUTE) && !input->u.mi.dx && !input->u.mi.dy)
- {
- TRACE( "accumulating motion\n" );
- return FALSE;
- }
-
return TRUE;
}
@@ -2060,7 +2062,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
2021-10-28 01:37:27 -07:00
input.u.mi.dwExtraInfo = 0;
input.u.mi.dx = 0;
input.u.mi.dy = 0;
- if (!map_raw_event_coords( event, &input )) return FALSE;
+ if (!map_raw_event_coords( event, &input, &rawinput )) return FALSE;
if (!thread_data->xi2_rawinput_only)
__wine_send_input( 0, &input, NULL );
@@ -2074,8 +2076,6 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
2021-10-28 01:37:27 -07:00
rawinput.data.mouse.ulRawButtons = 0;
rawinput.data.mouse.u.usButtonData = 0;
rawinput.data.mouse.u.usButtonFlags = 0;
- rawinput.data.mouse.lLastX = input.u.mi.dx;
- rawinput.data.mouse.lLastY = input.u.mi.dy;
rawinput.data.mouse.ulExtraInformation = 0;
input.type = INPUT_HARDWARE;
--
2.38.1
2021-10-28 01:37:27 -07:00