Posted to tcl by patthoyts at Tue Jan 05 02:12:59 GMT 2010view pretty

If you create a toplevel and make it transient without giving the
master window a chance to be mapped first, then on X11 the transient
state is never set and the window manager is never told to treat the
toplevel as a transient window. [Bug 1163496]

demonstration script:

package require Tk
variable uid 0
proc mkdlg {} {
    variable uid
    set dlg [toplevel .dlg[incr uid]]
    wm transient $dlg .
    wm title $dlg "Transient $uid"
    return $dlg
}
mkdlg
pack [ttk::button .b1 -text "New dialog" -command mkdlg]
wm geometry . 200x200
tkwait window .
exit


Index: unix/tkUnixWm.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/tkUnixWm.c,v
retrieving revision 1.77
diff -u -p -r1.77 tkUnixWm.c
--- unix/tkUnixWm.c	9 Dec 2009 13:55:14 -0000	1.77
+++ unix/tkUnixWm.c	5 Jan 2010 01:49:43 -0000
@@ -676,11 +676,10 @@ TkWmMapWindow(
 	    if (!Tk_IsMapped(wmPtr->masterPtr)) {
 		wmPtr->withdrawn = 1;
 		wmPtr->hints.initial_state = WithdrawnState;
-	    } else {
-		XSetTransientForHint(winPtr->display,
-			wmPtr->wrapperPtr->window,
-			wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
 	    }
+	    XSetTransientForHint(winPtr->display,
+		    wmPtr->wrapperPtr->window,
+		    wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
 	}
 
 	wmPtr->flags |= WM_UPDATE_SIZE_HINTS;