summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2021-05-22 15:45:25 (GMT)
committerculler <culler>2021-05-22 15:45:25 (GMT)
commit32b9f7861e77670c4a80debaa6310a3e6fc2cd8c (patch)
tree4f1ff4665257ca27b0b1f3690143f7afc393b60d /macosx
parent6c591df4cb3364bd47d811c2725b22452fbdd313 (diff)
downloadtk-32b9f7861e77670c4a80debaa6310a3e6fc2cd8c.zip
tk-32b9f7861e77670c4a80debaa6310a3e6fc2cd8c.tar.gz
tk-32b9f7861e77670c4a80debaa6310a3e6fc2cd8c.tar.bz2
Fix [7bda9882cb]: Aqua generates duplicate double-click actions when the double click activates the application.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXKeyEvent.c8
-rw-r--r--macosx/tkMacOSXMouseEvent.c11
2 files changed, 17 insertions, 2 deletions
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 07f7107..961072f 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -713,8 +713,12 @@ XGrabKeyboard(
MacDrawable *macWin = (MacDrawable *)grab_window;
if (w && macWin->toplevel->winPtr == (TkWindow *) captureWinPtr) {
- if (modalSession) {
- Tcl_Panic("XGrabKeyboard: already grabbed");
+ if (modalSession ) {
+ if (keyboardGrabNSWindow == w) {
+ return GrabSuccess;
+ } else {
+ Tcl_Panic("XGrabKeyboard: already grabbed");
+ }
}
keyboardGrabNSWindow = w;
[w retain];
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 03d5730..43babbc 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