Menu

#103 Access to 'container' id

open
3
2003-02-25
2002-04-08
No

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.)

Discussion

  • Joe English

    Joe English - 2002-04-08

    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].

     
  • Joe English

    Joe English - 2002-04-08
    • summary: Access to "container" id --> Access to "container" id
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2002-04-08
    • summary: Access to "container" id --> Access to "container" id
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2002-04-08

    Logged In: YES
    user_id=72656

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

     
  • Joe English

    Joe English - 2002-04-09

    Patch to unix/tkUnixWm.c, doc/wm.n

     
  • Joe English

    Joe English - 2002-04-09

    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.

     
  • Joe English

    Joe English - 2002-04-09
    • summary: Access to "container" id --> Access to "container" id
     
  • Joe English

    Joe English - 2002-08-09
    • summary: Access to "container" id --> Access to "container" id
     
  • Joe English

    Joe English - 2002-08-09

    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)

     
  • Joe English

    Joe English - 2002-08-09

    updated patch to tkUnixWm.c r1.33, doc/wm.n

     
  • Joe English

    Joe English - 2002-08-14

    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)?

     
  • Joe English

    Joe English - 2002-08-14
    • assigned_to: jenglish --> hobbs
    • summary: Access to "container" id --> Access to "container" id
     
  • Donal K. Fellows

    • summary: Access to "container" id --> Access to 'container' id
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.