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 | 66 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 2 ++ 2 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 1ceac3d7f2..e9cb591cb5 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -257,6 +257,10 @@ 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; + thread_data->x_rel_valuator.raw_accum = 0; + thread_data->y_rel_valuator.raw_accum = 0;
for (i = 0; i < n_valuators; i++) { @@ -1796,15 +1800,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0; - input.u.mi.dx = 0; - input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0; - raw_input.data.mouse.lLastX = 0; - raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1815,40 +1815,72 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
- raw_input.data.mouse.lLastX = raw_dx = raw_val; + raw_dx = raw_val; } 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);
- raw_input.data.mouse.lLastY = raw_dy = raw_val; + raw_dy = raw_val; } }
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 *double* motions so sub-pixel motions + * wont be lost when sent/cast to *LONG* target fields. + */ + + x_rel->accum += dx; + y_rel->accum += dy; + if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) { - TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy ); - __wine_send_input( 0, &input ); + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum ); } + else + { + 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 ( LIST_ENTRY(list_head(&g_x11_threads), struct x11drv_thread_data, entry) == thread_data) + 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 ); + } + } + + x_rel->raw_accum += raw_dx; + y_rel->raw_accum += raw_dy; + if (fabs(x_rel->raw_accum) < 1.0 && fabs(y_rel->raw_accum) < 1.0) + { + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", raw_dx, raw_dy, x_rel->raw_accum, y_rel->raw_accum ); + } + else { - TRACE("raw event %f,%f\n", raw_dx, raw_dy); - __wine_send_raw_input( &raw_input ); + raw_input.data.mouse.lLastX = x_rel->raw_accum; + raw_input.data.mouse.lLastY = y_rel->raw_accum; + x_rel->raw_accum -= raw_input.data.mouse.lLastX; + y_rel->raw_accum -= raw_input.data.mouse.lLastY; + + if ( LIST_ENTRY(list_head(&g_x11_threads), struct x11drv_thread_data, entry) == thread_data) + { + TRACE("raw event %d,%d(event %f,%f)\n", raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy); + __wine_send_raw_input( &raw_input ); + } }
return TRUE; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 378c1d7508..06b09730ee 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,8 @@ struct x11drv_valuator_data double min; double max; int number; + double accum; + double raw_accum; };
struct x11drv_thread_data
This is a modified version of staging's mouse-movements patch that applies cleanly on the first 6 patches I sent.
On Tue, Jul 16, 2019 at 7:57 PM Derek Lesho dereklesho52@gmail.com wrote:
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 | 66 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 2 ++ 2 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 1ceac3d7f2..e9cb591cb5 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -257,6 +257,10 @@ 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;
thread_data->x_rel_valuator.raw_accum = 0;
thread_data->y_rel_valuator.raw_accum = 0;
for (i = 0; i < n_valuators; i++) {
@@ -1796,15 +1800,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0;
input.u.mi.dx = 0;
input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0;
raw_input.data.mouse.lLastX = 0;
raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1815,40 +1815,72 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
raw_input.data.mouse.lLastX = raw_dx = raw_val;
raw_dx = raw_val; } 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);
raw_input.data.mouse.lLastY = raw_dy = raw_val;
raw_dy = raw_val; }
}
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 *double* motions so sub-pixel motions
* wont be lost when sent/cast to *LONG* target fields.
*/
- x_rel->accum += dx;
- y_rel->accum += dy;
- if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) {
TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy,
dx, dy );
__wine_send_input( 0, &input );
TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n",
dx, dy, x_rel->accum, y_rel->accum ); }
- else
- {
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 ( LIST_ENTRY(list_head(&g_x11_threads), struct x11drv_thread_data,
entry) == thread_data)
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 );
}
- }
- x_rel->raw_accum += raw_dx;
- y_rel->raw_accum += raw_dy;
- if (fabs(x_rel->raw_accum) < 1.0 && fabs(y_rel->raw_accum) < 1.0)
- {
TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n",
raw_dx, raw_dy, x_rel->raw_accum, y_rel->raw_accum );
- }
- else {
TRACE("raw event %f,%f\n", raw_dx, raw_dy);
__wine_send_raw_input( &raw_input );
raw_input.data.mouse.lLastX = x_rel->raw_accum;
raw_input.data.mouse.lLastY = y_rel->raw_accum;
x_rel->raw_accum -= raw_input.data.mouse.lLastX;
y_rel->raw_accum -= raw_input.data.mouse.lLastY;
if ( LIST_ENTRY(list_head(&g_x11_threads), struct
x11drv_thread_data, entry) == thread_data)
{
TRACE("raw event %d,%d(event %f,%f)\n",
raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy);
__wine_send_raw_input( &raw_input );
}
}
return TRUE;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 378c1d7508..06b09730ee 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,8 @@ struct x11drv_valuator_data double min; double max; int number;
- double accum;
- double raw_accum;
};
struct x11drv_thread_data
2.22.0
From: Jordan Galby gravemind2a+wine@gmail.com
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 | 66 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 2 ++ 2 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index a68844d328..03262c063a 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -257,6 +257,10 @@ 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; + thread_data->x_rel_valuator.raw_accum = 0; + thread_data->y_rel_valuator.raw_accum = 0;
for (i = 0; i < n_valuators; i++) { @@ -1797,15 +1801,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0; - input.u.mi.dx = 0; - input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0; - raw_input.data.mouse.lLastX = 0; - raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1816,40 +1816,72 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
- raw_input.data.mouse.lLastX = raw_dx = raw_val; + raw_dx = raw_val; } 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);
- raw_input.data.mouse.lLastY = raw_dy = raw_val; + raw_dy = raw_val; } }
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 *double* motions so sub-pixel motions + * wont be lost when sent/cast to *LONG* target fields. + */ + + x_rel->accum += dx; + y_rel->accum += dy; + if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) { - TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy ); - __wine_send_input( 0, &input ); + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum ); } + else + { + 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 (InterlockedExchange(&last_cookie, xev->cookie) != xev->cookie) + 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 ); + } + } + + x_rel->raw_accum += raw_dx; + y_rel->raw_accum += raw_dy; + if (fabs(x_rel->raw_accum) < 1.0 && fabs(y_rel->raw_accum) < 1.0) + { + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", raw_dx, raw_dy, x_rel->raw_accum, y_rel->raw_accum ); + } + else { - TRACE("raw event %f,%f\n", raw_dx, raw_dy); - __wine_send_raw_input( &raw_input ); + raw_input.data.mouse.lLastX = x_rel->raw_accum; + raw_input.data.mouse.lLastY = y_rel->raw_accum; + x_rel->raw_accum -= raw_input.data.mouse.lLastX; + y_rel->raw_accum -= raw_input.data.mouse.lLastY; + + if (InterlockedExchange(&last_cookie, xev->cookie) != xev->cookie) + { + TRACE("raw event %d,%d(event %f,%f)\n", raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy); + __wine_send_raw_input( &raw_input ); + } }
return TRUE; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a9138eef2a..408c1c3c72 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,8 @@ struct x11drv_valuator_data double min; double max; int number; + double accum; + double raw_accum; };
struct x11drv_thread_data
From: Jordan Galby gravemind2a+wine@gmail.com
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 | 63 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index a68844d328..1251f3fa45 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++) { @@ -1764,6 +1766,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_valuator_data *x_rel, *y_rel; static unsigned int last_cookie = 0; + static double raw_accum_x = 0, raw_accum_y = 0;
if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; @@ -1797,15 +1800,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0; - input.u.mi.dx = 0; - input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0; - raw_input.data.mouse.lLastX = 0; - raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1816,39 +1815,71 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
- raw_input.data.mouse.lLastX = raw_dx = raw_val; + raw_dx = raw_val; } 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);
- raw_input.data.mouse.lLastY = raw_dy = raw_val; + raw_dy = raw_val; } }
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 *double* motions so sub-pixel motions + * wont be lost when sent/cast to *LONG* target fields. + */ + + x_rel->accum += dx; + y_rel->accum += dy; + if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) { - TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy ); - __wine_send_input( 0, &input ); + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum ); } + else + { + 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 (InterlockedExchange(&last_cookie, xev->cookie) != xev->cookie) + 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 (InterlockedExchange(&last_cookie, xev->cookie) == xev->cookie) + return TRUE; + + raw_accum_x += raw_dx; + raw_accum_y += raw_dy; + if (fabs(raw_accum_x) < 1.0 && fabs(raw_accum_y) < 1.0) { - TRACE("raw event %f,%f\n", raw_dx, raw_dy); + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", raw_dx, raw_dy, raw_accum_x, raw_accum_y ); + } + else + { + raw_input.data.mouse.lLastX = raw_accum_x; + raw_input.data.mouse.lLastY = raw_accum_y; + raw_accum_x -= raw_input.data.mouse.lLastX; + raw_accum_y -= raw_input.data.mouse.lLastY; + + TRACE("raw event %d,%d(event %f,%f)\n", raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy); __wine_send_raw_input( &raw_input ); }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a9138eef2a..392b046c6d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,7 @@ struct x11drv_valuator_data double min; double max; int number; + double accum; };
struct x11drv_thread_data
Fixed a major oversight made when re-basing the patch of of patch 6 version 5.
On Fri, Jul 19, 2019 at 1:26 AM Derek Lesho dereklesho52@gmail.com wrote:
From: Jordan Galby gravemind2a+wine@gmail.com
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 | 63 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index a68844d328..1251f3fa45 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++) {
@@ -1764,6 +1766,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_valuator_data *x_rel, *y_rel; static unsigned int last_cookie = 0;
static double raw_accum_x = 0, raw_accum_y = 0;
if (thread_data->x_rel_valuator.number < 0 ||
thread_data->y_rel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; @@ -1797,15 +1800,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0;
input.u.mi.dx = 0;
input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0;
raw_input.data.mouse.lLastX = 0;
raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1816,39 +1815,71 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
raw_input.data.mouse.lLastX = raw_dx = raw_val;
raw_dx = raw_val; } 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);
raw_input.data.mouse.lLastY = raw_dy = raw_val;
raw_dy = raw_val; }
}
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 *double* motions so sub-pixel motions
* wont be lost when sent/cast to *LONG* target fields.
*/
- x_rel->accum += dx;
- y_rel->accum += dy;
- if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) {
TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy,
dx, dy );
__wine_send_input( 0, &input );
TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n",
dx, dy, x_rel->accum, y_rel->accum ); }
- else
- {
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 (InterlockedExchange(&last_cookie, xev->cookie) != xev->cookie)
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 (InterlockedExchange(&last_cookie, xev->cookie) == xev->cookie)
return TRUE;
- raw_accum_x += raw_dx;
- raw_accum_y += raw_dy;
- if (fabs(raw_accum_x) < 1.0 && fabs(raw_accum_y) < 1.0) {
TRACE("raw event %f,%f\n", raw_dx, raw_dy);
TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n",
raw_dx, raw_dy, raw_accum_x, raw_accum_y );
- }
- else
- {
raw_input.data.mouse.lLastX = raw_accum_x;
raw_input.data.mouse.lLastY = raw_accum_y;
raw_accum_x -= raw_input.data.mouse.lLastX;
raw_accum_y -= raw_input.data.mouse.lLastY;
TRACE("raw event %d,%d(event %f,%f)\n",
raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy); __wine_send_raw_input( &raw_input ); }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a9138eef2a..392b046c6d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,7 @@ struct x11drv_valuator_data double min; double max; int number;
- double accum;
};
struct x11drv_thread_data
2.22.0
From: Jordan Galby gravemind2a+wine@gmail.com
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 | 63 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index db71a33a41..b1adb8e424 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++) { @@ -1764,6 +1766,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_valuator_data *x_rel, *y_rel; static unsigned long last_time = 0; + static double raw_accum_x = 0, raw_accum_y = 0;
if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; @@ -1797,15 +1800,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0; - input.u.mi.dx = 0; - input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0; - raw_input.data.mouse.lLastX = 0; - raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1816,39 +1815,71 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
- raw_input.data.mouse.lLastX = raw_dx = raw_val; + raw_dx = raw_val; } 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);
- raw_input.data.mouse.lLastY = raw_dy = raw_val; + raw_dy = raw_val; } }
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 *double* motions so sub-pixel motions + * wont be lost when sent/cast to *LONG* target fields. + */ + + x_rel->accum += dx; + y_rel->accum += dy; + if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) { - TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy ); - __wine_send_input( 0, &input ); + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum ); } + else + { + 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 (InterlockedExchange( (LONG volatile*)&last_time, (LONG)event->time ) != event->time) + 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 (InterlockedExchange( (LONG volatile*)&last_time, (LONG)event->time ) == event->time) + return TRUE; + + raw_accum_x += raw_dx; + raw_accum_y += raw_dy; + if (fabs(raw_accum_x) < 1.0 && fabs(raw_accum_y) < 1.0) { - TRACE("raw event %f,%f\n", raw_dx, raw_dy); + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", raw_dx, raw_dy, raw_accum_x, raw_accum_y ); + } + else + { + raw_input.data.mouse.lLastX = raw_accum_x; + raw_input.data.mouse.lLastY = raw_accum_y; + raw_accum_x -= raw_input.data.mouse.lLastX; + raw_accum_y -= raw_input.data.mouse.lLastY; + + TRACE("raw event %d,%d(event %f,%f)\n", raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy); __wine_send_raw_input( &raw_input ); }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a9138eef2a..392b046c6d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,7 @@ struct x11drv_valuator_data double min; double max; int number; + double accum; };
struct x11drv_thread_data
From: Jordan Galby gravemind2a+wine@gmail.com
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 | 63 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index f328eb369c..77054618de 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++) { @@ -1733,6 +1735,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, val, raw_val; struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_valuator_data *x_rel, *y_rel; + static double raw_accum_x = 0, raw_accum_y = 0;
if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; @@ -1746,15 +1749,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0; - input.u.mi.dx = 0; - input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0; - raw_input.data.mouse.lLastX = 0; - raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1765,38 +1764,70 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
- raw_input.data.mouse.lLastX = raw_dx = raw_val; + raw_dx = raw_val; } 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);
- raw_input.data.mouse.lLastY = raw_dy = raw_val; + raw_dy = raw_val; } }
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 *double* motions so sub-pixel motions + * wont be lost when sent/cast to *LONG* target fields. + */ + + x_rel->accum += dx; + y_rel->accum += dy; + if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) { - TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy ); - __wine_send_input( 0, &input ); + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum ); } + else + { + 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;
- TRACE("raw event %f,%f\n", raw_dx, raw_dy); - __wine_send_raw_input( &raw_input ); + 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 ); + } + } + + raw_accum_x += raw_dx; + raw_accum_y += raw_dy; + if (fabs(raw_accum_x) < 1.0 && fabs(raw_accum_y) < 1.0) + { + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", raw_dx, raw_dy, raw_accum_x, raw_accum_y ); + } + else + { + raw_input.data.mouse.lLastX = raw_accum_x; + raw_input.data.mouse.lLastY = raw_accum_y; + raw_accum_x -= raw_input.data.mouse.lLastX; + raw_accum_y -= raw_input.data.mouse.lLastY; + + TRACE("raw event %d,%d(event %f,%f)\n", raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy); + __wine_send_raw_input( &raw_input ); + }
return TRUE; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a6d64f4383..7dfc06bcd2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,7 @@ struct x11drv_valuator_data double min; double max; int number; + double accum; };
struct x11drv_thread_data
Just a rebase.
On Fri, Jul 26, 2019 at 3:32 PM Derek Lesho dereklesho52@gmail.com wrote:
From: Jordan Galby gravemind2a+wine@gmail.com
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 | 63 +++++++++++++++++++++++++++++---------- dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index f328eb369c..77054618de 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++) {
@@ -1733,6 +1735,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, val, raw_val; struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_valuator_data *x_rel, *y_rel;
static double raw_accum_x = 0, raw_accum_y = 0;
if (thread_data->x_rel_valuator.number < 0 ||
thread_data->y_rel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; @@ -1746,15 +1749,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); input.u.mi.dwExtraInfo = 0;
input.u.mi.dx = 0;
input.u.mi.dy = 0;
raw_input.header.dwType = RIM_TYPEMOUSE; raw_input.data.mouse.u.usButtonFlags = 0; raw_input.data.mouse.u.usButtonData = 0; raw_input.data.mouse.ulExtraInformation = 0;
raw_input.data.mouse.lLastX = 0;
raw_input.data.mouse.lLastY = 0;
virtual_rect = get_virtual_screen_rect();
@@ -1765,38 +1764,70 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) 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);
raw_input.data.mouse.lLastX = raw_dx = raw_val;
raw_dx = raw_val; } 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);
raw_input.data.mouse.lLastY = raw_dy = raw_val;
raw_dy = raw_val; }
}
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 *double* motions so sub-pixel motions
* wont be lost when sent/cast to *LONG* target fields.
*/
- x_rel->accum += dx;
- y_rel->accum += dy;
- if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) {
TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy,
dx, dy );
__wine_send_input( 0, &input );
TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n",
dx, dy, x_rel->accum, y_rel->accum ); }
- else
- {
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;
- TRACE("raw event %f,%f\n", raw_dx, raw_dy);
- __wine_send_raw_input( &raw_input );
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 );
}
- }
- raw_accum_x += raw_dx;
- raw_accum_y += raw_dy;
- if (fabs(raw_accum_x) < 1.0 && fabs(raw_accum_y) < 1.0)
- {
TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n",
raw_dx, raw_dy, raw_accum_x, raw_accum_y );
- }
- else
- {
raw_input.data.mouse.lLastX = raw_accum_x;
raw_input.data.mouse.lLastY = raw_accum_y;
raw_accum_x -= raw_input.data.mouse.lLastX;
raw_accum_y -= raw_input.data.mouse.lLastY;
TRACE("raw event %d,%d(event %f,%f)\n",
raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY, raw_dx, raw_dy);
__wine_send_raw_input( &raw_input );
}
return TRUE;
} diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a6d64f4383..7dfc06bcd2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -320,6 +320,7 @@ struct x11drv_valuator_data double min; double max; int number;
- double accum;
};
struct x11drv_thread_data
2.22.0