Added winex11-mouse-movements patchset

This commit is contained in:
Alistair Leslie-Hughes 2018-08-31 08:44:58 +10:00
parent 51cfdc619e
commit 90c47aa854
3 changed files with 124 additions and 0 deletions

View File

@ -392,6 +392,7 @@ patch_enable_all ()
enable_winex11_Window_Style="$1"
enable_winex11_XEMBED="$1"
enable_winex11__NET_ACTIVE_WINDOW="$1"
enable_winex11_mouse_movements="$1"
enable_winex11_wglShareLists="$1"
enable_winhttp_Accept_Headers="$1"
enable_winhttp_System_Proxy_Autoconfig="$1"
@ -1353,6 +1354,9 @@ patch_enable ()
winex11-_NET_ACTIVE_WINDOW)
enable_winex11__NET_ACTIVE_WINDOW="$2"
;;
winex11-mouse-movements)
enable_winex11_mouse_movements="$2"
;;
winex11-wglShareLists)
enable_winex11_wglShareLists="$2"
;;
@ -7996,6 +8000,21 @@ if test "$enable_winex11_XEMBED" -eq 1; then
) >> "$patchlist"
fi
# Patchset winex11-mouse-movements
# |
# | This patchset fixes the following Wine bugs:
# | * [#42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games
# |
# | Modified files:
# | * dlls/winex11.drv/mouse.c, dlls/winex11.drv/x11drv.h
# |
if test "$enable_winex11_mouse_movements" -eq 1; then
patch_apply winex11-mouse-movements/0001-winex11-Don-t-react-to-small-slow-mouse-movements.patch
(
printf '%s\n' '+ { "Jordan Galby", "winex11: Don'\''t react to small slow mouse movements.", 1 },';
) >> "$patchlist"
fi
# Patchset winex11-wglShareLists
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,104 @@
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

View File

@ -0,0 +1 @@
Fixes: [42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games