1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:17:35 +00:00

NotificationServer: Manually calculate the text label height

The layout system can't currently answer the question "what height does
this Label want to be, if it has a certain width available?" Instead it
relies on counting newlines, which doesn't work in a lot of cases. This
made the notification windows look and behave in a funky way when their
text wraps onto multiple lines.

This patch uses TextLayout to measure how many lines we need, and then
manually sets the Label and Window heights to match. It's a bit hacky,
hence the FIXME, but it does make things behave the way they are
supposed to.
This commit is contained in:
Sam Atkins 2024-01-16 16:12:56 +00:00 committed by Tim Flynn
parent 84e8bf3421
commit 9703510682
2 changed files with 13 additions and 6 deletions

View file

@ -17,11 +17,13 @@
name: "title"
font_weight: "Bold"
text_alignment: "CenterLeft"
preferred_height: "shrink"
max_height: "shrink"
}
@GUI::Label {
name: "text"
text_alignment: "CenterLeft"
text_alignment: "TopLeft"
}
}
}