summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-08-11 22:20:43 -0500
committerDudemanguy <random342@airmail.cc>2023-08-13 19:58:20 +0000
commit64db68639dd56edbd0de4d3c71f75ab14f9bc135 (patch)
tree930c61f1e69af7d41f4542fccd3ac33e800edcef /video
parent4a6abff812aec8666ede396072798130b2683c9f (diff)
downloadmpv-64db68639dd56edbd0de4d3c71f75ab14f9bc135.tar.bz2
mpv-64db68639dd56edbd0de4d3c71f75ab14f9bc135.tar.xz
wayland: use fallback for display-fps/width/height
During initialization, the mpv window was not available and wayland simply just reported nothing. But this can be a nuisance and there are cases where having a values is better than nothing (vapoursynth). So if current->output isn't available yet, fallback to find_output instead. This is influenced by what is set by options like --screen and --screen-name, but we'll consider that a feature not a bug.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 49412ee46c..90d4e162e4 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -2118,16 +2118,28 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
return VO_TRUE;
}
case VOCTRL_GET_DISPLAY_FPS: {
- if (!wl->current_output)
+ struct vo_wayland_output *out;
+ if (wl->current_output) {
+ out = wl->current_output;
+ } else {
+ out = find_output(wl);
+ }
+ if (!out)
return VO_NOTAVAIL;
- *(double *)arg = wl->current_output->refresh_rate;
+ *(double *)arg = out->refresh_rate;
return VO_TRUE;
}
case VOCTRL_GET_DISPLAY_RES: {
- if (!wl->current_output)
+ struct vo_wayland_output *out;
+ if (wl->current_output) {
+ out = wl->current_output;
+ } else {
+ out = find_output(wl);
+ }
+ if (!out)
return VO_NOTAVAIL;
- ((int *)arg)[0] = wl->current_output->geometry.x1;
- ((int *)arg)[1] = wl->current_output->geometry.y1;
+ ((int *)arg)[0] = out->geometry.x1;
+ ((int *)arg)[1] = out->geometry.y1;
return VO_TRUE;
}
case VOCTRL_GET_HIDPI_SCALE: {