diff options
author | culler <culler> | 2019-02-23 04:10:01 (GMT) |
---|---|---|
committer | culler <culler> | 2019-02-23 04:10:01 (GMT) |
commit | 53cc75a349a90c0f5e9afc1ef901c98ad3332141 (patch) | |
tree | 60bd3413e76108c93ae03f363ce06f5ad61ce0f0 /macosx | |
parent | aca8a46ef445cd61629a2b92094107c97ce89791 (diff) | |
parent | 90916aadc867e185421627299a4b48fbe1732b02 (diff) | |
download | tk-53cc75a349a90c0f5e9afc1ef901c98ad3332141.zip tk-53cc75a349a90c0f5e9afc1ef901c98ad3332141.tar.gz tk-53cc75a349a90c0f5e9afc1ef901c98ad3332141.tar.bz2 |
Fix bug [56a1823c73]: Aqua toplevels can fail to appear on screen.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXInit.c | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 24 |
2 files changed, 27 insertions, 7 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 5f64a4a..3c02d92 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -121,7 +121,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); |