2019-09-29 01:06:18 -07:00
|
|
|
From 5c4db171dc87400ecd3e57b7efff805032328b5f Mon Sep 17 00:00:00 2001
|
2019-08-21 21:33:10 -07:00
|
|
|
From: Jordan Galby <gravemind2a+wine@gmail.com>
|
|
|
|
Date: Tue, 16 Jul 2019 00:34:38 -0400
|
2019-09-24 21:06:49 -07:00
|
|
|
Subject: [PATCH 09/11] winex11.drv: Don't react to small slow mouse movements.
|
2019-08-21 21:33:10 -07:00
|
|
|
|
|
|
|
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42631
|
|
|
|
From: Jordan Galby <gravemind2a+wine@gmail.com>
|
|
|
|
Signed-off-by: Derek Lesho <dereklesho52@Gmail.com>
|
|
|
|
---
|
|
|
|
dlls/winex11.drv/mouse.c | 51 +++++++++++++++++++++++++++++++--------
|
|
|
|
dlls/winex11.drv/x11drv.h | 1 +
|
|
|
|
2 files changed, 42 insertions(+), 10 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
2019-09-29 01:06:18 -07:00
|
|
|
index 1d9833b5c9..1b109c8d1a 100644
|
2019-08-21 21:33:10 -07:00
|
|
|
--- a/dlls/winex11.drv/mouse.c
|
|
|
|
+++ b/dlls/winex11.drv/mouse.c
|
2019-09-29 01:06:18 -07:00
|
|
|
@@ -266,6 +266,10 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
|
2019-09-24 21:06:49 -07:00
|
|
|
thread_data->y_abs_valuator.number = -1;
|
2019-08-21 21:33:10 -07:00
|
|
|
thread_data->wheel_valuator.number = -1;
|
|
|
|
|
|
|
|
+ thread_data->x_rel_valuator.accum = 0;
|
|
|
|
+ thread_data->y_rel_valuator.accum = 0;
|
|
|
|
+ thread_data->wheel_valuator.accum = 0;
|
|
|
|
+
|
2019-09-24 21:06:49 -07:00
|
|
|
thread_data->xi2_wheel_multiplier = 0;
|
|
|
|
|
2019-08-21 21:33:10 -07:00
|
|
|
for (i = 0; i < n_valuators; i++)
|
2019-09-29 01:06:18 -07:00
|
|
|
@@ -1920,9 +1924,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
2019-08-21 21:33:10 -07:00
|
|
|
raw_val = *raw_values++;
|
|
|
|
if (i == x_rel->number)
|
|
|
|
{
|
|
|
|
- input.u.mi.dx = dx = val;
|
|
|
|
+ dx = val;
|
|
|
|
if (x_rel->min < x_rel->max)
|
|
|
|
- input.u.mi.dx = val * (virtual_rect.right - virtual_rect.left)
|
|
|
|
+ dx = val * (virtual_rect.right - virtual_rect.left)
|
|
|
|
/ (x_rel->max - x_rel->min);
|
|
|
|
|
2019-09-24 21:06:49 -07:00
|
|
|
raw_input.data.mouse.usFlags = MOUSE_MOVE_RELATIVE;
|
2019-09-29 01:06:18 -07:00
|
|
|
@@ -1930,9 +1934,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
2019-08-21 21:33:10 -07:00
|
|
|
}
|
|
|
|
if (i == y_rel->number)
|
|
|
|
{
|
|
|
|
- input.u.mi.dy = dy = val;
|
|
|
|
+ dy = val;
|
|
|
|
if (y_rel->min < y_rel->max)
|
|
|
|
- input.u.mi.dy = val * (virtual_rect.bottom - virtual_rect.top)
|
|
|
|
+ dy = val * (virtual_rect.bottom - virtual_rect.top)
|
|
|
|
/ (y_rel->max - y_rel->min);
|
|
|
|
|
2019-09-24 21:06:49 -07:00
|
|
|
raw_input.data.mouse.usFlags = MOUSE_MOVE_RELATIVE;
|
2019-09-29 01:06:18 -07:00
|
|
|
@@ -1956,20 +1960,47 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
2019-08-21 21:33:10 -07:00
|
|
|
|
|
|
|
if (broken_rawevents && is_old_motion_event( xev->serial ))
|
|
|
|
{
|
|
|
|
- TRACE( "pos %d,%d old serial %lu, ignoring\n", input.u.mi.dx, input.u.mi.dy, xev->serial );
|
|
|
|
+ TRACE( "pos %d,%d old serial %lu, ignoring\n", (LONG) dx, (LONG) dy, xev->serial );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (thread_data->xi2_state == xi_extra)
|
|
|
|
+ /* Accumulate the fractional parts so they aren't lost after casting
|
|
|
|
+ * successive motion values to integral fields.
|
|
|
|
+ *
|
|
|
|
+ * Note: It looks like raw_dx and raw_dy are already integral values
|
|
|
|
+ * but that may be wrong.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ x_rel->accum += dx;
|
|
|
|
+ y_rel->accum += dy;
|
2019-09-24 21:06:49 -07:00
|
|
|
+ if ((dy || dy) && fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0)
|
2019-08-21 21:33:10 -07:00
|
|
|
+ {
|
|
|
|
+ TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum );
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
{
|
|
|
|
- TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
|
|
|
|
- __wine_send_input( 0, &input );
|
|
|
|
+ input.u.mi.dx = x_rel->accum;
|
|
|
|
+ input.u.mi.dy = y_rel->accum;
|
|
|
|
+ x_rel->accum -= input.u.mi.dx;
|
|
|
|
+ y_rel->accum -= input.u.mi.dy;
|
|
|
|
+
|
|
|
|
+ if (thread_data->xi2_state == xi_extra)
|
|
|
|
+ {
|
|
|
|
+ TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
|
|
|
|
+ __wine_send_input( 0, &input );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (raw_dwheel)
|
|
|
|
+ wheel->accum += raw_dwheel;
|
2019-09-24 21:06:49 -07:00
|
|
|
+ if (raw_dwheel && fabs(wheel->accum) < 1.0)
|
2019-08-21 21:33:10 -07:00
|
|
|
+ {
|
|
|
|
+ TRACE("accumulating wheel motion (event %f, accum %f)\n", raw_dwheel, wheel->accum);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
{
|
|
|
|
raw_input.data.mouse.u.usButtonFlags = RI_MOUSE_WHEEL;
|
|
|
|
- raw_input.data.mouse.u.usButtonData = raw_dwheel;
|
|
|
|
+ raw_input.data.mouse.u.usButtonData = wheel->accum;
|
|
|
|
+ wheel->accum -= raw_dwheel;
|
|
|
|
}
|
|
|
|
|
2019-09-24 21:06:49 -07:00
|
|
|
TRACE("raw %s event %f,%f + %f\n",
|
2019-08-21 21:33:10 -07:00
|
|
|
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
2019-09-29 01:06:18 -07:00
|
|
|
index 599ed48154..005512fc4e 100644
|
2019-08-21 21:33:10 -07:00
|
|
|
--- a/dlls/winex11.drv/x11drv.h
|
|
|
|
+++ b/dlls/winex11.drv/x11drv.h
|
2019-09-24 21:06:49 -07:00
|
|
|
@@ -320,6 +320,7 @@ struct x11drv_valuator_data
|
2019-08-21 21:33:10 -07:00
|
|
|
double min;
|
|
|
|
double max;
|
|
|
|
int number;
|
|
|
|
+ double accum;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct x11drv_thread_data
|
|
|
|
--
|
2019-09-24 21:06:49 -07:00
|
|
|
2.23.0
|
2019-08-21 21:33:10 -07:00
|
|
|
|