summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2021-05-01 20:38:00 (GMT)
committerculler <culler>2021-05-01 20:38:00 (GMT)
commitf75f8ffb36111cd3d9a47a50f04eeaff69430414 (patch)
tree9a70dd5538acc0fa8b40ab069642f29c51cd3394
parenta723a9e97cc86c5cbee7c26aca2d344ad18c12a1 (diff)
parent83f8e7abcd6153d5bab049fc822abee896c972b4 (diff)
downloadtk-f75f8ffb36111cd3d9a47a50f04eeaff69430414.zip
tk-f75f8ffb36111cd3d9a47a50f04eeaff69430414.tar.gz
tk-f75f8ffb36111cd3d9a47a50f04eeaff69430414.tar.bz2
Aqua: don't process idle tasks before withdrawing a window; this helps prevent a flashing window if the root is immediately withdrawn.
-rw-r--r--macosx/tkMacOSXWm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index e039072..15cc264 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 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 makes it more likely.
*/
+ if (state != WithdrawnState) {
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {};
+ }
+
while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {};
if (state == WithdrawnState) {