mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
xwm: Add lots of WLR_X11_TRACE calls
This adds lots of calls which hopefully are enough to pinpoint where an X11 error came from. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
744fa2e1b7
commit
f12ed6f206
1 changed files with 47 additions and 0 deletions
|
|
@ -125,6 +125,8 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
xcb_get_geometry_cookie_t geometry_cookie =
|
||||
xcb_get_geometry(xwm->xcb_conn, window_id);
|
||||
|
||||
|
|
@ -187,20 +189,26 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
|
|||
|
||||
wlr_signal_emit_safe(&xwm->xwayland->events.new_surface, surface);
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void xwm_set_net_active_window(struct wlr_xwm *xwm,
|
||||
xcb_window_t window) {
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
xcb_change_property(xwm->xcb_conn, XCB_PROP_MODE_REPLACE,
|
||||
xwm->screen->root, xwm->atoms[NET_ACTIVE_WINDOW],
|
||||
xwm->atoms[WINDOW], 32, 1, &window);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xwm_send_wm_message(struct wlr_xwayland_surface *surface,
|
||||
xcb_client_message_data_t *data, uint32_t event_mask) {
|
||||
struct wlr_xwm *xwm = surface->xwm;
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
xcb_client_message_event_t event = {
|
||||
.response_type = XCB_CLIENT_MESSAGE,
|
||||
.format = 32,
|
||||
|
|
@ -215,6 +223,7 @@ static void xwm_send_wm_message(struct wlr_xwayland_surface *surface,
|
|||
surface->window_id,
|
||||
event_mask,
|
||||
(const char *)&event);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
}
|
||||
|
||||
|
|
@ -235,9 +244,11 @@ static void xwm_set_net_client_list(struct wlr_xwm *xwm) {
|
|||
}
|
||||
}
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
xcb_change_property(xwm->xcb_conn, XCB_PROP_MODE_REPLACE,
|
||||
xwm->screen->root, xwm->atoms[NET_CLIENT_LIST],
|
||||
XCB_ATOM_WINDOW, 32, mapped_surfaces, windows);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface);
|
||||
|
|
@ -246,6 +257,8 @@ static void xwm_set_focus_window(struct wlr_xwm *xwm,
|
|||
struct wlr_xwayland_surface *xsurface) {
|
||||
struct wlr_xwayland_surface *unfocus_surface = xwm->focus_surface;
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
// We handle cases where focus_surface == xsurface because we
|
||||
// want to be able to deny FocusIn events.
|
||||
xwm->focus_surface = xsurface;
|
||||
|
|
@ -287,6 +300,7 @@ static void xwm_set_focus_window(struct wlr_xwm *xwm,
|
|||
XCB_CONFIG_WINDOW_STACK_MODE, values);
|
||||
|
||||
xsurface_set_net_wm_state(xsurface);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xwm_surface_activate(struct wlr_xwm *xwm,
|
||||
|
|
@ -310,6 +324,8 @@ static void xwm_surface_activate(struct wlr_xwm *xwm,
|
|||
static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
|
||||
struct wlr_xwm *xwm = xsurface->xwm;
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
uint32_t property[6];
|
||||
size_t i = 0;
|
||||
if (xsurface->modal) {
|
||||
|
|
@ -339,6 +355,8 @@ static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
|
|||
XCB_ATOM_ATOM,
|
||||
32, // format
|
||||
i, property);
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xsurface_unmap(struct wlr_xwayland_surface *surface);
|
||||
|
|
@ -966,6 +984,7 @@ static void xsurface_set_wm_state(struct wlr_xwayland_surface *xsurface,
|
|||
struct wlr_xwm *xwm = xsurface->xwm;
|
||||
uint32_t property[] = { state, XCB_WINDOW_NONE };
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
xcb_change_property(xwm->xcb_conn,
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
xsurface->window_id,
|
||||
|
|
@ -973,6 +992,7 @@ static void xsurface_set_wm_state(struct wlr_xwayland_surface *xsurface,
|
|||
xwm->atoms[WM_STATE],
|
||||
32, // format
|
||||
sizeof(property) / sizeof(property[0]), property);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xwm_handle_map_request(struct wlr_xwm *xwm,
|
||||
|
|
@ -983,6 +1003,8 @@ static void xwm_handle_map_request(struct wlr_xwm *xwm,
|
|||
return;
|
||||
}
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
xsurface_set_wm_state(xsurface, ICCCM_NORMAL_STATE);
|
||||
xsurface_set_net_wm_state(xsurface);
|
||||
|
||||
|
|
@ -992,6 +1014,8 @@ static void xwm_handle_map_request(struct wlr_xwm *xwm,
|
|||
XCB_CONFIG_WINDOW_STACK_MODE, values);
|
||||
|
||||
xcb_map_window(xwm->xcb_conn, ev->window);
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xwm_handle_map_notify(struct wlr_xwm *xwm,
|
||||
|
|
@ -1559,6 +1583,8 @@ void wlr_xwayland_surface_restack(struct wlr_xwayland_surface *surface,
|
|||
size_t idx = 0;
|
||||
uint32_t flags = XCB_CONFIG_WINDOW_STACK_MODE;
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
if (sibling != NULL) {
|
||||
values[idx++] = sibling->window_id;
|
||||
flags |= XCB_CONFIG_WINDOW_SIBLING;
|
||||
|
|
@ -1566,6 +1592,7 @@ void wlr_xwayland_surface_restack(struct wlr_xwayland_surface *surface,
|
|||
values[idx++] = mode;
|
||||
|
||||
xcb_configure_window(xwm->xcb_conn, surface->window_id, flags, values);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
}
|
||||
|
||||
|
|
@ -1577,17 +1604,21 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface,
|
|||
xsurface->height = height;
|
||||
|
||||
struct wlr_xwm *xwm = xsurface->xwm;
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
|
||||
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
|
||||
XCB_CONFIG_WINDOW_BORDER_WIDTH;
|
||||
uint32_t values[] = {x, y, width, height, 0};
|
||||
xcb_configure_window(xwm->xcb_conn, xsurface->window_id, mask, values);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
}
|
||||
|
||||
void wlr_xwayland_surface_close(struct wlr_xwayland_surface *xsurface) {
|
||||
struct wlr_xwm *xwm = xsurface->xwm;
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
bool supports_delete = false;
|
||||
for (size_t i = 0; i < xsurface->protocols_len; i++) {
|
||||
if (xsurface->protocols[i] == xwm->atoms[WM_DELETE_WINDOW]) {
|
||||
|
|
@ -1605,6 +1636,7 @@ void wlr_xwayland_surface_close(struct wlr_xwayland_surface *xsurface) {
|
|||
xcb_kill_client(xwm->xcb_conn, xsurface->window_id);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
}
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
void xwm_destroy(struct wlr_xwm *xwm) {
|
||||
|
|
@ -1646,6 +1678,8 @@ void xwm_destroy(struct wlr_xwm *xwm) {
|
|||
}
|
||||
|
||||
static void xwm_get_resources(struct wlr_xwm *xwm) {
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
xcb_prefetch_extension_data(xwm->xcb_conn, &xcb_xfixes_id);
|
||||
xcb_prefetch_extension_data(xwm->xcb_conn, &xcb_composite_id);
|
||||
|
||||
|
|
@ -1691,11 +1725,14 @@ static void xwm_get_resources(struct wlr_xwm *xwm) {
|
|||
xfixes_reply->major_version, xfixes_reply->minor_version);
|
||||
|
||||
free(xfixes_reply);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xwm_create_wm_window(struct wlr_xwm *xwm) {
|
||||
static const char name[] = "wlroots wm";
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
xwm->window = xcb_generate_id(xwm->xcb_conn);
|
||||
|
||||
xcb_create_window(xwm->xcb_conn,
|
||||
|
|
@ -1742,6 +1779,8 @@ static void xwm_create_wm_window(struct wlr_xwm *xwm) {
|
|||
xwm->window,
|
||||
xwm->atoms[NET_WM_CM_S0],
|
||||
XCB_CURRENT_TIME);
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
// TODO use me to support 32 bit color somehow
|
||||
|
|
@ -1750,6 +1789,8 @@ static void xwm_get_visual_and_colormap(struct wlr_xwm *xwm) {
|
|||
xcb_visualtype_iterator_t vt_iter;
|
||||
xcb_visualtype_t *visualtype;
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
d_iter = xcb_screen_allowed_depths_iterator(xwm->screen);
|
||||
visualtype = NULL;
|
||||
while (d_iter.rem > 0) {
|
||||
|
|
@ -1774,6 +1815,7 @@ static void xwm_get_visual_and_colormap(struct wlr_xwm *xwm) {
|
|||
xwm->colormap,
|
||||
xwm->screen->root,
|
||||
xwm->visual_id);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
static void xwm_get_render_format(struct wlr_xwm *xwm) {
|
||||
|
|
@ -1809,6 +1851,7 @@ static void xwm_get_render_format(struct wlr_xwm *xwm) {
|
|||
|
||||
void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
|
||||
uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y) {
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
if (!xwm->render_format_id) {
|
||||
wlr_log(WLR_ERROR, "Cannot set xwm cursor: no render format available");
|
||||
return;
|
||||
|
|
@ -1844,6 +1887,7 @@ void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
|
|||
xcb_change_window_attributes(xwm->xcb_conn, xwm->screen->root,
|
||||
XCB_CW_CURSOR, values);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
}
|
||||
|
||||
struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) {
|
||||
|
|
@ -1867,6 +1911,8 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
|
||||
#if WLR_HAS_XCB_ERRORS
|
||||
if (xcb_errors_context_new(xwm->xcb_conn, &xwm->errors_context)) {
|
||||
wlr_log(WLR_ERROR, "Could not allocate error context");
|
||||
|
|
@ -1939,6 +1985,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) {
|
|||
|
||||
xwm_create_wm_window(xwm);
|
||||
|
||||
WLR_X11_TRACE(&xwm->trace, xwm->xcb_conn);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
|
||||
return xwm;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue