summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-07-17 14:14:36 -0500
committerDudemanguy <random342@airmail.cc>2023-07-19 01:14:32 +0000
commite3992664008c6d37012e968e2656a38edd8aa151 (patch)
treecb2a3ff401d1302f1291982944b93b1f40983d20 /video/out/wayland_common.c
parent949e1f0dcc9d4fc9b15212dea981e00248c562f1 (diff)
downloadmpv-e3992664008c6d37012e968e2656a38edd8aa151.tar.bz2
mpv-e3992664008c6d37012e968e2656a38edd8aa151.tar.xz
wayland: don't treat tiled and maximized windows the same
mpv has historically always treated the various tiled states in xdg-shell as maximized (probably because it was easier). Well it turns out that there are some tiling compositors (hyprland) that allow tiled windows to maximize themselves. This can lead to some scenarios where mpv ends up doing a maximize on hyprland which actually works since it's not a no-op like on sway. Fix this by separating out the tiled state from maximize. It works mostly the same, but the main difference is that there's no request to tile yourself like there is with maximize. Should fix #11954.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 305f65727f..cd06009635 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -890,6 +890,7 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
bool is_fullscreen = false;
bool is_activated = false;
bool is_suspended = false;
+ bool is_tiled = false;
enum xdg_toplevel_state *state;
wl_array_for_each(state, states) {
switch (*state) {
@@ -913,6 +914,8 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
case XDG_TOPLEVEL_STATE_TILED_LEFT:
case XDG_TOPLEVEL_STATE_TILED_RIGHT:
case XDG_TOPLEVEL_STATE_TILED_BOTTOM:
+ is_tiled = true;
+ break;
case XDG_TOPLEVEL_STATE_MAXIMIZED:
is_maximized = true;
break;
@@ -937,7 +940,9 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->window_maximized);
}
- wl->locked_size = is_fullscreen || is_maximized;
+ wl->tiled = is_tiled;
+
+ wl->locked_size = is_fullscreen || is_maximized || is_tiled;
if (wl->requested_decoration)
request_decoration_mode(wl, wl->requested_decoration);
@@ -2091,7 +2096,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
}
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
int *s = arg;
- if (wl->vo_opts->window_maximized) {
+ if (wl->vo_opts->window_maximized || wl->tiled) {
s[0] = mp_rect_w(wl->geometry);
s[1] = mp_rect_h(wl->geometry);
} else {
@@ -2106,7 +2111,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
wl->window_size.y0 = 0;
wl->window_size.x1 = s[0];
wl->window_size.y1 = s[1];
- if (!wl->vo_opts->fullscreen) {
+ if (!wl->vo_opts->fullscreen && !wl->tiled) {
if (wl->vo_opts->window_maximized) {
xdg_toplevel_unset_maximized(wl->xdg_toplevel);
wl_display_dispatch_pending(wl->display);