window configuration events
Steven J Abner
pheonix.sja at att.net
Thu Jul 25 14:04:00 UTC 2024
In creating an event loop, I'm trying to avoid having inaccurate
data. I found that window managers are apparently sending the events
and not the Xserver. I would like to have the actual position of a
window for data passed along to others.
Unfortunately the xcb_configure_notify_event_t sent by window mangers
is a guess, at least on 2 that I've tried. Fortunately the width,
height have tested the same, so can use to configure drawing ports.
Sadly I am too much of a newbie and can't figure how to get the
geometry of a window's x,y position. Here's the code in my attempt:
xcb_configure_notify_event_t *configure;
configure = (xcb_configure_notify_event_t*)nvt;
int16_t hD = configure->width - iface->mete_box.w;
int16_t vD = configure->height - iface->mete_box.h;
if ((hD != 0) || (vD != 0))
_interface_configure(iface, hD, vD);
if ((configure->x | configure->y) != 0) {
xcb_get_geometry_cookie_t cookie;
cookie = xcb_get_geometry(connection, iface->window);
xcb_get_geometry_reply_t *cfg;
cfg = xcb_get_geometry_reply(connection, cookie, NULL);
if ((cfg->x != configure->x) || (cfg->y != configure->y)) {
printf("%d, { %d,%d } cfg { %d,%d }\n",
iface->window,
configure->x, configure->y, cfg->x, cfg->y);
}
free(cfg);
master_iface->mete_box.x = configure->x;
master_iface->mete_box.y = configure->y;
}
I get a result of this on one manger, that actually provides the
correct x,y on configure events:
window 71303168, CONFIGURE_NOTIFY. (101,223,800,200)
71303168, { 101,223 } cfg { 0,0 }
Can you please help me get the window's position from xcb. I'm not at a
point to learn Xlib's XGetWindowAttributes() nor desire to write off my
ignorance on xcb's API.
Steve
More information about the Xcb
mailing list