From 36e7a672c7b4374b0d672256321b9c450ce12010 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 28 Jul 2023 14:30:31 +0200 Subject: xwayland: batch client ID request with other property requests --- xwayland/xwm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'xwayland') diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 6f1a0a2f..0ea4f895 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -595,14 +595,8 @@ static void read_surface_parent(struct wlr_xwm *xwm, } static void read_surface_client_id(struct wlr_xwm *xwm, - struct wlr_xwayland_surface *xsurface) { - xcb_res_client_id_spec_t spec = { - .client = xsurface->window_id, - .mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID - }; - - xcb_res_query_client_ids_cookie_t cookie = xcb_res_query_client_ids( - xwm->xcb_conn, 1, &spec); + struct wlr_xwayland_surface *xsurface, + xcb_res_query_client_ids_cookie_t cookie) { xcb_res_query_client_ids_reply_t *reply = xcb_res_query_client_ids_reply( xwm->xcb_conn, cookie, NULL); if (reply == NULL) { @@ -940,6 +934,15 @@ static void xwayland_surface_associate(struct wlr_xwm *xwm, props[i], XCB_ATOM_ANY, 0, 2048); } + xcb_res_query_client_ids_cookie_t client_id_cookie; + if (xwm->xres) { + xcb_res_client_id_spec_t spec = { + .client = xsurface->window_id, + .mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID + }; + client_id_cookie = xcb_res_query_client_ids(xwm->xcb_conn, 1, &spec); + } + for (size_t i = 0; i < sizeof(props) / sizeof(props[0]); i++) { xcb_get_property_reply_t *reply = xcb_get_property_reply(xwm->xcb_conn, cookies[i], NULL); @@ -952,7 +955,7 @@ static void xwayland_surface_associate(struct wlr_xwm *xwm, } if (xwm->xres) { - read_surface_client_id(xwm, xsurface); + read_surface_client_id(xwm, xsurface, client_id_cookie); } wl_signal_emit_mutable(&xsurface->events.associate, NULL); -- cgit v1.2.3