diff options
author | Pekka Paalanen <pekka.paalanen@collabora.com> | 2019-12-05 16:09:11 +0200 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.com> | 2019-12-12 13:21:35 +0200 |
commit | e7fb62a3498549bd1fdd07f0fa5efed301dacb60 (patch) | |
tree | 07c7555b58362e475e563243a987eef4f22591a8 | |
parent | 8f9fa461689ddab9ce5beb0cfc32ca11fc3d04a2 (diff) | |
download | weston-e7fb62a3498549bd1fdd07f0fa5efed301dacb60.tar.gz weston-e7fb62a3498549bd1fdd07f0fa5efed301dacb60.tar.bz2 weston-e7fb62a3498549bd1fdd07f0fa5efed301dacb60.zip |
xwm: debug ConfigureWindow
Print all ConfigureWindow messages XWM sends. Helps debugging XWM why
fullscreening doesn't work right.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
-rw-r--r-- | xwayland/window-manager.c | 78 |
1 files changed, 59 insertions, 19 deletions
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index 1595721f..9be25eef 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -714,6 +714,47 @@ weston_wm_window_send_configure_notify(struct weston_wm_window *window) } static void +weston_wm_configure_window(struct weston_wm *wm, xcb_window_t window_id, + uint16_t mask, const uint32_t *values) +{ + static const struct { + xcb_config_window_t bitmask; + const char *name; + } names[] = { + { XCB_CONFIG_WINDOW_X, "x" }, + { XCB_CONFIG_WINDOW_Y, "y" }, + { XCB_CONFIG_WINDOW_WIDTH, "width" }, + { XCB_CONFIG_WINDOW_HEIGHT, "height" }, + { XCB_CONFIG_WINDOW_BORDER_WIDTH, "border_width" }, + { XCB_CONFIG_WINDOW_SIBLING, "sibling" }, + { XCB_CONFIG_WINDOW_STACK_MODE, "stack_mode" }, + }; + char *buf = NULL; + size_t sz = 0; + FILE *fp; + unsigned i, v; + + xcb_configure_window(wm->conn, window_id, mask, values); + + if (!wm_debug_is_enabled(wm)) + return; + + fp = open_memstream(&buf, &sz); + if (!fp) + return; + + fprintf(fp, "XWM: configure window %d:", window_id); + for (i = 0, v = 0; i < ARRAY_LENGTH(names); i++) { + if (mask & names[i].bitmask) + fprintf(fp, " %s=%d", names[i].name, values[v++]); + } + fclose(fp); + + wm_printf(wm, "%s\n", buf); + free(buf); +} + +static void weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *event) { xcb_configure_request_event_t *configure_request = @@ -764,13 +805,13 @@ weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *ev mask |= XCB_CONFIG_WINDOW_STACK_MODE; } - xcb_configure_window(wm->conn, window->id, mask, values); + weston_wm_configure_window(wm, window->id, mask, values); weston_wm_window_get_frame_size(window, &width, &height); values[0] = width; values[1] = height; mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; - xcb_configure_window(wm->conn, window->frame_id, mask, values); + weston_wm_configure_window(wm, window->frame_id, mask, values); weston_wm_window_schedule_repaint(window); } @@ -886,8 +927,9 @@ weston_wm_send_focus_window(struct weston_wm *wm, window->id, XCB_TIME_CURRENT_TIME); values[0] = XCB_STACK_MODE_ABOVE; - xcb_configure_window (wm->conn, window->frame_id, - XCB_CONFIG_WINDOW_STACK_MODE, values); + weston_wm_configure_window(wm, window->frame_id, + XCB_CONFIG_WINDOW_STACK_MODE, + values); } else { xcb_set_input_focus (wm->conn, XCB_INPUT_FOCUS_POINTER_ROOT, @@ -1063,8 +1105,8 @@ weston_wm_window_create_frame(struct weston_wm_window *window) xcb_reparent_window(wm->conn, window->id, window->frame_id, x, y); values[0] = 0; - xcb_configure_window(wm->conn, window->id, - XCB_CONFIG_WINDOW_BORDER_WIDTH, values); + weston_wm_configure_window(wm, window->id, + XCB_CONFIG_WINDOW_BORDER_WIDTH, values); window->cairo_surface = cairo_xcb_surface_create_with_xrender_format(wm->conn, @@ -2652,22 +2694,20 @@ weston_wm_window_configure(void *data) values[1] = y; values[2] = window->width; values[3] = window->height; - xcb_configure_window(wm->conn, - window->id, - XCB_CONFIG_WINDOW_X | - XCB_CONFIG_WINDOW_Y | - XCB_CONFIG_WINDOW_WIDTH | - XCB_CONFIG_WINDOW_HEIGHT, - values); + weston_wm_configure_window(wm, window->id, + XCB_CONFIG_WINDOW_X | + XCB_CONFIG_WINDOW_Y | + XCB_CONFIG_WINDOW_WIDTH | + XCB_CONFIG_WINDOW_HEIGHT, + values); weston_wm_window_get_frame_size(window, &width, &height); values[0] = width; values[1] = height; - xcb_configure_window(wm->conn, - window->frame_id, - XCB_CONFIG_WINDOW_WIDTH | - XCB_CONFIG_WINDOW_HEIGHT, - values); + weston_wm_configure_window(wm, window->frame_id, + XCB_CONFIG_WINDOW_WIDTH | + XCB_CONFIG_WINDOW_HEIGHT, + values); window->configure_source = NULL; @@ -2745,7 +2785,7 @@ send_position(struct weston_surface *surface, int32_t x, int32_t y) values[1] = y; mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; - xcb_configure_window(wm->conn, window->frame_id, mask, values); + weston_wm_configure_window(wm, window->frame_id, mask, values); xcb_flush(wm->conn); } } |