diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-12 14:52:53 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-12 14:52:53 (GMT) |
commit | 304456c27894c1a53b435c99aa10036f018204fd (patch) | |
tree | 45e7f9a1ef59394684c49f4d6506afde0146da6c /macosx/tkMacOSXSubwindows.c | |
parent | e179c5f50a60f4d97b9963fe6ad71e2376886ac4 (diff) | |
parent | bc52b8485678245b43a48cec01756c05b11fc17d (diff) | |
download | tk-304456c27894c1a53b435c99aa10036f018204fd.zip tk-304456c27894c1a53b435c99aa10036f018204fd.tar.gz tk-304456c27894c1a53b435c99aa10036f018204fd.tar.bz2 |
Merge 8.6
Diffstat (limited to 'macosx/tkMacOSXSubwindows.c')
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 21e346a..6fd2b21 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 |