mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
105 lines
3.7 KiB
Diff
105 lines
3.7 KiB
Diff
From 005267dd840714e4b47a608c0f196a45904d080a Mon Sep 17 00:00:00 2001
|
|
From: Jordan Galby <gravemind2a+wine@gmail.com>
|
|
Date: Thu, 30 Aug 2018 11:59:12 +1000
|
|
Subject: [PATCH] winex11: Don't react to small slow mouse movements
|
|
|
|
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42631
|
|
---
|
|
dlls/winex11.drv/mouse.c | 36 ++++++++++++++++++++++++++++--------
|
|
dlls/winex11.drv/x11drv.h | 1 +
|
|
2 files changed, 29 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
|
index 10985c1..27a0c35 100644
|
|
--- a/dlls/winex11.drv/mouse.c
|
|
+++ b/dlls/winex11.drv/mouse.c
|
|
@@ -257,6 +257,8 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
|
|
|
|
thread_data->x_rel_valuator.number = -1;
|
|
thread_data->y_rel_valuator.number = -1;
|
|
+ thread_data->x_rel_valuator.accum = 0;
|
|
+ thread_data->y_rel_valuator.accum = 0;
|
|
|
|
for (i = 0; i < n_valuators; i++)
|
|
{
|
|
@@ -362,6 +364,8 @@ static void disable_xinput2(void)
|
|
pXIFreeDeviceInfo( data->xi2_devices );
|
|
data->x_rel_valuator.number = -1;
|
|
data->y_rel_valuator.number = -1;
|
|
+ data->x_rel_valuator.accum = 0;
|
|
+ data->y_rel_valuator.accum = 0;
|
|
data->xi2_devices = NULL;
|
|
data->xi2_core_pointer = 0;
|
|
data->xi2_current_slave = 0;
|
|
@@ -1769,31 +1773,47 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
|
|
|
for (i = 0; i <= max ( x_rel->number, y_rel->number ); i++)
|
|
{
|
|
- if (!XIMaskIsSet( event->valuators.mask, i )) continue;
|
|
+ if (!XIMaskIsSet( event->valuators.mask, i ))
|
|
+ continue;
|
|
val = *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)
|
|
- / (x_rel->max - x_rel->min);
|
|
+ dx = val * (virtual_rect.right - virtual_rect.left)
|
|
+ / (x_rel->max - x_rel->min);
|
|
}
|
|
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)
|
|
- / (y_rel->max - y_rel->min);
|
|
+ dy = val * (virtual_rect.bottom - virtual_rect.top)
|
|
+ / (y_rel->max - y_rel->min);
|
|
}
|
|
}
|
|
|
|
+ /* Accumulate the *double* dx/dy motions so sub-pixel motions wont be lost
|
|
+ * when sent/cast to *LONG* input.u.mi.dx/dy.
|
|
+ */
|
|
+ x_rel->accum += dx;
|
|
+ y_rel->accum += dy;
|
|
+ if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0)
|
|
+ {
|
|
+ TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum );
|
|
+ return TRUE;
|
|
+ }
|
|
+ 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 (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 );
|
|
return FALSE;
|
|
}
|
|
|
|
- TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
|
|
+ TRACE( "pos %d,%d (event %f,%f, accum %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy, x_rel->accum, y_rel->accum );
|
|
|
|
input.type = INPUT_MOUSE;
|
|
__wine_send_input( 0, &input );
|
|
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
|
index a0308b0..3df6b7a 100644
|
|
--- a/dlls/winex11.drv/x11drv.h
|
|
+++ b/dlls/winex11.drv/x11drv.h
|
|
@@ -318,6 +318,7 @@ struct x11drv_valuator_data
|
|
double min;
|
|
double max;
|
|
int number;
|
|
+ double accum;
|
|
};
|
|
|
|
struct x11drv_thread_data
|
|
--
|
|
1.9.1
|
|
|