XQuartz: Only save lastpt on mouse/tablet events
(cherry picked from commit 552be074e5be6492df3e290e8b7d9daff1a2cb34)
This commit is contained in:
parent
491c2d74c1
commit
0fe639a314
|
@ -990,25 +990,25 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- (void) sendX11NSEvent:(NSEvent *)e {
|
- (void) sendX11NSEvent:(NSEvent *)e {
|
||||||
NSRect screen;
|
NSPoint location = NSZeroPoint, tilt = NSZeroPoint;
|
||||||
NSPoint location, tilt;
|
|
||||||
NSWindow *window;
|
|
||||||
int ev_button, ev_type;
|
int ev_button, ev_type;
|
||||||
float pressure;
|
float pressure = 0.0;
|
||||||
DeviceIntPtr pDev;
|
DeviceIntPtr pDev;
|
||||||
int modifierFlags;
|
int modifierFlags;
|
||||||
BOOL isTabletEvent;
|
BOOL isMouseOrTabletEvent, isTabletEvent;
|
||||||
|
|
||||||
static NSPoint lastpt;
|
isMouseOrTabletEvent = [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || [e type] == NSRightMouseDown ||
|
||||||
|
|
||||||
/* convert location to be relative to top-left of primary display */
|
|
||||||
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] == NSLeftMouseUp || [e type] == NSOtherMouseUp || [e type] == NSRightMouseUp ||
|
||||||
[e type] == NSLeftMouseDragged || [e type] == NSOtherMouseDragged || [e type] == NSRightMouseDragged ||
|
[e type] == NSLeftMouseDragged || [e type] == NSOtherMouseDragged || [e type] == NSRightMouseDragged ||
|
||||||
[e type] == NSMouseMoved ) && ([e subtype] == NSTabletPointEventSubtype || [e subtype] == NSTabletProximityEventSubtype));
|
[e type] == NSMouseMoved || [e type] == NSTabletPoint;
|
||||||
|
|
||||||
|
isTabletEvent = ([e type] == NSTabletPoint) ||
|
||||||
|
(isMouseOrTabletEvent && ([e subtype] == NSTabletPointEventSubtype || [e subtype] == NSTabletProximityEventSubtype));
|
||||||
|
|
||||||
|
if(isMouseOrTabletEvent) {
|
||||||
|
static NSPoint lastpt;
|
||||||
|
NSWindow *window = [e window];
|
||||||
|
NSRect screen = [[[NSScreen screens] objectAtIndex:0] frame];;
|
||||||
|
|
||||||
if (window != nil) {
|
if (window != nil) {
|
||||||
NSRect frame = [window frame];
|
NSRect frame = [window frame];
|
||||||
|
@ -1027,17 +1027,12 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
|
||||||
} 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]; // [e locationInWindow] gives us the "unfixed" location when our cursor is fixed. This bugs things like quake
|
lastpt = [e locationInWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert coordinate system */
|
/* Convert coordinate system */
|
||||||
screen = [[[NSScreen screens] objectAtIndex:0] frame];
|
|
||||||
location.y = (screen.origin.y + screen.size.height) - location.y;
|
location.y = (screen.origin.y + screen.size.height) - location.y;
|
||||||
|
}
|
||||||
/* Setup our valuators. These will range from 0 to 1 */
|
|
||||||
pressure = 0;
|
|
||||||
tilt.x = 0.0;
|
|
||||||
tilt.y = 0.0;
|
|
||||||
|
|
||||||
modifierFlags = [e modifierFlags];
|
modifierFlags = [e modifierFlags];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue