summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2022-10-22 12:50:18 +0300
committerJan Ekström <jeebjp@gmail.com>2022-10-26 22:20:31 +0300
commit2c58ab481be47159e2b412bdd34b5155a6a768a6 (patch)
tree7e62c8094e9aa81df1fa536507ccf0e12c309713
parentc9af75e888c8ad7b534a03631bc4a76a2f59603c (diff)
downloadmpv-2c58ab481be47159e2b412bdd34b5155a6a768a6.tar.bz2
mpv-2c58ab481be47159e2b412bdd34b5155a6a768a6.tar.xz
video/out/wayland_common: make decoration state usage explicit
It is verbose, but makes it more explicit that requested_decoration takes in three values: * 0: no specific mode requested by mpv * ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE: (!border) * ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE: (border)
-rw-r--r--video/out/wayland_common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 9c8dd1a6a1..3af223fae4 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -963,7 +963,7 @@ static void configure_decorations(void *data,
} else {
MP_VERBOSE(wl, "Disabling server decorations\n");
}
- opts->border = mode - 1;
+ opts->border = mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
m_config_cache_write_opt(wl->vo_opts_cache, &opts->border);
}
@@ -1760,7 +1760,10 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
opts->border = !opts->border;
m_config_cache_write_opt(wl->vo_opts_cache,
&opts->border);
- request_decoration_mode(wl, !opts->border + 1);
+ request_decoration_mode(
+ wl, !opts->border ?
+ ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE :
+ ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
} else {
opts->border = false;
m_config_cache_write_opt(wl->vo_opts_cache,
@@ -1943,7 +1946,10 @@ int vo_wayland_init(struct vo *vo)
if (wl->xdg_decoration_manager) {
wl->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(wl->xdg_decoration_manager, wl->xdg_toplevel);
zxdg_toplevel_decoration_v1_add_listener(wl->xdg_toplevel_decoration, &decoration_listener, wl);
- request_decoration_mode(wl, wl->vo_opts->border + 1);
+ request_decoration_mode(
+ wl, wl->vo_opts->border ?
+ ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE :
+ ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
} else {
wl->vo_opts->border = false;
m_config_cache_write_opt(wl->vo_opts_cache,