summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-04-12 13:53:10 -0500
committerDudemanguy <random342@airmail.cc>2021-04-12 14:09:28 -0500
commit74f5d4940e38799cb92319e89c030195c5d4fe54 (patch)
tree187d7403037c61dc0a4c2d38d684621baa32031c
parentf1d0365a6f72b88f7427814f636863ae1656f72a (diff)
downloadmpv-74f5d4940e38799cb92319e89c030195c5d4fe54.tar.bz2
mpv-74f5d4940e38799cb92319e89c030195c5d4fe54.tar.xz
wayland: support the display-hidpi-scale property
So apparently this property had existed since 2019. Internally, it's used as a part of the console.lua script for scaling. Yours truly somehow didn't bat an eye at the fact that the text in the console was super small (made worse by the fact that xwayland does scale) and just ignored it for all this time. Oh well. To report dpi changes to mpv's core, we need to use VO_EVENT_DPI in a couple of places. One place is, of course, the surface listener if the scale value reported by the wayland server changes. The other place is in the very first reconfig since mpv's core will not find the correct scale value until we actually get a wl_output from the wayland server.
-rw-r--r--video/out/wayland_common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 7d9dc5f99e..47ad42dec3 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -873,6 +873,7 @@ static void surface_handle_enter(void *data, struct wl_surface *wl_surface,
double factor = (double)wl->scaling / wl->current_output->scale;
wl->scaling = wl->current_output->scale;
rescale_geometry_dimensions(wl, factor);
+ wl->pending_vo_events |= VO_EVENT_DPI;
}
if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized)
@@ -1570,6 +1571,7 @@ int vo_wayland_reconfig(struct vo *vo)
wl->window_size = wl->vdparams;
wl->geometry = wl->window_size;
wl_display_roundtrip(wl->display);
+ wl->pending_vo_events |= VO_EVENT_DPI;
}
wl->pending_vo_events |= VO_EVENT_RESIZE;
@@ -1730,6 +1732,12 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
*(double *)arg = wl->current_output->refresh_rate;
return VO_TRUE;
}
+ case VOCTRL_GET_HIDPI_SCALE: {
+ if (!wl->scaling)
+ return VO_NOTAVAIL;
+ *(double *)arg = wl->scaling;
+ return VO_TRUE;
+ }
case VOCTRL_UPDATE_WINDOW_TITLE:
return update_window_title(wl, (const char *)arg);
case VOCTRL_SET_CURSOR_VISIBILITY: