From 671154ccc5c0ce1f8249c44583bca497ea860b84 Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 30 Apr 2021 13:14:48 +0000 Subject: Do not process idle events before withdrawing a window. --- macosx/tkMacOSXWm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index e039072..a4bc102 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6447,9 +6447,19 @@ TkpWmSetState( macWin = TkMacOSXGetNSWindowForDrawable(winPtr->window); /* - * Make sure windows are updated before the state change. + * Make sure windows are updated before the state change. As an exception, + * do not do process idle tasks before withdrawing a window. The purpose of + * this is to support the common paradigm of immediately withdrawing the root + * window. Processing idle tasks before changing the state causes the root + * to briefly flash on the screen, which users of this paradigm find annoying. + * Not processing the events does not guarantee that the window will not appear + * but it makes it more likely. */ + if (state != WithdrawnState) { + while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}; + } + while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}; if (state == WithdrawnState) { -- cgit v0.12