diff options
author | Kevin Walzer <kw@codebykevin.com> | 2015-03-21 00:57:14 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2015-03-21 00:57:14 (GMT) |
commit | 4f6c1ad7943f8c595d9d539a6c6c33c96832554b (patch) | |
tree | 28a13f3c5fdd1724d3f1e4cce22305e2c775a2bd /macosx/tkMacOSXMouseEvent.c | |
parent | c76fcabd431431b1acfc9d4113781872fcc9fe9b (diff) | |
download | tk-4f6c1ad7943f8c595d9d539a6c6c33c96832554b.zip tk-4f6c1ad7943f8c595d9d539a6c6c33c96832554b.tar.gz tk-4f6c1ad7943f8c595d9d539a6c6c33c96832554b.tar.bz2 |
Cleanup and improvement of tracking of native windows in Cocoa; thanks to Marc Culler for patch
Diffstat (limited to 'macosx/tkMacOSXMouseEvent.c')
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 90d2d00..95f0021 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -53,19 +53,17 @@ enum { case NSCursorUpdate: #if 0 trackingArea = [theEvent trackingArea]; -#endif /* fall through */ +#endif case NSLeftMouseDown: case NSLeftMouseUp: case NSRightMouseDown: case NSRightMouseUp: case NSOtherMouseDown: case NSOtherMouseUp: - case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: - case NSMouseMoved: #if 0 eventNumber = [theEvent eventNumber]; @@ -73,22 +71,20 @@ enum { clickCount = [theEvent clickCount]; buttonNumber = [theEvent buttonNumber]; } + /* fall through */ #endif - case NSTabletPoint: case NSTabletProximity: - case NSScrollWheel: - win = [self windowWithWindowNumber:[theEvent windowNumber]]; break; - default: + default: /* Unrecognized mouse event. */ return theEvent; - break; } + /* Create an Xevent to add to the Tk queue. */ + win = [theEvent window]; NSPoint global, local = [theEvent locationInWindow]; - if (win) { global = [win convertBaseToScreen:local]; local.y = [win frame].size.height - local.y; @@ -105,7 +101,7 @@ enum { tkwin = TkMacOSXGetCapture(); } if (!tkwin) { - return theEvent; + return theEvent; /* Give up. No window for this event. */ } /* @@ -127,10 +123,10 @@ enum { EventRef eventRef = (EventRef)[theEvent eventRef]; UInt32 buttons; OSStatus err = GetEventParameter(eventRef, kEventParamMouseChord, - typeUInt32, NULL, sizeof(UInt32), NULL, &buttons); + typeUInt32, NULL, sizeof(UInt32), NULL, &buttons); if (err == noErr) { - state |= (buttons & ((1<<5) - 1)) << 8; + state |= (buttons & ((1<<5) - 1)) << 8; } else if (button < 5) { switch (type) { case NSLeftMouseDown: @@ -205,7 +201,6 @@ enum { Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } } - return theEvent; } @end |