[PATCH] winemac: Add another workaround for bad side effects of CGWarpMouseCursorPosition().
Ken Thomases
ken at codeweavers.com
Wed Oct 28 17:01:54 CDT 2015
Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
dlls/winemac.drv/cocoa_app.m | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 8e1f318..7f6ca23 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1307,20 +1307,27 @@ - (BOOL) setCursorPosition:(CGPoint)pos
}
else
{
+ // Annoyingly, CGWarpMouseCursorPosition() effectively disassociates
+ // the mouse from the cursor position for 0.25 seconds. This means
+ // that mouse movement during that interval doesn't move the cursor
+ // and events carry a constant location (the warped-to position)
+ // even though they have delta values. For apps which warp the
+ // cursor frequently (like after every mouse move), this makes
+ // cursor movement horribly laggy and jerky, as only a fraction of
+ // mouse move events have any effect.
+ //
+ // On some versions of OS X, it's sufficient to forcibly reassociate
+ // the mouse and cursor position. On others, it's necessary to set
+ // the local events suppression interval to 0 for the warp. That's
+ // deprecated, but I'm not aware of any other way. For good
+ // measure, we do both.
+ CGSetLocalEventsSuppressionInterval(0);
ret = (CGWarpMouseCursorPosition(pos) == kCGErrorSuccess);
+ CGSetLocalEventsSuppressionInterval(0.25);
if (ret)
{
lastSetCursorPositionTime = [[NSProcessInfo processInfo] systemUptime];
- // Annoyingly, CGWarpMouseCursorPosition() effectively disassociates
- // the mouse from the cursor position for 0.25 seconds. This means
- // that mouse movement during that interval doesn't move the cursor
- // and events carry a constant location (the warped-to position)
- // even though they have delta values. This screws us up because
- // the accumulated deltas we send to Wine don't match any eventual
- // absolute position we send (like with a button press). We can
- // work around this by simply forcibly reassociating the mouse and
- // cursor position.
CGAssociateMouseAndMouseCursorPosition(true);
}
}
--
2.4.3
More information about the wine-patches
mailing list