aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2025-02-25 10:52:52 +0100
committerAlexander Orzechowski <alex@ozal.ski>2025-02-25 09:48:40 -0500
commit8a60f30423813f9c0938e1605939db71310c7b50 (patch)
tree093e9381c82a2804ea202315e06d549d23a5e3e4
parent7fab75a7a6d9b2cccfec7741cc59c705b3c40f15 (diff)
sway_text_node: Apply max_width when rendering
max_width was applied to the source box, but not to the cairo surface. The cairo surface would therefore take on arbitrarily large dimensions according to the required dimensions to fit the text input, which if large enough would cause failures during output rendering and leave a black hole in the titlebar.
-rw-r--r--sway/sway_text_node.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/sway_text_node.c b/sway/sway_text_node.c
index 7c781355..4bc8d996 100644
--- a/sway/sway_text_node.c
+++ b/sway/sway_text_node.c
@@ -87,7 +87,7 @@ static void render_backing_buffer(struct text_buffer *buffer) {
}
float scale = buffer->scale;
- int width = ceil(buffer->props.width * scale);
+ int width = ceil(get_text_width(&buffer->props) * scale);
int height = ceil(buffer->props.height * scale);
float *color = (float *)&buffer->props.color;
float *background = (float *)&buffer->props.background;
@@ -153,7 +153,7 @@ static void render_backing_buffer(struct text_buffer *buffer) {
pixman_region32_init(&opaque);
if (background[3] == 1) {
pixman_region32_union_rect(&opaque, &opaque, 0, 0,
- buffer->props.width, buffer->props.height);
+ get_text_width(&buffer->props), buffer->props.height);
}
wlr_scene_buffer_set_opaque_region(buffer->buffer_node, &opaque);
pixman_region32_fini(&opaque);