summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-29 13:16:31 +0100
committerwm4 <wm4@nowhere>2019-11-29 13:56:58 +0100
commitd37e461eab16f990751d3ab9a459cad600e3b510 (patch)
treeb8fb216faa7d7dd69fe02dd5b70222296c0347db
parent893f76045fc73fa28e36621413bcedf38225853b (diff)
downloadmpv-d37e461eab16f990751d3ab9a459cad600e3b510.tar.bz2
mpv-d37e461eab16f990751d3ab9a459cad600e3b510.tar.xz
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.
-rw-r--r--video/out/x11_common.c18
1 files changed, 18 insertions, 0 deletions
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;
}