Debug prints

This commit is contained in:
Casey 2024-04-10 15:39:44 +03:00
parent 6a81121674
commit 5c7cd39166
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 10 additions and 0 deletions

View File

@ -10,12 +10,18 @@
xcb_window_t find_subwindow(xcb_connection_t *connection, xcb_window_t win, int w, int h);
xcb_window_t create_root_window(xcb_connection_t *connection, xcb_screen_t *screen) {
fprintf(stderr, "DBG: screen root WID=0x%08x\n", screen->root);
xcb_window_t root = find_subwindow(connection, screen->root, -1, -1);
if (!root) return 0;
fprintf(stderr, "DBG: root WID=0x%08x\n", root);
xcb_window_t parent = find_subwindow(connection, root, screen->width_in_pixels, screen->height_in_pixels);
if (!parent) return 0;
fprintf(stderr, "DBG: parent WID=0x%08x\n", parent);
xcb_window_t wid = xcb_generate_id(connection);
{
@ -87,11 +93,15 @@ xcb_window_t find_subwindow(xcb_connection_t *connection, xcb_window_t win, int
if (!get_window_attributes(connection, children[i], &attrs)) continue;
if (attrs.map_state != 0 && rect.width == w && rect.height == h) {
fprintf(stderr, "DBG: matching window WID=0x%08x x=%d y=%d w=%d h=%d\n", children[i], rect.x, rect.y, rect.width, rect.height);
free(qt_reply);
return children[i];
}
}
free(qt_reply);
}
fprintf(stderr, "ERR: didn't find matching subwindow, returning WID=0x%08x\n", win);
return win;
}