summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-06-07 10:23:25 -0500
committerDudemanguy <random342@airmail.cc>2022-06-07 17:13:45 +0000
commita18b614a4ae4b8fa811c9ea44b5de12c80ce2365 (patch)
tree882128e5a459b4a2f662537b9e048dfcf4b797a2 /video/out
parenta4f0db051abf5eb34497437fa991a5da694e45f8 (diff)
downloadmpv-a18b614a4ae4b8fa811c9ea44b5de12c80ce2365.tar.bz2
mpv-a18b614a4ae4b8fa811c9ea44b5de12c80ce2365.tar.xz
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.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/wayland_common.c18
1 files changed, 8 insertions, 10 deletions
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;