wine-staging/patches/user32-rawinput-mouse-experimental/0002-winex11.drv-Send-relative-RawMotion-events-unprocess.patch
Zebediah Figura f904ca32a3 user32-rawinput-*: Rebase and re-enable.
Thanks to RĂ©mi Bernon for the rebased patch sets.
2020-06-30 17:30:13 -05:00

87 lines
3.4 KiB
Diff

From ddb1995ab864885e9ab683a16f3594e712efa669 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 10 Sep 2019 12:24:22 +0200
Subject: [PATCH] winex11.drv: Send relative RawMotion events unprocessed.
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 | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 84a47f1e522..2fcacaee95c 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -1897,20 +1897,17 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
{
XIRawEvent *event = xev->data;
const double *values = event->valuators.values;
+ const double *raw_values = event->raw_values;
RECT virtual_rect;
INPUT input;
int i;
double dx = 0, dy = 0, val;
+ double raw_dx = 0, raw_dy = 0, raw_val;
double x_scale = 1, y_scale = 1;
struct x11drv_thread_data *thread_data = x11drv_thread_data();
XIValuatorClassInfo *x_pos, *y_pos;
if (thread_data->x_pos_valuator.number < 0 || thread_data->y_pos_valuator.number < 0) return FALSE;
- if (thread_data->x_pos_valuator.mode != thread_data->y_pos_valuator.mode)
- {
- FIXME("Unsupported relative/absolute X/Y axis mismatch\n.");
- return FALSE;
- }
if (!event->valuators.mask_len) return FALSE;
if (thread_data->xi2_state != xi_enabled) return FALSE;
if (event->deviceid != thread_data->xi2_core_pointer) return FALSE;
@@ -1938,9 +1935,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
{
if (!XIMaskIsSet( event->valuators.mask, i )) continue;
val = *values++;
+ raw_val = *raw_values++;
if (i == x_pos->number)
{
dx = val;
+ raw_dx = raw_val;
input.u.mi.dwFlags |= (x_pos->mode == XIModeAbsolute ? MOUSEEVENTF_ABSOLUTE : 0);
if (x_pos->mode == XIModeAbsolute)
input.u.mi.dx = (dx - x_pos->min) * x_scale;
@@ -1950,6 +1949,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
if (i == y_pos->number)
{
dy = val;
+ raw_dy = raw_val;
input.u.mi.dwFlags |= (y_pos->mode == XIModeAbsolute ? MOUSEEVENTF_ABSOLUTE : 0);
if (y_pos->mode == XIModeAbsolute)
input.u.mi.dy = (dy - y_pos->min) * y_scale;
@@ -1964,13 +1964,20 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
return FALSE;
}
- if (!thread_data->xi2_rawinput_only)
+ if (x_pos->mode == XIModeAbsolute)
+ {
+ TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
+ __wine_send_input( 0, &input, SEND_HWMSG_RAWINPUT );
+ }
+ else if (!thread_data->xi2_rawinput_only)
{
TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
__wine_send_input( 0, &input, SEND_HWMSG_WINDOW );
}
else
{
+ input.u.mi.dx = raw_dx;
+ input.u.mi.dy = raw_dy;
TRACE( "raw pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
__wine_send_input( 0, &input, SEND_HWMSG_RAWINPUT );
}
--
2.27.0