aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2019-02-13 11:18:46 +0100
committeremersion <contact@emersion.fr>2019-02-15 11:08:54 +0100
commite7d9cf58152ab78cc5b231d7cf49afcb21e1f5a1 (patch)
treeb7ee4a610df15ff6e4e70bd337343b073fad2059 /xwayland/xwm.c
parent69b9e2ae8fd6ae01cf57115409960ff08cae96ad (diff)
xwm: Add _NET_CLIENT_LIST support
Fixes: https://github.com/swaywm/wlroots/issues/1469 Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'xwayland/xwm.c')
-rw-r--r--xwayland/xwm.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index fc294674..9ca2c721 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -78,6 +78,7 @@ const char *atom_map[ATOM_LAST] = {
"XdndActionCopy",
"XdndActionAsk",
"XdndActionPrivate",
+ "_NET_CLIENT_LIST",
};
static const struct wlr_surface_role xwayland_surface_role;
@@ -212,6 +213,28 @@ static void xwm_send_wm_message(struct wlr_xwayland_surface *surface,
xcb_flush(xwm->xcb_conn);
}
+static void xwm_set_net_client_list(struct wlr_xwm *xwm) {
+ size_t mapped_surfaces = 0;
+ struct wlr_xwayland_surface *surface;
+ wl_list_for_each(surface, &xwm->surfaces, link) {
+ if (surface->mapped) {
+ mapped_surfaces++;
+ }
+ }
+
+ xcb_window_t windows[mapped_surfaces + 1];
+ size_t index = 0;
+ wl_list_for_each(surface, &xwm->surfaces, link) {
+ if (surface->mapped) {
+ windows[index++] = surface->window_id;
+ }
+ }
+
+ 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);
+}
+
static void xwm_send_focus_window(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *xsurface) {
if (!xsurface) {
@@ -702,6 +725,7 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
if (!surface->mapped && wlr_surface_has_buffer(surface->surface)) {
wlr_signal_emit_safe(&surface->events.map, surface);
surface->mapped = true;
+ xwm_set_net_client_list(surface->xwm);
}
}
@@ -718,6 +742,7 @@ static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface) {
if (surface->mapped) {
wlr_signal_emit_safe(&surface->events.unmap, surface);
surface->mapped = false;
+ xwm_set_net_client_list(surface->xwm);
}
}
}
@@ -770,6 +795,7 @@ static void xsurface_unmap(struct wlr_xwayland_surface *surface) {
if (surface->mapped) {
surface->mapped = false;
wlr_signal_emit_safe(&surface->events.unmap, surface);
+ xwm_set_net_client_list(surface->xwm);
}
if (surface->surface_id) {
@@ -1712,6 +1738,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
xwm->atoms[_NET_WM_STATE_FULLSCREEN],
xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT],
xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ],
+ xwm->atoms[_NET_CLIENT_LIST],
};
xcb_change_property(xwm->xcb_conn,
XCB_PROP_MODE_REPLACE,