summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2010-05-16 10:03:13 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2010-05-17 09:12:48 -0700
commitab340014b91e9b86ea159674cd9cb1294d156b22 (patch)
treeecff57f275166b914f0134f3c714045cf922e294
parent2b030ce597efeac102761c85719865389da46d85 (diff)
XQuartz: Don't use deltaXY for determining pointer location on scroll events
<rdar://problem/7989690> Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Edward Moy <emoy@apple.com> (cherry picked from commit ecfeabec8d0dcfe286fb893047f1fe1a7ea9f8f5)
-rw-r--r--hw/xquartz/X11Application.m31
1 files changed, 20 insertions, 11 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 6d95f8c16..48280723a 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1031,23 +1031,32 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
1031 if(isMouseOrTabletEvent) { 1031 if(isMouseOrTabletEvent) {
1032 static NSPoint lastpt; 1032 static NSPoint lastpt;
1033 NSWindow *window = [e window]; 1033 NSWindow *window = [e window];
1034 NSRect screen = [[[NSScreen screens] objectAtIndex:0] frame];; 1034 NSRect screen = [[[NSScreen screens] objectAtIndex:0] frame];
1035 1035 BOOL hasUntrustedPointerDelta;
1036
1037 // NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that
1038 // Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets
1039 // are not normally used in cases where that bug would present itself, so this is a fair tradeoff
1040 // <rdar://problem/7111003> deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype
1041 // http://xquartz.macosforge.org/trac/ticket/288
1042 hasUntrustedPointerDelta = isTabletEvent;
1043
1044 // The deltaXY for middle click events also appear erroneous after fast user switching
1045 // <rdar://problem/7979468> deltaX and deltaY are incorrect for NSOtherMouseDown and NSOtherMouseUp after FUS
1046 // http://xquartz.macosforge.org/trac/ticket/389
1047 hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == NSOtherMouseDown || [e type] == NSOtherMouseUp;
1048
1049 // The deltaXY for scroll events correspond to the scroll delta, not the pointer delta
1050 // <rdar://problem/7989690> deltaXY for wheel events are being sent as mouse movement
1051 hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == NSScrollWheel;
1052
1036 if (window != nil) { 1053 if (window != nil) {
1037 NSRect frame = [window frame]; 1054 NSRect frame = [window frame];
1038 location = [e locationInWindow]; 1055 location = [e locationInWindow];
1039 location.x += frame.origin.x; 1056 location.x += frame.origin.x;
1040 location.y += frame.origin.y; 1057 location.y += frame.origin.y;
1041 lastpt = location; 1058 lastpt = location;
1042 } else if(isTabletEvent || [e type] == NSOtherMouseDown || [e type] == NSOtherMouseUp) { 1059 } else if(hasUntrustedPointerDelta) {
1043 // NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that
1044 // Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets
1045 // are not normally used in cases where that bug would present itself, so this is a fair tradeoff
1046 // <rdar://problem/7111003> deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype
1047 // http://xquartz.macosforge.org/trac/ticket/288
1048 // The deltaXY for middle click events also appear erroneous after fast user switching
1049 // <rdar://problem/7979468> deltaX and deltaY are incorrect for NSOtherMouseDown and NSOtherMouseUp after FUS
1050 // http://xquartz.macosforge.org/trac/ticket/389
1051 location = [e locationInWindow]; 1060 location = [e locationInWindow];
1052 lastpt = location; 1061 lastpt = location;
1053 } else { 1062 } else {