From 374c6aff7b1a005d78f31d00fc12e714976fb7bb Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Wed, 12 Feb 2020 19:20:03 -0600 Subject: wayland: fix autofit and rotating issues Fixes #7441. Just set screenrc to be equal to current_output's geometry. Also remove some pointless/extra variables and print a warning/fallback to screen 0 if a bad id is passed to --fs-screen. --- video/out/wayland_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index d42758a7bc..fc165ea7ce 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1272,8 +1272,6 @@ static struct vo_wayland_output *find_output(struct vo_wayland_state *wl, int in int vo_wayland_reconfig(struct vo *vo) { - struct wl_output *wl_out = NULL; - struct mp_rect screenrc = { 0 }; struct vo_wayland_state *wl = vo->wl; MP_VERBOSE(wl, "Reconfiguring!\n"); @@ -1283,19 +1281,23 @@ int vo_wayland_reconfig(struct vo *vo) if (wl->vo_opts->fullscreen && (wl->vo_opts->fsscreen_id >= 0)) idx = wl->vo_opts->fsscreen_id; struct vo_wayland_output *out = find_output(wl, idx); + if (!out) { + MP_WARN(wl, "Screen index %i not found/unavailable! Falling back to screen 0!\n", idx); + out = find_output(wl, 0); + } if (!out) { MP_ERR(wl, "Screen index %i not found/unavailable!\n", idx); + return false; } else { - wl_out = out->output; wl->current_output = out; if (!wl->vo_opts->hidpi_window_scale) out->scale = 1; wl->scaling = out->scale; - screenrc = wl->current_output->geometry; } } struct vo_win_geometry geo; + struct mp_rect screenrc = wl->current_output->geometry; vo_calc_window_geometry(vo, &screenrc, &geo); vo_apply_window_geometry(vo, &geo); @@ -1320,7 +1322,7 @@ int vo_wayland_reconfig(struct vo *vo) if (wl->vo_opts->fsscreen_id < 0) { xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL); } else { - xdg_toplevel_set_fullscreen(wl->xdg_toplevel, wl_out); + xdg_toplevel_set_fullscreen(wl->xdg_toplevel, wl->current_output->output); } } -- cgit v1.2.3