Re: window configuration events

Uli Schlachter <[email protected]> Thu, 25 Jul 2024 19:33:36 +0200
Newsgroups gmane.comp.freedesktop.xcb
Message-ID <[email protected]>
Hi,

Am 25.07.24 um 18:39 schrieb Bart Massey:
[...]
> Thus, finding out the x,y position of the window manager's window on the
> root window requires some doing. I think the way to do this is to send a
> ConfigureWindow request that doesn't change anything and then listen for
> the synthetic ConfigureNotify event that will have the top-level x,y in
> root coordinates (
> https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#configuring_the_window
> ).
> [...]

another option is to use a TranslateCoordinates request to translate 0,0 
from your window to the root window. The above section of ICCCM also 
contains some words about it.

Untested pseudo-C:

xcb_translate_coordinates_reply_t *reply = 
xcb_translate_coordinates_reply(c, xcb_translate_coordinates(c, 
your_windows, screen->root, 0, 0), NULL);
if (reply) {
    printf("%d %d\n", reply->dst_x, dst_y);
    free(reply);
}

Cheers,
Uli
-- 
<alanc> I think someone had a Xprint version of glxgears at one point,
     but benchmarking how many GL pages you can print per second
     was deemed too silly to merge