summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.h
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2024-04-09 11:34:15 -0500
committerDudemanguy <random342@airmail.cc>2024-04-14 17:09:31 +0000
commit895f40e150d4bf2261a96fc2586d75f998d2ac5d (patch)
treec5cef37337bd872d309d14ab9ea949d6e7e39c19 /video/out/wayland_common.h
parent367d02e971bee27940da2f8629eb2a625d5e9bb1 (diff)
downloadmpv-895f40e150d4bf2261a96fc2586d75f998d2ac5d.tar.bz2
mpv-895f40e150d4bf2261a96fc2586d75f998d2ac5d.tar.xz
wayland: only perform a rescale if window is on one output
The mpv window overlapping multiple outputs with different scale values can result in some weird behavior when dragging it from one monitor to another one. This is due to the way some compositors implement preferred_scale or preferred_buffer_scale (integer scale equivalent). Depending on the scale values, mpv window has to be resized to match the new scaling value (due to fractional scaling requiring a viewport). This can cause the window to become smaller and no longer overlap the monitor you were just trying to drag it to. Repeat this and the window will become smaller and smaller. Depending on the layout, the reverse can also happen (the window becomes larger). This can cause additional events to fire as the preferred_scale value may change again which does more weird things. It seems kwin is not affected by this because their implementation of preferred_scale sends the event only if the window is fully on the new monitor. Honestly, this is probably more logical anyway but we should at least deal with the other implementations better. Try to deal with it by reworking scaling changes so they only occur when the mpv window is fully on one monitor. If we get a preferred_scale event and there is an overlap, save it as a pending change to be performed on the next surface_enter or surface_leave event (whichever results in there being only one monitor. Some weird rendering glitches can still happen during overlap but this makes it usable again.
Diffstat (limited to 'video/out/wayland_common.h')
-rw-r--r--video/out/wayland_common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 7d1c113f3a..7a2f31918e 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -75,6 +75,7 @@ struct vo_wayland_state {
bool hidden;
bool initial_size_hint;
bool locked_size;
+ bool need_rescale;
bool reconfigured;
bool scale_configured;
bool state_change;
@@ -84,6 +85,7 @@ struct vo_wayland_state {
int mouse_x;
int mouse_y;
int pending_vo_events;
+ double pending_scaling;
double scaling;
int timeout_count;
int wakeup_pipe[2];