Tk Source Code

View Ticket
Login
Ticket UUID: 540920
Title: Access to 'container' id
Type: RFE Version: None
Submitter: dkf Created on: 2002-04-08 09:53:11
Subsystem: 67. Unix Window Operations Assigned To: hobbs
Priority: 3 Low Severity:
Status: Open Last Modified: 2003-02-25 16:46:19
Resolution: None Closed By:
    Closed on:
Description:
On my system, if I do
  exec xwininfo -tree -id [wm frame .]
I get output something like this:

  xwininfo: Window id: 0x3810df9 (has no name)

    Root window id: 0x2a (the root window)
                         (has no name)
    Parent window id: 0x2a (the root window)
                           (has no name)
       10 children:
       0x3810e03 (has no name): ()
                               200x200+5+24  +312+72
          1 child:
          0x5c00004 "wish8.3": ("wish8.3" "Wish8.3")
                               200x200+0+0  +312+72
             1 child:
             0x5c00003 (has no name): ()
                               200x200+0+0  +312+72
       [... rest of output elided ...]

Now, the window id of the frame, 0x3810df9, is easily
obtainable with [wm frame] and the window id of the
drawing area is also easily obtainable with [winfo id],
but the window id of the window that comes between them
(present on UNIX/X because the window that implements
the menubar for a window is a sibling of the toplevel
drawing area, not a child of it, so an extra container
is needed to hold them both) is not available without
doing a hack (rummaging through the output of xwininfo
or hacking around with XQueryTree.)  Wouldn't it be
better if there was a way to expose this information at
the Tcl and C levels in a cleaner way?  (You need it
when you apply a non-rectangular shaping to a window,
for example, because window managers only notice
reshaping events on the container, not its children.)
User Comments: jenglish added on 2002-08-15 05:38:56:
Logged In: YES 
user_id=68433

Reassigning to Jeff so this doesn't get dropped on the
floor.

Remaining questions:
  * Should this be integrated into Tcl 8.4?
  * Does this change require a TIP?
  * Is the documentation clear enough?
  * Do we need to add Windows and Mac implementations
(presumably [wm wrapper] would be the same as [winfo id] on
those platforms)?

jenglish added on 2002-08-10 01:53:33:

File Added - 28741: wm-wrapper-2.patch

jenglish added on 2002-08-10 01:53:32:
Logged In: YES 
user_id=68433

Old patch has suffered from bit rot; attaching fresh
wm-wrapper-2.patch, made against the current CVS HEAD
(tkUnixWm.c rf1.33)

jenglish added on 2002-04-10 03:30:29:

File Added - 20892: wm-wrappper.patch

Logged In: YES 
user_id=68433

Please try the attached patch -- this adds [wm wrapper
$toplevel] under Unix.

I made this a subcommand of [wm] instead of [winfo] for two
reasons: the other subcommands of [winfo] work for any
window, whereas all the [wm] subcommands work for toplevels
only; since only toplevels have wrappers this falls into the
latter category.  Also, [winfo] is generic, [wm] is
platform-specific, and this feature depends on the
platform-specific parts; there's a lot less plumbing
involved if it's implemented in the [wm] ensemble.

I haven't touched mac/tkMacWm.c or win/tkWinWm.c; not sure
what to do here yet.

Here's the new doc entry:

+ .TP
+ \fBwm wrapper \fIwindow\fR
+ (Unix only.)
+ Under X11, Tk creates a wrapper window around top-level
windows
+ to hold the menu bar.
+ This command returns the platform specific window
identifier
+ for the wrapper window.

hobbs added on 2002-04-09 04:04:13:
Logged In: YES 
user_id=72656

I like 'winfo id ?-wrapper? $window' best.  It uses an 
existing command, just adding an easily checked option.

jenglish added on 2002-04-09 03:53:54:
Logged In: YES 
user_id=68433

A couple of questions --

Would it suffice to return the X window id of the wrapper
window?  (Actually, I think that's about all we can do,
since the wrapper doesn't really have a separate identity as
a Tk window.)
What do you suggest as the command syntax?  [wm wrapperid
$toplevel]?
What should it do on non-X platforms?
Should there be a TIP for this?

I think I see how to implement this -- in unix/tkUnixWm.c,
just peek at  wmPtr->wrapperPtr->window and do the same
thing as [wm frame].

Attachments: