From 30f5c3a9117be3e4911cba02693f7b45a197da93 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 12 Apr 2024 19:20:36 +0200 Subject: [PATCH] tree/container: ensure pixman rect is valid in container_arrange_title_bar() Fixes "Invalid rectangle passed" errors printed by Pixman. --- sway/tree/container.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sway/tree/container.c b/sway/tree/container.c index 9224b4fb..80ef34fe 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -352,6 +352,8 @@ void container_arrange_title_bar(struct sway_container *con) { int alloc_width = MIN((int)node->width, width - h_padding - config->titlebar_h_padding); + alloc_width = MAX(alloc_width, 0); + sway_text_node_set_max_width(node, alloc_width); wlr_scene_node_set_position(node->node, h_padding, (height - node->height) >> 1); @@ -376,6 +378,8 @@ void container_arrange_title_bar(struct sway_container *con) { int alloc_width = MIN((int) node->width, width - h_padding - config->titlebar_h_padding); + alloc_width = MAX(alloc_width, 0); + sway_text_node_set_max_width(node, alloc_width); wlr_scene_node_set_position(node->node, h_padding, (height - node->height) >> 1);