summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-06-27 10:43:13 -0500
committerDudemanguy <random342@airmail.cc>2021-06-27 10:58:59 -0500
commita02901cae77c86fb9de997a418296d1fc0e3eada (patch)
tree372bc58c179be34c744851e3bff71afbc8edaeb8 /video/out/wayland_common.c
parent76bddaccd63ee60245881dc188d3e15356f093f1 (diff)
downloadmpv-a02901cae77c86fb9de997a418296d1fc0e3eada.tar.bz2
mpv-a02901cae77c86fb9de997a418296d1fc0e3eada.tar.xz
wayland: fix wl_surface_set_buffer_scale usage
The wl_surface lives for the entire lifetime of the vo. It's only neccesary to set the scale initially and when the output scaling changes (the surface moves to a different output with a different scale or the output itself changes it scale). All of the calls that were being made in the egl/vulkan resize functions are not needed. vo_wlshm wasn't correctly rescaling itself before this commit since it had no logic to handle scale changes. This should all be shared, common code in the surface/output listeners.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 3e0ed8bbec..13cdf5f2f8 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -653,6 +653,7 @@ 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) {
wl->scaling = wl->current_output->scale;
+ wl_surface_set_buffer_scale(wl->surface, wl->scaling);
spawn_cursor(wl);
set_geometry(wl);
wl->window_size = wl->vdparams;
@@ -711,6 +712,7 @@ static void surface_handle_enter(void *data, struct wl_surface *wl_surface,
if (wl->scaling != wl->current_output->scale && wl->vo_opts->hidpi_window_scale) {
double factor = (double)wl->scaling / wl->current_output->scale;
wl->scaling = wl->current_output->scale;
+ wl_surface_set_buffer_scale(wl->surface, wl->scaling);
spawn_cursor(wl);
rescale_geometry_dimensions(wl, factor);
wl->pending_vo_events |= VO_EVENT_DPI;