diff options
author | marc_culler <marc.culler@gmail.com> | 2020-09-06 22:59:56 (GMT) |
---|---|---|
committer | marc_culler <marc.culler@gmail.com> | 2020-09-06 22:59:56 (GMT) |
commit | 0e5e252c47d4b11c94b2ca25e1f01a4123c85e98 (patch) | |
tree | acef145a478dd2eb9c1501fc078a40efe3f92fd6 /macosx | |
parent | aa5d50309de13f1aadf5549364beed42c5092d38 (diff) | |
download | tk-0e5e252c47d4b11c94b2ca25e1f01a4123c85e98.zip tk-0e5e252c47d4b11c94b2ca25e1f01a4123c85e98.tar.gz tk-0e5e252c47d4b11c94b2ca25e1f01a4123c85e98.tar.bz2 |
Don't process events for non-Tk windows.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index dceb678..05c4e0f 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -53,24 +53,37 @@ enum { { NSWindow *eventWindow = [theEvent window]; NSEventType eventType = [theEvent type]; - NSInteger button = [theEvent buttonNumber] + Button1; + NSRect viewFrame = [[eventWindow contentView] frame]; TkWindow *winPtr = NULL, *grabWinPtr; Tk_Window tkwin = None, capture, target; NSPoint local, global; - int win_x, win_y; + NSInteger button; Bool inTitleBar = NO; - static int validPresses = 0, ignoredPresses = 0; + int win_x, win_y; unsigned int buttonState = 0; + static int validPresses = 0, ignoredPresses = 0; #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif + /* + * If this event is not for a Tk toplevel, just pass it up the responder + * chain. + */ + + if (![eventWindow isMemberOfClass:[TKWindow class]]) { + return theEvent; + } + + /* + * Check if the event is located in the titlebar. + */ + if (eventWindow) { - NSRect viewFrame = [[eventWindow contentView] frame]; - NSPoint location = [theEvent locationInWindow]; - inTitleBar = viewFrame.size.height < location.y; + inTitleBar = viewFrame.size.height < [theEvent locationInWindow].y; } + button = [theEvent buttonNumber] + Button1; switch (eventType) { case NSRightMouseUp: case NSOtherMouseUp: |