What's the right XID ???

Glynn Clements glynn at gclements.plus.com
Wed Apr 16 17:24:33 PDT 2008


Eduardo Silva wrote:

> > The returned ID depends on how each application is implemented.
> 
> IIRC every program running connected to  the X Server has a top level
> window (which can be = to the Window manager container for that
> program) and this address must be the same for all cases... a program
> can have N windows but always exist the root one...

X clients don't have to have any windows. E.g. xwininfo and xlsclients
don't create windows.

If a client has multiple windows, none of them are necessarily any
more significant than any other. There are some conventions that a
client attaches certain properties only to the "main" window, but
there's no way to enforce this.

> >  Probably each one is traversing the windows tree different.
> 
> Here's my point, why the 3 resources returns a different window
> address for the same program... at least 'xrestop' uses libXres to get
> that information...

The value reported by xrestop is the client's resource ID base, which
isn't necessarily an XID.
> 
> >  #: xwininfo -root -tree | less
> >
> >  and search for each id that you listed in the output. This probably
> >  will give you some light.
> 
> That line was very useful, thanks :) ,  but I still wonder why they
> return different values :/

Looking at the source code, xlsclients calls XmuClientWindow() on each
child of the root window, while xwininfo calls XmuClientWindow() on
the window from the ButtonPress event. XmuClientWindow() simply
returns the first descendent with a WM_STATE property.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list