From a18b614a4ae4b8fa811c9ea44b5de12c80ce2365 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 7 Jun 2022 10:23:25 -0500 Subject: wayland: rearrange initialization logic cd3b4edea06dec659d9676f2649cc1b1be2e8565 is not correct and had some unexpected breakage with geometry/resizing. Rather than completely revert it, this commit restores the set_surface_scaling call as well as rearranges some other things in the wayland init/reconfig process to make it simplier. The next commit properly fixes what cd3b4edea06dec659d9676f2649cc1b1be2e8565 tried to fix. --- video/out/wayland_common.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'video/out') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index ac975982a7..865a073716 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1904,8 +1904,10 @@ int vo_wayland_init(struct vo *vo) wl->opts = mp_get_config_group(wl, wl->vo->global, &wayland_conf); wl->display_fd = wl_display_get_fd(wl->display); + wl->frame_callback = wl_surface_frame(wl->surface); wl_callback_add_listener(wl->frame_callback, &frame_listener, wl); + wl_surface_commit(wl->surface); update_app_id(wl); mp_make_wakeup_pipe(wl->wakeup_pipe); @@ -1916,7 +1918,6 @@ int vo_wayland_init(struct vo *vo) int vo_wayland_reconfig(struct vo *vo) { struct vo_wayland_state *wl = vo->wl; - bool configure = false; MP_VERBOSE(wl, "Reconfiguring!\n"); @@ -1924,16 +1925,19 @@ int vo_wayland_reconfig(struct vo *vo) wl->current_output = find_output(wl); if (!wl->current_output) return false; - wl_surface_commit(wl->surface); - configure = true; + set_surface_scaling(wl); + wl->pending_vo_events |= VO_EVENT_DPI; } set_geometry(wl); wl->window_size = wl->vdparams; - if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized) + if ((!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized) || + mp_rect_w(wl->geometry) == 0 || mp_rect_h(wl->geometry) == 0) + { wl->geometry = wl->window_size; + } if (wl->vo_opts->fullscreen) toggle_fullscreen(wl); @@ -1944,12 +1948,6 @@ int vo_wayland_reconfig(struct vo *vo) if (wl->vo_opts->window_minimized) do_minimize(wl); - if (configure) { - wl->geometry = wl->window_size; - wl_display_roundtrip(wl->display); - wl->pending_vo_events |= VO_EVENT_DPI; - } - wl->pending_vo_events |= VO_EVENT_RESIZE; return true; -- cgit v1.2.3