Skip to content

Commit

Permalink
wayland: remove old sway/wlroots hack
Browse files Browse the repository at this point in the history
It's actually been like this for years, but wlroots doesn't keep track
of resizes a client does independent of the compositor. When using sway,
this leads to weird behavior with floating clients resizing themselves
back to the old size if you unfocus it. mpv has been working around this
for a long time, but it's really annoying to selectively ignore events
based on a weird heuristic. Since Sway finally fixed this bug, let's go
ahead and drop this crap. Note that other wlroots compositors may
possibly experience a regression if they didn't correct for this like
sway does, but it's for their own good.
  • Loading branch information
Dudemanguy committed Feb 26, 2024
1 parent 4375a26 commit 76472e1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
9 changes: 0 additions & 9 deletions video/out/wayland_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,11 +1040,6 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
width = height = 0;
}

int old_toplevel_width = wl->toplevel_width;
int old_toplevel_height = wl->toplevel_height;
wl->toplevel_width = width;
wl->toplevel_height = height;

if (!wl->configured) {
/* Save initial window size if the compositor gives us a hint here. */
bool autofit_or_geometry = vo_opts->geometry.wh_valid || vo_opts->autofit.wh_valid ||
Expand Down Expand Up @@ -1144,10 +1139,6 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
goto resize;
}

if (old_toplevel_width == wl->toplevel_width &&
old_toplevel_height == wl->toplevel_height)
return;

if (!wl->locked_size) {
if (vo_opts->keepaspect) {
double scale_factor = (double)width / wl->reduced_width;
Expand Down
2 changes: 0 additions & 2 deletions video/out/wayland_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ struct vo_wayland_state {
int bounded_width;
int reduced_height;
int reduced_width;
int toplevel_width;
int toplevel_height;

/* State */
bool activated;
Expand Down

0 comments on commit 76472e1

Please sign in to comment.