From 353e4efdefca0fe118f5717783bf7e1df3592620 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Tue, 3 Dec 2019 21:48:06 +0800 Subject: osc: rework window control configuration to add auto mode To aid in discoverability, and to address the most common case directly, I'm adding an 'auto' mode for the window controls. In this case, we will show the controls if there is no window border and hide them if there are borders. This also respects the option being toggled at runtime. To ensure that it works in the wayland case, I've also made sure that the wayland code explicitly forces the option to false if decoration support is missing. Based on feedback, I've split the config in two, with one option for whether controls are active, and one for alignment. These are new enough that we can get away with ignoring compatibility. --- video/out/wayland_common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'video/out/wayland_common.c') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index cbc7d63d31..dd20432394 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1047,8 +1047,12 @@ static int create_xdg_surface(struct vo_wayland_state *wl) static int set_border_decorations(struct vo_wayland_state *wl, int state) { - if (!wl->xdg_toplevel_decoration) + if (!wl->xdg_toplevel_decoration) { + wl->vo_opts->border = false; + m_config_cache_write_opt(wl->vo_opts_cache, + &wl->vo_opts->border); return VO_NOTIMPL; + } enum zxdg_toplevel_decoration_v1_mode mode; if (state) { @@ -1131,6 +1135,9 @@ int vo_wayland_init(struct vo *vo) wl->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(wl->xdg_decoration_manager, wl->xdg_toplevel); set_border_decorations(wl, wl->vo_opts->border); } else { + wl->vo_opts->border = false; + m_config_cache_write_opt(wl->vo_opts_cache, + &wl->vo_opts->border); MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n", zxdg_decoration_manager_v1_interface.name); } -- cgit v1.2.3