public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Patch to fixup flashy windows problem under Win32
@ 2002-06-24 13:57 Mo DeJong
  0 siblings, 0 replies; only message in thread
From: Mo DeJong @ 2002-06-24 13:57 UTC (permalink / raw)
  To: insight

This is a back port of a patch that has just been committed to the Tk 8.4
CVS. It fixes a problem under Win32 where a window that has never
been mapped flashes on the screen after a wm deiconify call.

Here is a stripped down example of the problem.

if 1 { 
                set t [toplevel .t -width 1000 -height 1000 -bg black] 
                wm withdraw $t 
                #update 
                pack [button $t.b -text AREALLYLONGSTRING] 
                after 4000 
                #update idletasks 
                wm deiconify $t 
 } 

The window should be mapped with the reqWidth and reqHeight of
the widgets inside the toplevel. Without the patch, it gets mapped
and then gets resized at idle time. With the patch, it gets mapped
once at the correct size. You might think about adding some update
calls to work around the problem (like the commented ones), but
it does not really fix things. The patch is the right way to fix the
issue.

cheers
Mo DeJong

2002-06-13  Mo DeJong  <supermo@bayarea.net>

	* win/tkWinWm.c (Tk_WmCmd): Check the WM_NEVER_MAPPED
	flag while processing the wm deiconify command.
	The WM_UPDATE_PENDING flag should never be set when
	WM_NEVER_MAPPED is set, but double check so that
	the implementation is more explicit and matches
	the comment just above.
	Return without invoking TkWmRestackToplevel or
	TkSetFocusWin on a toplevel that has never been
	mapped. This fixes a bug where a toplevel is mapped
	with the wrong size and is then resized by the
	idle call to MapFrame.

Index: tk/win/tkWinWm.c
===================================================================
RCS file: /cvs/src/src/tk/win/tkWinWm.c,v
retrieving revision 1.2
diff -u -r1.2 tkWinWm.c
--- tk/win/tkWinWm.c	10 Sep 2001 01:16:55 -0000	1.2
+++ tk/win/tkWinWm.c	24 Jun 2002 20:46:17 -0000
@@ -1453,11 +1453,12 @@
         }
 	/*
 	 * If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may
-	 * need to be called first to update a withdrew toplevel's geometry
+	 * need to be called first to update a withdrawn toplevel's geometry
 	 * before it is deiconified by TkpWmSetState.
 	 * Don't bother if we've never been mapped.
 	 */
-	if (wmPtr->flags & WM_UPDATE_PENDING) {
+	if ((wmPtr->flags & WM_UPDATE_PENDING) &&
+	        !(wmPtr->flags & WM_NEVER_MAPPED)) {
 	    Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
 	    UpdateGeometryInfo((ClientData) winPtr);
 	}
@@ -1470,6 +1471,15 @@
 	    TkpWmSetState(winPtr, ZoomState);
 	} else {
 	    TkpWmSetState(winPtr, NormalState);
+	}
+
+	/*
+	 * An unmapped window will be mapped at idle time
+	 * by a call to MapFrame. That calls CreateWrapper
+	 * which sets the focus and raises the window.
+	 */
+	if (wmPtr->flags & WM_NEVER_MAPPED) {
+	    return TCL_OK;
 	}
 
 	/*

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-06-24 20:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-24 13:57 Patch to fixup flashy windows problem under Win32 Mo DeJong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).