diff options
author | Simon Ser <contact@emersion.fr> | 2024-04-12 19:20:36 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-05-07 16:15:13 +0200 |
commit | 30f5c3a9117be3e4911cba02693f7b45a197da93 (patch) | |
tree | d0128a069430540082c85e48b302f03a8d466df7 | |
parent | sway_text_node: Allow 0 text width (diff) | |
download | sway-30f5c3a9117be3e4911cba02693f7b45a197da93.tar.gz sway-30f5c3a9117be3e4911cba02693f7b45a197da93.tar.zst sway-30f5c3a9117be3e4911cba02693f7b45a197da93.zip |
tree/container: ensure pixman rect is valid in container_arrange_title_bar()
Fixes "Invalid rectangle passed" errors printed by Pixman.
-rw-r--r-- | sway/tree/container.c | 4 |
1 files changed, 4 insertions, 0 deletions
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) { | |||
352 | 352 | ||
353 | int alloc_width = MIN((int)node->width, | 353 | int alloc_width = MIN((int)node->width, |
354 | width - h_padding - config->titlebar_h_padding); | 354 | width - h_padding - config->titlebar_h_padding); |
355 | alloc_width = MAX(alloc_width, 0); | ||
356 | |||
355 | sway_text_node_set_max_width(node, alloc_width); | 357 | sway_text_node_set_max_width(node, alloc_width); |
356 | wlr_scene_node_set_position(node->node, | 358 | wlr_scene_node_set_position(node->node, |
357 | h_padding, (height - node->height) >> 1); | 359 | h_padding, (height - node->height) >> 1); |
@@ -376,6 +378,8 @@ void container_arrange_title_bar(struct sway_container *con) { | |||
376 | 378 | ||
377 | int alloc_width = MIN((int) node->width, | 379 | int alloc_width = MIN((int) node->width, |
378 | width - h_padding - config->titlebar_h_padding); | 380 | width - h_padding - config->titlebar_h_padding); |
381 | alloc_width = MAX(alloc_width, 0); | ||
382 | |||
379 | sway_text_node_set_max_width(node, alloc_width); | 383 | sway_text_node_set_max_width(node, alloc_width); |
380 | wlr_scene_node_set_position(node->node, | 384 | wlr_scene_node_set_position(node->node, |
381 | h_padding, (height - node->height) >> 1); | 385 | h_padding, (height - node->height) >> 1); |