Tk Source Code

View Ticket
Login
2010-01-06
16:30 Closed ticket [1163496fff]: wm transient broken plus 7 other changes artifact: bbbabd66b6 user: dkf
16:26 Ticket [1163496fff]: 6 changes artifact: f9007b9a6c user: dkf
07:04 Ticket [1163496fff]: 4 changes artifact: f5786bf78c user: patthoyts
2005-03-18
07:34 Ticket [1163496fff]: 4 changes artifact: 26950e1553 user: kylebateman
07:33 Ticket [1163496fff]: 4 changes artifact: 0682258ee6 user: nobody
06:32 Ticket [1163496fff]: 5 changes artifact: 6396bdc5b8 user: hobbs
05:40 Ticket [1163496fff]: 5 changes artifact: e6802af6e3 user: jenglish
05:40 Ticket [1163496fff]: 1 change artifact: 5d29a86ee4 user: jenglish
2005-03-15
12:43 Ticket [1163496fff]: 4 changes artifact: 448d4ebb52 user: kylebateman
12:43 Add attachment test to ticket [1163496fff] artifact: 12d5748dc4 user: kylebateman
05:43 New ticket [1163496fff] wm transient broken. artifact: 1a76912ec5 user: kylebateman

Ticket UUID: 1163496
Title: wm transient broken
Type: Bug Version: obsolete: 8.4.9
Submitter: kylebateman Created on: 2005-03-15 05:43:07
Subsystem: 67. Unix Window Operations Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2010-01-06 16:30:42
Resolution: Fixed Closed By: dkf
    Closed on: 2010-01-06 09:30:42
Description:
 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.
User Comments: dkf added on 2010-01-06 16:30:42:

allow_comments - 1

And 8.5 branch

dkf added on 2010-01-06 16:26:51:
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}}

patthoyts added on 2010-01-06 07:04:15:
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.c9 Dec 2009 13:55:14 -00001.77
+++ unix/tkUnixWm.c5 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;

kylebateman added on 2005-03-18 07:34:33:
Logged In: YES 
user_id=316877

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

nobody added on 2005-03-18 07:33:14:
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.

hobbs added on 2005-03-18 06:32:18:
Logged In: YES 
user_id=72656

Mo should comment on this.

jenglish added on 2005-03-18 05:40:02:
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.

kylebateman added on 2005-03-15 12:43:07:

File Added - 125662: test

Attachments: