summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-10-25 01:29:43 (GMT)
committerculler <culler>2019-10-25 01:29:43 (GMT)
commit69c4df4bb74a7816b681d57474e2b941708cef8c (patch)
treee8c889f45000dd290da19c956a01791e38e8db45
parent78e5c73c2979582c40a5cf0d8cd78e92d3767d11 (diff)
parent76d7a3ad202d462c9cf40f18dc8da60a17bcf9d3 (diff)
downloadtk-69c4df4bb74a7816b681d57474e2b941708cef8c.zip
tk-69c4df4bb74a7816b681d57474e2b941708cef8c.tar.gz
tk-69c4df4bb74a7816b681d57474e2b941708cef8c.tar.bz2
Fix [0854c99473]: macOS key events during a local grab are not handled correctly.
-rw-r--r--macosx/tkMacOSXKeyEvent.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 0fb1d53..f67460b 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -137,9 +137,9 @@ unsigned short releaseCode;
}
/*
- * Events are only received for the front Window on the Macintosh. So
+ * Key events are only received for the front Window on the Macintosh. So
* to build an XEvent we look up the Tk window associated to the Front
- * window. If a different window has a local grab we ignore the event.
+ * window.
*/
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
@@ -148,11 +148,18 @@ unsigned short releaseCode;
if (tkwin) {
TkWindow *grabWinPtr = winPtr->dispPtr->grabWinPtr;
- if (grabWinPtr
- && grabWinPtr != winPtr
- && !winPtr->dispPtr->grabFlags /* this means the grab is local. */
- && grabWinPtr->mainPtr == winPtr->mainPtr) {
- return theEvent;
+ /*
+ * If a local grab is in effect, key events for windows in the
+ * grabber's application are redirected to the grabber. Key events
+ * for other applications are delivered normally. If a global
+ * grab is in effect all key events are redirected to the grabber.
+ */
+
+ if (grabWinPtr) {
+ if (winPtr->dispPtr->grabFlags || /* global grab */
+ grabWinPtr->mainPtr == winPtr->mainPtr){ /* same appl. */
+ tkwin = (Tk_Window) winPtr->dispPtr->focusPtr;
+ }
}
} else {
tkwin = (Tk_Window) winPtr->dispPtr->focusPtr;