From f5d545c9174216339defc222e54d419d631f5805 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Mon, 8 Nov 2021 09:44:22 -0600 Subject: [PATCH] wayland: remove bogus scale_change variable This was originally added in f2afae55e95b4b1eec1aeb828ba6ff1f0695d993 for unclear reasons (way to go me). This concept is clearly incorrect. It doesn't matter what state the window is in. As soon as mpv detects a scale change, it needs to reset the buffer scale of the window. Just remove all this junk and put wl_surface_set_buffer_scale in set_surface_scaling like it should be. Related issue: #9426. --- video/out/wayland_common.c | 24 +----------------------- video/out/wayland_common.h | 1 - 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 72bacad15d..2a3cb8a57e 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -646,11 +646,6 @@ static void output_handle_done(void* data, struct wl_output *wl_output) * geometry and scaling should be recalculated. */ if (wl->current_output && wl->current_output->output == wl_output) { set_surface_scaling(wl); - if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized) { - wl_surface_set_buffer_scale(wl->surface, wl->scaling); - } else { - wl->scale_change = true; - } spawn_cursor(wl); set_geometry(wl); wl->window_size = wl->vdparams; @@ -702,11 +697,6 @@ static void surface_handle_enter(void *data, struct wl_surface *wl_surface, if (wl->scaling != wl->current_output->scale) { set_surface_scaling(wl); - if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized) { - wl->scale_change = true; - } else { - wl_surface_set_buffer_scale(wl->surface, wl->scaling); - } spawn_cursor(wl); wl->pending_vo_events |= VO_EVENT_DPI; } @@ -846,11 +836,6 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, } } - if (wl->scale_change) { - wl_surface_set_buffer_scale(wl->surface, wl->scaling); - wl->scale_change = false; - } - if (wl->state_change) { if (!is_fullscreen && !is_maximized) { wl->geometry = wl->window_size; @@ -1419,6 +1404,7 @@ static void set_surface_scaling(struct vo_wayland_state *wl) wl->vdparams.y1 *= factor; wl->window_size.x1 *= factor; wl->window_size.y1 *= factor; + wl_surface_set_buffer_scale(wl->surface, wl->scaling); } static int spawn_cursor(struct vo_wayland_state *wl) @@ -1583,14 +1569,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) if (opt == &opts->fullscreen) toggle_fullscreen(wl); if (opt == &opts->hidpi_window_scale) - { set_surface_scaling(wl); - if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized) { - wl_surface_set_buffer_scale(wl->surface, wl->scaling); - } else { - wl->scale_change = true; - } - } if (opt == &opts->window_maximized) toggle_maximized(wl); if (opt == &opts->window_minimized) @@ -1789,7 +1768,6 @@ int vo_wayland_reconfig(struct vo *vo) if (!wl->current_output) return false; set_surface_scaling(wl); - wl_surface_set_buffer_scale(wl->surface, wl->scaling); wl_surface_commit(wl->surface); configure = true; } diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 8e9795fccf..14b5fdce09 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -59,7 +59,6 @@ struct vo_wayland_state { bool focused; bool frame_wait; bool hidden; - bool scale_change; bool state_change; bool toplevel_configured; int display_fd;