Unsure how to find widget by location

Mike Stewart mstewart at altroninc.com
Fri Apr 10 11:17:02 PDT 2015


Iterating backwards through the list of children seems to be enough to get
through the road block I'd hit; I'm kind of surprised it was that simple. I
do no think I need to be concerned with partially exposed windows in my
particular display application, but I will keep the shape extension in mind
and investigate it when I have time or requirements to do so. Thanks for
the assist.

On Fri, Apr 10, 2015 at 10:35 AM, Thomas Lübking <thomas.luebking at gmail.com>
wrote:

> On Mittwoch, 8. April 2015 23:50:59 CEST, Mike Stewart wrote:
>
>> 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.
>>
>
>
>
> Good idea.
> Do XQueryTree on the root window and iterate the returned list backwards.
> The first currently mapped window that covers the desired spot is your
> "Window" (nb. that you'll likely also have to cover the shape extension,
> ie. check whether the window has a mask and whether the desired spot is
> masked away in this window)
>
> Then repeat that process recursively until a window has no more mapped
> children under the target position. That's your desired widget.
>
> NOTICE: "modern" toolkits (Gtk+ & Qt) do usually no longer use one X
> drawable per UI element. The window is a plain & empty surface from the X11
> pov.
>
> Cheers,
> Thomas
>
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s
>



-- 
Mike Stewart
mstewart at altroninc.com
703-263-7306

This electronic mail transmission, including any attachments, may contain
certain information (technical data, proprietary information, etc.) whose
dissemination is controlled by US export laws and regulations, DOD
Distribution D statements, or non-disclosure agreements.  Unauthorized
review, use, disclosure, or distribution is prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20150410/f6645767/attachment.html>


More information about the xorg mailing list