From 4e4252f9169edc00c747ffc66fe0b627bbca7ba7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Nov 2019 12:50:50 +0100 Subject: x11: use new option stuff to implement fullscreen - remove VOCTRL_FULLSCREEN and VOCTRL_GET_FULLSCREEN - have your own m_config_cache for the fullscreen option (vo->opts_cache cannot be used because you lose per-option change notifications, and it'd be a mess anyway) - use VOCTRL_VO_OPTS_CHANGED to update it (it's used for convenience) - when updating it, check for the fullscreen option (wasn't sure how to do it best; currently, it compares the raw option pointers, but this could be changed) - do not send VO_EVENT_FULLSCREEN_STATE on FS change - instead write the option on FS change (assign in opt. struct + m_config_cache_write_opt) --- video/out/x11_common.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'video/out/x11_common.c') diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 24c05bb63d..9f44af23cd 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -562,8 +562,9 @@ int vo_x11_init(struct vo *vo) .xrandr_event = -1, .wakeup_pipe = {-1, -1}, .dpi_scale = 1, - .opts = vo->opts, + .opts_cache = m_config_cache_alloc(x11, vo->global, &vo_sub_opts), }; + x11->opts = x11->opts_cache->opts; vo->x11 = x11; sem_init(&x11->screensaver_sem, 0, 0); @@ -1040,7 +1041,7 @@ static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo) { x11->opts->fullscreen = is_fullscreen; x11->fs = is_fullscreen; - x11->pending_vo_events |= VO_EVENT_FULLSCREEN_STATE; + m_config_cache_write_opt(x11->opts_cache, &x11->opts->fullscreen); if (!is_fullscreen && (x11->pos_changed_during_fs || x11->size_changed_during_fs)) @@ -1214,7 +1215,6 @@ void vo_x11_check_events(struct vo *vo) x11->pseudo_mapped = true; } } else if (Event.xproperty.atom == XA(x11, _NET_WM_STATE)) { - x11->pending_vo_events |= VO_EVENT_WIN_STATE; vo_x11_check_net_wm_state_fullscreen_change(vo); } else if (Event.xproperty.atom == x11->icc_profile_property) { x11->pending_vo_events |= VO_EVENT_ICC_PROFILE_CHANGED; @@ -1820,12 +1820,14 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) *events |= x11->pending_vo_events; x11->pending_vo_events = 0; return VO_TRUE; - case VOCTRL_FULLSCREEN: - vo_x11_fullscreen(vo); - return VO_TRUE; - case VOCTRL_GET_FULLSCREEN: - *(int *)arg = x11->fs; + case VOCTRL_VO_OPTS_CHANGED: { + void *opt; + while (m_config_cache_get_next_changed(x11->opts_cache, &opt)) { + if (opt == &opts->fullscreen) + vo_x11_fullscreen(vo); + } return VO_TRUE; + } case VOCTRL_ONTOP: vo_x11_setlayer(vo, opts->ontop); return VO_TRUE; -- cgit v1.2.3