diff options
author | Jan Ekström <jeebjp@gmail.com> | 2022-10-22 19:00:25 +0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2022-10-26 22:20:31 +0300 |
commit | e0c4193ee5c0ccc9811947f881c3e647544f81df (patch) | |
tree | 17db67894570c063d284f43fe650203a232cc322 | |
parent | f39e56bf5e482b98688909161bc5be0bdeaa82ce (diff) | |
download | mpv-e0c4193ee5c0ccc9811947f881c3e647544f81df.tar.bz2 mpv-e0c4193ee5c0ccc9811947f881c3e647544f81df.tar.xz |
video/out/wayland_common: clear decoration request even if compositor disagrees
Otherwise mpv and the compositor can end up in an eternal loop where
mpv requests one mode, and compositor tells that the mode is not
that (and will most likely not change).
Additionally, log these mismatches - first time as a warning, and
later as debug logging.
-rw-r--r-- | video/out/wayland_common.c | 24 | ||||
-rw-r--r-- | video/out/wayland_common.h | 1 |
2 files changed, 24 insertions, 1 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index eab8ec4f14..0bc48e07d7 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -948,6 +948,18 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = { #endif }; +static const char *zxdg_decoration_mode_to_str(const uint32_t mode) +{ + switch (mode) { + case ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE: + return "server-side"; + case ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE: + return "client-side"; + default: + return "<unknown>"; + } +} + static void configure_decorations(void *data, struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration, uint32_t mode) @@ -955,8 +967,18 @@ static void configure_decorations(void *data, struct vo_wayland_state *wl = data; struct mp_vo_opts *opts = wl->vo_opts; - if (wl->requested_decoration == mode) + if (wl->requested_decoration) { + if (mode != wl->requested_decoration) { + MP_MSG(wl, wl->warned_of_mismatch ? MSGL_DEBUG : MSGL_WARN, + "Requested %s decorations but compositor responded with %s\n", + zxdg_decoration_mode_to_str(wl->requested_decoration), + zxdg_decoration_mode_to_str(mode)); + + wl->warned_of_mismatch = true; + } + wl->requested_decoration = 0; + } if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) { MP_VERBOSE(wl, "Enabling server decorations\n"); diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index fdb745c5d3..60757fa1ea 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -102,6 +102,7 @@ struct vo_wayland_state { struct zxdg_decoration_manager_v1 *xdg_decoration_manager; struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration; int requested_decoration; + bool warned_of_mismatch; /* xdg-shell */ struct xdg_wm_base *wm_base; |