summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXSubwindows.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2021-11-16 20:39:47 (GMT)
committerfvogel <fvogelnew1@free.fr>2021-11-16 20:39:47 (GMT)
commitd8f50ac067d2f0df387ca0b0c46278c2464efc8b (patch)
tree4c40167ca8b673d38459b4478944b8bc60cc4a7f /macosx/tkMacOSXSubwindows.c
parentc56ea97892bf4b5716fd0c88709b0ef0cb130995 (diff)
parenta9827f93eadc2978316098553e09406dae1f5520 (diff)
downloadtk-bug-b1d115fa60.zip
tk-bug-b1d115fa60.tar.gz
tk-bug-b1d115fa60.tar.bz2
Diffstat (limited to 'macosx/tkMacOSXSubwindows.c')
-rw-r--r--macosx/tkMacOSXSubwindows.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 2a6a04c..1093816 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -303,12 +303,41 @@ XUnmapWindow(
display->request++;
if (Tk_IsTopLevel(winPtr)) {
if (!Tk_IsEmbedded(winPtr) &&
- winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
- [win orderOut:nil];
+ winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
[win setExcludedFromWindowsMenu:YES];
+ [win orderOut:NSApp];
+ if ([win isKeyWindow]) {
+
+ /*
+ * If we are unmapping the key window then we need to make sure
+ * that a new key window is assigned, if possible. This is
+ * supposed to happen when a key window is ordered out, but as
+ * noted in tkMacOSXWm.c this does not happen, in spite of
+ * Apple's claims to the contrary.
+ */
+
+ for (NSWindow *w in [NSApp orderedWindows]) {
+ TkWindow *winPtr2 = TkMacOSXGetTkWindow(w);
+ WmInfo *wmInfoPtr;
+
+ BOOL isOnScreen;
+
+ if (!winPtr2 || !winPtr2->wmInfoPtr) {
+ continue;
+ }
+ wmInfoPtr = winPtr2->wmInfoPtr;
+ isOnScreen = (wmInfoPtr->hints.initial_state != IconicState &&
+ wmInfoPtr->hints.initial_state != WithdrawnState);
+ if (w != win && isOnScreen && [w canBecomeKeyWindow]) {
+ [w makeKeyAndOrderFront:NSApp];
+ break;
+ }
+ }
+ }
}
TkMacOSXInvalClipRgns((Tk_Window)winPtr);
} else {
+
/*
* Rebuild the visRgn clip region for the parent so it will be allowed
* to draw in the space from which this subwindow was removed and then