1
mirror of https://github.com/mpv-player/mpv synced 2024-09-28 17:52:52 +02:00

wayland: keep track of toplevel width/height again

Regression from 24357cb. It's ugly but unfortunately keeping tracking of
the last toplevel width and height really is the best way to solve this
problem and removing it was a mistake. Compositors don't always send
width/height coordinates of the actual window. The easiest way to
trigger this is by changing window-scale/current-window-scale and then
unfocusing the window. The compositor will send another toplevel
configure event with coordinates of the window before the resize. Maybe
compositors could be smarter but multiple ones do this (sway, gnome,
plasma), so just keep the old workaround. The only difference this time
is that the toplevel width/height is saved at the very beginning which
also covers the case where it equals 0 (i.e. weston).
This commit is contained in:
Dudemanguy 2021-08-06 11:47:16 -05:00
parent 7eb34d2376
commit 19c4ae004a
2 changed files with 9 additions and 1 deletions

View File

@ -782,6 +782,11 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
struct mp_vo_opts *vo_opts = wl->vo_opts; struct mp_vo_opts *vo_opts = wl->vo_opts;
struct mp_rect old_geometry = wl->geometry; struct mp_rect old_geometry = wl->geometry;
int old_toplevel_width = wl->toplevel_width;
int old_toplevel_height = wl->toplevel_height;
wl->toplevel_width = width;
wl->toplevel_height = height;
/* Don't do anything here if we haven't finished setting geometry. */ /* Don't do anything here if we haven't finished setting geometry. */
if (mp_rect_w(wl->geometry) == 0 || mp_rect_h(wl->geometry) == 0) if (mp_rect_w(wl->geometry) == 0 || mp_rect_h(wl->geometry) == 0)
return; return;
@ -858,7 +863,8 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
} }
} }
if (width == 0 || height == 0) if (old_toplevel_width == wl->toplevel_width &&
old_toplevel_height == wl->toplevel_height)
return; return;
if (!is_fullscreen && !is_maximized) { if (!is_fullscreen && !is_maximized) {

View File

@ -50,6 +50,8 @@ struct vo_wayland_state {
int gcd; int gcd;
int reduced_height; int reduced_height;
int reduced_width; int reduced_width;
int toplevel_width;
int toplevel_height;
/* State */ /* State */
bool activated; bool activated;