summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-01-26 14:21:58 -0600
committerDudemanguy <random342@airmail.cc>2023-01-30 03:59:40 +0000
commitda81a6d5322f6fd1665d06f72dba2a809bfa240b (patch)
tree17c24417646211598ad36d2e0484db1070be1e36 /video/out
parentadc04dbba042a4119a5ec59adf4d839dbf33128f (diff)
downloadmpv-da81a6d5322f6fd1665d06f72dba2a809bfa240b.tar.bz2
mpv-da81a6d5322f6fd1665d06f72dba2a809bfa240b.tar.xz
wayland: add auto choice to wayland-configure-bounds
Previously, this defaulted to yes and configure-bounds from the compositor would always apply. In the case where the user explicitly set autofit or geometry, this could be confusing because configure-bounds would take precedence over it. Instead, let's add an auto choice and make that the default. If we detect that the option is on auto and that there is autofit/geometry being set, then ignore the event. This should be more intuitive since someone who bothers to explicitly set mpv's geometry would naturally expect that geometry to actually apply.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/wayland_common.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 59ce2e940b..b1631cbb20 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -131,7 +131,8 @@ static const struct mp_keymap keymap[] = {
#define OPT_BASE_STRUCT struct wayland_opts
const struct m_sub_options wayland_conf = {
.opts = (const struct m_option[]) {
- {"wayland-configure-bounds", OPT_FLAG(configure_bounds)},
+ {"wayland-configure-bounds", OPT_CHOICE(configure_bounds,
+ {"auto", -1}, {"no", 0}, {"yes", 1})},
{"wayland-disable-vsync", OPT_FLAG(disable_vsync)},
{"wayland-edge-pixels-pointer", OPT_INT(edge_pixels_pointer),
M_RANGE(0, INT_MAX)},
@@ -141,7 +142,7 @@ const struct m_sub_options wayland_conf = {
},
.size = sizeof(struct wayland_opts),
.defaults = &(struct wayland_opts) {
- .configure_bounds = true,
+ .configure_bounds = -1,
.disable_vsync = false,
.edge_pixels_pointer = 10,
.edge_pixels_touch = 32,
@@ -1706,6 +1707,15 @@ static void set_surface_scaling(struct vo_wayland_state *wl)
static void set_window_bounds(struct vo_wayland_state *wl)
{
+ // If the user has set geometry/autofit and the option is auto,
+ // don't use these.
+ if (wl->opts->configure_bounds == -1 && (wl->vo_opts->geometry.wh_valid ||
+ wl->vo_opts->autofit.wh_valid || wl->vo_opts->autofit_larger.wh_valid ||
+ wl->vo_opts->autofit_smaller.wh_valid))
+ {
+ return;
+ }
+
if (wl->bounded_width && wl->bounded_width < wl->window_size.x1)
wl->window_size.x1 = wl->bounded_width;
if (wl->bounded_height && wl->bounded_height < wl->window_size.y1)