From d37e461eab16f990751d3ab9a459cad600e3b510 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Nov 2019 13:16:31 +0100 Subject: x11: add change notification for --on-all-workspaces Not particularly important and nobody asked for this, but demonstrates how such things can be easily done now. --- video/out/x11_common.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 362fd05149..217fd58aed 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -1059,6 +1059,22 @@ static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo) } } +static void vo_x11_check_net_wm_desktop_change(struct vo *vo) +{ + struct vo_x11_state *x11 = vo->x11; + + if (x11->parent) + return; + + long params[5] = {0}; + if (x11_get_property_copy(x11, x11->window, XA(x11, _NET_WM_DESKTOP), + XA_CARDINAL, 32, params, sizeof(params))) + { + x11->opts->all_workspaces = params[0] == -1; // (gets sign-extended?) + m_config_cache_write_opt(x11->opts_cache, &x11->opts->all_workspaces); + } +} + // Releasing all keys on key-up or defocus is simpler and ensures no keys can // get "stuck". static void release_all_keys(struct vo *vo) @@ -1216,6 +1232,8 @@ void vo_x11_check_events(struct vo *vo) } } else if (Event.xproperty.atom == XA(x11, _NET_WM_STATE)) { vo_x11_check_net_wm_state_fullscreen_change(vo); + } else if (Event.xproperty.atom == XA(x11, _NET_WM_DESKTOP)) { + vo_x11_check_net_wm_desktop_change(vo); } else if (Event.xproperty.atom == x11->icc_profile_property) { x11->pending_vo_events |= VO_EVENT_ICC_PROFILE_CHANGED; } -- cgit v1.2.3