mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 08:37:59 +00:00
wayland_common: guard against negative configure sizes
Negative values are nonsense to mpv, and can cause protocol error afterwards, like xdg_surface::set_window_geometry which doesn't accept negative values. Treat any negative values as zero (client determines size) for now.
This commit is contained in:
parent
92d1e9cd8a
commit
146bef059a
@ -890,6 +890,11 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
|
||||
struct mp_vo_opts *vo_opts = wl->vo_opts;
|
||||
struct mp_rect old_geometry = wl->geometry;
|
||||
|
||||
if (width < 0 || height < 0) {
|
||||
MP_WARN(wl, "Compositor sent negative width/height values. Treating them as zero.\n");
|
||||
width = height = 0;
|
||||
}
|
||||
|
||||
int old_toplevel_width = wl->toplevel_width;
|
||||
int old_toplevel_height = wl->toplevel_height;
|
||||
wl->toplevel_width = width;
|
||||
|
Loading…
Reference in New Issue
Block a user