Unsure how to find widget by location
Eirik Byrkjeflot Anonsen
eirik at opera.com
Fri Apr 10 00:56:22 PDT 2015
Mike Stewart <mstewart at altroninc.com> writes:
> So fair warning, I've recently been asked to do some display work and
> I'm not extremely familiar with it.
>
> I am currently in the midst of trying to write something that can
> identify the lowest level visible widget at the location and return
> the window ID, but find I'm having a wee bit of trouble. Using the
> known display and the default root window of that display, I was
> attempting to find the window ID of a button widget by recursively
> calling XQueryTree. I am calling XQueryTree, then use
> XGetWindowAttributes to check the child windows for visibility and if
> the given x,y pairing are inside of them, and then repeating to the
> bottom child. The problem I've run into is I have a situation where
> two buttons are stacked on top of each other. I have no idea how to
> tell the difference between an exposed window and one that is covered
> up. Both end up having identical attributes returned from
> XGetWindowAttributes, so I have no idea how to tell which one is
> actually exposed.
If your problem is only about the z-order of sibling windows, the child
list returned from XQueryTree is in stacking order. From "man
XQueryTree":
The children are listed in current stacking order, from bottom-most
(first) to top-most (last).
eirik
More information about the xorg
mailing list