From cb01c63a8ddc2cac3abc3526fab1de5a68c5ba78 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 16 Apr 2024 11:39:08 +0200 Subject: [PATCH] scene: ensure layer surface usable area >0 Clients may, for example, commit an exclusive zone larger than the output dimensions. Compositors must handle this gracefully, which likely requires more work on the compositor side but returning a usable area with negative width or height in wlr_scene_layer_surface_v1_configure() is nonsensical. --- types/scene/layer_shell_v1.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/scene/layer_shell_v1.c b/types/scene/layer_shell_v1.c index 67fdda28..6f50d575 100644 --- a/types/scene/layer_shell_v1.c +++ b/types/scene/layer_shell_v1.c @@ -70,6 +70,13 @@ static void layer_surface_exclusive_zone( usable_area->width -= state->exclusive_zone + state->margin.right; break; } + + if (usable_area->width < 0) { + usable_area->width = 0; + } + if (usable_area->height < 0) { + usable_area->height = 0; + } } void wlr_scene_layer_surface_v1_configure(