diff options
Diffstat (limited to 'macosx/tkMacOSXMouseEvent.c')
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 03d5730..2fcdeb9 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -114,6 +114,17 @@ enum { } case NSLeftMouseUp: case NSLeftMouseDown: + + /* + * Ignore mouse button events which arrive while the app is inactive. + * These events will be resent after activation, causing duplicate + * actions when an app is activated by a bound mouse event. See ticket + * [7bda9882cb]. + */ + + if (! [NSApp isActive]) { + return theEvent; + } case NSMouseMoved: case NSScrollWheel: #if 0 @@ -170,20 +181,18 @@ enum { */ capture = TkMacOSXGetCapture(); - if (capture) { + if (eventWindow) { + winPtr = TkMacOSXGetTkWindow(eventWindow); + } else if (capture) { winPtr = (TkWindow *) capture; eventWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (!eventWindow) { return theEvent; } - } else { - if (eventWindow) { - winPtr = TkMacOSXGetTkWindow(eventWindow); - } - if (!winPtr) { - eventWindow = [NSApp mainWindow]; - winPtr = TkMacOSXGetTkWindow(eventWindow); - } + } + if (!winPtr) { + eventWindow = [NSApp mainWindow]; + winPtr = TkMacOSXGetTkWindow(eventWindow); } if (!winPtr) { |