1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-19 05:41:16 +00:00

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.
This commit is contained in:
Dudemanguy 2022-06-07 10:23:25 -05:00
parent a4f0db051a
commit a18b614a4a

View File

@ -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;