Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid measuring labels width-for-height #1299

Merged
merged 1 commit into from
Dec 28, 2024
Merged

Conversation

bugaevc
Copy link
Contributor

@bugaevc bugaevc commented Dec 28, 2024

These were the remaining places in Tuba where labels were still being measured width-for-height (at least, on my timeline right now), and with these simple changes, we seem to get rid of them too. See the commit message.

There are likely some more small things here and there; for instance I saw a similarly start-aligned wrappable "By %s" button. That should be avoidable using the same valign=center trick.

Mark the wrappable label hexpand, and use xalign to align the text to
the left -- this is just like what spoiler_label_rev already does. This
now hits the fast path introduced in https://gitlab.gnome.org/GNOME/gtk/-/commit/4150f2d3d255b90d4c28bb08d186153a97a3d3fb,
avoiding measuring the label width-for-height.

The header_button ("%s boosted", "in reply to %s") already has halign
set to start. Also give it valign of center. This should not change
anything about the resulting layout at all, since the label is always
allocated exactly its natural height (same as minimum height), but since
https://gitlab.gnome.org/GNOME/gtk/-/commit/16911e183ca12c441bc6bbbb650f63e25f02016e
GTK will in this case horizontally align for the overall natural width
rather than for the natural width for allocated height; thus we avoid
measuring the label width-for-height. But note that this is not in any
way a guarantee, we just exploit a specific aspect of GTK behavior here.

Signed-off-by: Sergey Bugaev <[email protected]>
@GeopJr
Copy link
Owner

GeopJr commented Dec 28, 2024

LGTM, thanks!

@GeopJr GeopJr merged commit 316ec29 into GeopJr:main Dec 28, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants