summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-02-23 02:30:53 (GMT)
committerculler <culler>2019-02-23 02:30:53 (GMT)
commit90916aadc867e185421627299a4b48fbe1732b02 (patch)
tree1588efb9d4920c9cb2eab8eb8bf3a7d4d50734bf
parent1cef9274b60a299bef15c8ddc054701387f9d560 (diff)
parent26f086b4be1a8a8a559d080ece2f257b19763c17 (diff)
downloadtk-90916aadc867e185421627299a4b48fbe1732b02.zip
tk-90916aadc867e185421627299a4b48fbe1732b02.tar.gz
tk-90916aadc867e185421627299a4b48fbe1732b02.tar.bz2
Fix bug [56a1823c73]: Aqua toplevels can fail to appear on screen.
-rw-r--r--macosx/tkMacOSXInit.c10
-rw-r--r--macosx/tkMacOSXSubwindows.c24
2 files changed, 27 insertions, 7 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 9d4d487..e1d56fa 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -122,7 +122,17 @@ static char scriptPath[PATH_MAX + 1] = "";
* method is called. Activating too early can cause the menu
* bar to be unresponsive.
*/
+
[NSApp activateIgnoringOtherApps: YES];
+
+ /*
+ * Process events to ensure that the root window is fully
+ * initialized. See ticket 56a1823c73.
+ */
+
+ [NSApp _lockAutoreleasePool];
+ while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {}
+ [NSApp _unlockAutoreleasePool];
}
- (void) _setup: (Tcl_Interp *) interp
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 35002a9..805d58f 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -149,6 +149,7 @@ XMapWindow(
if (Tk_IsTopLevel(macWin->winPtr)) {
if (!Tk_IsEmbedded(macWin->winPtr)) {
NSWindow *win = TkMacOSXDrawableWindow(window);
+
/*
* We want to activate Tk when a toplevel is mapped
* but we must not supply YES here. This is because
@@ -157,6 +158,7 @@ XMapWindow(
* the app to activate too early can make the menu bar
* unresponsive.
*/
+
TkMacOSXApplyWindowAttributes(macWin->winPtr, win);
[win setExcludedFromWindowsMenu:NO];
[NSApp activateIgnoringOtherApps:NO];
@@ -166,11 +168,22 @@ XMapWindow(
} else {
[win orderFrontRegardless];
}
+
+ /*
+ * In some cases the toplevel will not be drawn unless we process
+ * all pending events now. See ticket 56a1823c73.
+ */
+
+ [NSApp _lockAutoreleasePool];
+ while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {}
+ [NSApp _unlockAutoreleasePool];
} else {
+
/*
* Rebuild the container's clipping region and display
* the window.
*/
+
TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr);
TkMacOSXInvalClipRgns((Tk_Window)contWinPtr);
TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
@@ -190,7 +203,9 @@ XMapWindow(
event.xmap.event = window;
event.xmap.override_redirect = macWin->winPtr->atts.override_redirect;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+
} else {
+
/*
* Rebuild the parent's clipping region and display the window.
*
@@ -211,11 +226,10 @@ XMapWindow(
NotifyVisibility(macWin->winPtr, &event);
/*
- * Make sure that subwindows get displayed.
+ * This seems to be needed to ensure that all subwindows get displayed.
*/
GenerateConfigureNotify(macWin->winPtr, 1);
-
}
/*
@@ -284,11 +298,7 @@ XUnmapWindow(
if (!Tk_IsEmbedded(winPtr) &&
winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
NSWindow *win = TkMacOSXDrawableWindow(window);
-
- if ([win isVisible]) {
- [[win parentWindow] removeChildWindow:win];
- [win orderOut:NSApp];
- }
+ [win orderOut:nil];
}
TkMacOSXInvalClipRgns((Tk_Window) winPtr);