Fixes mouse sometimes jumping around in Mechwarrior Online on KDE/Wayland.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dinput/mouse.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index ec30c825733..d376546f1a9 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -306,8 +306,8 @@ static void warp_check( struct mouse *impl, BOOL force )
if (force || (impl->need_warp && (now - impl->last_warped > interval))) { - RECT rect, new_rect; POINT mapped_center; + RECT rect;
impl->last_warped = now; impl->need_warp = FALSE; @@ -328,8 +328,7 @@ static void warp_check( struct mouse *impl, BOOL force ) rect.right = min( rect.right, rect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN ) - 2 ); rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 ); TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect )); - ClipCursor( &rect ); - impl->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect ); + impl->clipped = ClipCursor( &rect ); } } }
From: Rémi Bernon rbernon@codeweavers.com
Fixes mouse sometimes jumping around in Mechwarrior Online on KDE/Wayland. --- dlls/dinput/mouse.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index d376546f1a9..2d4e0a6b42c 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -313,13 +313,6 @@ static void warp_check( struct mouse *impl, BOOL force ) impl->need_warp = FALSE; if (!GetClientRect( impl->base.win, &rect )) return; MapWindowPoints( impl->base.win, 0, (POINT *)&rect, 2 ); - if (!impl->clipped) - { - mapped_center.x = (rect.left + rect.right) / 2; - mapped_center.y = (rect.top + rect.bottom) / 2; - TRACE( "Warping mouse to x %+ld, y %+ld.\n", mapped_center.x, mapped_center.y ); - SetCursorPos( mapped_center.x, mapped_center.y ); - } if (impl->base.dwCoopLevel & DISCL_EXCLUSIVE) { /* make sure we clip even if the window covers the whole screen */ @@ -330,6 +323,13 @@ static void warp_check( struct mouse *impl, BOOL force ) TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect )); impl->clipped = ClipCursor( &rect ); } + if (!impl->clipped) + { + mapped_center.x = (rect.left + rect.right) / 2; + mapped_center.y = (rect.top + rect.bottom) / 2; + TRACE( "Warping mouse to x %+ld, y %+ld.\n", mapped_center.x, mapped_center.y ); + SetCursorPos( mapped_center.x, mapped_center.y ); + } } }