From 50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 2 Mar 2024 16:40:02 +0000 Subject: [PATCH] xwayland: add wlr_xwayland_get_xwm_connection Allows the compositors to get the xwm connection --- include/wlr/xwayland/xwayland.h | 11 +++++++++++ xwayland/xwm.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/include/wlr/xwayland/xwayland.h b/include/wlr/xwayland/xwayland.h index ff08796c..a2715c6c 100644 --- a/include/wlr/xwayland/xwayland.h +++ b/include/wlr/xwayland/xwayland.h @@ -298,4 +298,15 @@ enum wlr_xwayland_icccm_input_model wlr_xwayland_icccm_input_model( void wlr_xwayland_set_workareas(struct wlr_xwayland *wlr_xwayland, const struct wlr_box *workareas, size_t num_workareas); + +/** + * Get the XCB connection of the XWM. + * + * The connection is only valid after wlr_xwayland.events.ready, and becomes + * invalid on wlr_xwayland_server.events.destroy. In that case, NULL is + * returned. + */ +xcb_connection_t *wlr_xwayland_get_xwm_connection( + struct wlr_xwayland *wlr_xwayland); + #endif diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 6322b859..0aa33336 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -2380,3 +2380,8 @@ void wlr_xwayland_set_workareas(struct wlr_xwayland *wlr_xwayland, XCB_ATOM_CARDINAL, 32, 4 * num_workareas, data); free(data); } + +xcb_connection_t *wlr_xwayland_get_xwm_connection( + struct wlr_xwayland *wlr_xwayland) { + return wlr_xwayland->xwm ? wlr_xwayland->xwm->xcb_conn : NULL; +}