XQuartz: Don't use location delta for tablets since NSEvent does not give a precise delta.
(cherry picked from commit 6c5bf756a7f5389cdfe2e43a339d7c31a3e522e9)
This commit is contained in:
parent
e360104880
commit
df6c013524
|
@ -997,22 +997,37 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
|
||||||
float pressure;
|
float pressure;
|
||||||
DeviceIntPtr pDev;
|
DeviceIntPtr pDev;
|
||||||
int modifierFlags;
|
int modifierFlags;
|
||||||
|
BOOL isTabletEvent;
|
||||||
|
|
||||||
static NSPoint lastpt;
|
static NSPoint lastpt;
|
||||||
|
|
||||||
/* convert location to be relative to top-left of primary display */
|
/* convert location to be relative to top-left of primary display */
|
||||||
window = [e window];
|
window = [e window];
|
||||||
|
|
||||||
|
isTabletEvent = ([e type] == NSTabletPoint) ||
|
||||||
|
(( [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || [e type] == NSRightMouseDown ||
|
||||||
|
[e type] == NSLeftMouseUp || [e type] == NSOtherMouseUp || [e type] == NSRightMouseUp ||
|
||||||
|
[e type] == NSLeftMouseDragged || [e type] == NSOtherMouseDragged || [e type] == NSRightMouseDragged ||
|
||||||
|
[e type] == NSMouseMoved ) && ([e subtype] == NSTabletPointEventSubtype || [e subtype] == NSTabletProximityEventSubtype));
|
||||||
|
|
||||||
if (window != nil) {
|
if (window != nil) {
|
||||||
NSRect frame = [window frame];
|
NSRect frame = [window frame];
|
||||||
location = [e locationInWindow];
|
location = [e locationInWindow];
|
||||||
location.x += frame.origin.x;
|
location.x += frame.origin.x;
|
||||||
location.y += frame.origin.y;
|
location.y += frame.origin.y;
|
||||||
lastpt = location;
|
lastpt = location;
|
||||||
|
} else if(isTabletEvent) {
|
||||||
|
// NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that
|
||||||
|
// Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets
|
||||||
|
// are not normally used in cases where that bug would present itself, so this is a fair tradeoff
|
||||||
|
// <rdar://problem/7111003> deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype
|
||||||
|
// http://xquartz.macosforge.org/trac/ticket/288
|
||||||
|
location = [e locationInWindow];
|
||||||
|
lastpt = location;
|
||||||
} else {
|
} else {
|
||||||
location.x = lastpt.x + [e deltaX];
|
location.x = lastpt.x + [e deltaX];
|
||||||
location.y = lastpt.y - [e deltaY];
|
location.y = lastpt.y - [e deltaY];
|
||||||
lastpt = [NSEvent mouseLocation];
|
lastpt = [e locationInWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert coordinate system */
|
/* Convert coordinate system */
|
||||||
|
|
Loading…
Reference in New Issue