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

  1. If you create a toplevel and make it transient without giving the
  2. master window a chance to be mapped first, then on X11 the transient
  3. state is never set and the window manager is never told to treat the
  4. toplevel as a transient window. [Bug 1163496]
  5.  
  6. demonstration script:
  7.  
  8. package require Tk
  9. variable uid 0
  10. proc mkdlg {} {
  11. variable uid
  12. set dlg [toplevel .dlg[incr uid]]
  13. wm transient $dlg .
  14. wm title $dlg "Transient $uid"
  15. return $dlg
  16. }
  17. mkdlg
  18. pack [ttk::button .b1 -text "New dialog" -command mkdlg]
  19. wm geometry . 200x200
  20. tkwait window .
  21. exit
  22.  
  23.  
  24. Index: unix/tkUnixWm.c
  25. ===================================================================
  26. RCS file: /cvsroot/tktoolkit/tk/unix/tkUnixWm.c,v
  27. retrieving revision 1.77
  28. diff -u -p -r1.77 tkUnixWm.c
  29. --- unix/tkUnixWm.c 9 Dec 2009 13:55:14 -0000 1.77
  30. +++ unix/tkUnixWm.c 5 Jan 2010 01:49:43 -0000
  31. @@ -676,11 +676,10 @@ TkWmMapWindow(
  32. if (!Tk_IsMapped(wmPtr->masterPtr)) {
  33. wmPtr->withdrawn = 1;
  34. wmPtr->hints.initial_state = WithdrawnState;
  35. - } else {
  36. - XSetTransientForHint(winPtr->display,
  37. - wmPtr->wrapperPtr->window,
  38. - wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
  39. }
  40. + XSetTransientForHint(winPtr->display,
  41. + wmPtr->wrapperPtr->window,
  42. + wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
  43. }
  44.  
  45. wmPtr->flags |= WM_UPDATE_SIZE_HINTS;