Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1877 wm transient broken

obsolete: 8.4.9
closed-fixed
5
2010-01-06
2005-03-15
Kyle Bateman
No

In tk 8.3.5, the "wm transient" command made a window
so it always stayed on top of its parent. In addition,
my window manager is configured to not put a title bar
on a transient window.

In Fedora 3, I am using tk 8.4.7 and my test window
does not seem to be getting marked as transient. It
doesn't stay on top of its parent and its title bar is
no longer suppressed.

I'm enclosing a test script. Just run the script and
then move the "." window to the same part of the screen
as the "HI" window. As I understand it, the "HI" window
should always stay on top of the "." window.

Discussion

1 2 > >> (Page 1 of 2)
  • Kyle Bateman
    Kyle Bateman
    2005-03-15

    Test case

     
    Attachments
  • Joe English
    Joe English
    2005-03-17

    • milestone: 420075 --> obsolete: 8.4.9
     
  • Joe English
    Joe English
    2005-03-17

    • priority: 5 --> 3
     
  • Joe English
    Joe English
    2005-03-17

    Logged In: YES
    user_id=68433

    This looks like a race condition -- [wm transient .t .] is
    being called before the main toplevel "." has been mapped.
    If you run the script from an interactive wish (after "."
    has been mapped), or run "tkwait visibility ." before
    creating .t, or anything else that ensures "." is mapped,
    you'll get the expected behavior.

    With that information, are you able to find a workaround in
    your application?

    This is related to changes made in 2002:

    2002-05-27 (feature change) [wm transient .t .t] now raises
    an error (dejong)
    *** POTENTIAL INCOMPATIBILITY ***

    2002-06-12 (feature change) A transient toplevel now mirrors
    state changes
    in the master. (dejong)
    *** POTENTIAL INCOMPATIBILITY ***

    See also CVS log entries for tkUnixWm.c r1.21 and r1.20.

    Changing back to the 8.3 behavior would reintroduce whatever
    problems the original changes were intended to fix.

     
  • Jeffrey Hobbs
    Jeffrey Hobbs
    2005-03-17

    Logged In: YES
    user_id=72656

    Mo should comment on this.

     
  • Jeffrey Hobbs
    Jeffrey Hobbs
    2005-03-17

    • assigned_to: jenglish --> stwo
     
  • Logged In: NO

    I can confirm that if I get the parent window to map before
    creating the transients, that solves the problem. In my
    particular case, this is a suitable workaround. Thanks for
    the info--that helped.

    Seems like it would still be nice to make this work right if
    a solution is achievable. For example, I notice that even
    if I do:

    after idle "wm transient ..."

    Seemed like in order to get it to work, I had to do an
    actual "update" before creating the child windows.

     
  • Kyle Bateman
    Kyle Bateman
    2005-03-18

    Logged In: YES
    user_id=316877

    Yup, that last post was from me, I just wasn't logged in.

     
  • Pat Thoyts
    Pat Thoyts
    2010-01-06

    The following patch would appear to be sufficient.

    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;

     
  • Verified that this does indeed fix things. Fixed in HEAD

    Test used to check follows:
    test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -setup {
    deleteWindows
    set result {}
    } -body {
    # Verifies that transients stay on top of their masters, even if they were
    # made transients when those masters were withdrawn.
    toplevel .t1; wm withdraw .t1; update
    toplevel .t2; wm transient .t2 .t1; update
    lappend result [winfo ismapped .t1] [winfo ismapped .t2]
    wm deiconify .t1; update
    lappend result [winfo ismapped .t1] [winfo ismapped .t2]
    raise .t1; update
    lappend result [lsearch -all -inline -glob [wm stackorder .] ".t?"]
    } -cleanup {
    deleteWindows
    } -result {0 0 1 1 {.t1 .t2}}

     
1 2 > >> (Page 1 of 2)