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

Fix header text wrapping in sidebar #46

Merged
merged 2 commits into from
Jan 7, 2023
Merged

Fix header text wrapping in sidebar #46

merged 2 commits into from
Jan 7, 2023

Conversation

bleakgrey
Copy link
Contributor

Sometimes the text in sidebar header is wrapped even if there is room for the text. This PR expands the text box and adds a slight vertical padding to make the layout a bit more neat.

Before After
Screenshot from 2023-01-07 14-20-48 Screenshot from 2023-01-07 14-20-31

@GeopJr
Copy link
Owner

GeopJr commented Jan 7, 2023

Thanks for creating this PR!

Looks good to me, I just reverted the FIXME comment removal as it's about the (commented out) emoji label that currently looks like this:

screenshot of the tooth gtk app zoomed in the sidebar header. The user name doesn't wrap and there's many emojis overflowing the sidebar on the x axis.

@GeopJr GeopJr merged commit 079d768 into GeopJr:main Jan 7, 2023
@bleakgrey
Copy link
Contributor Author

Ah I see. Packing emojis as separate widgets in a horizontal Box doesn't seem like a good idea - this approach doesn't work with word wrapping at all.

I think I had some research on drawing custom images directly on Gtk.Label widgets using pangocairo. I never managed to make a prototype, but maybe I could try again if I find it. Would you be interested in that?

@GeopJr
Copy link
Owner

GeopJr commented Jan 7, 2023

Sure! Other alternatives I've considered are:

@bleakgrey
Copy link
Contributor Author

IMHO the former should be used in a pinch as it is not intended to be used in such quantities (GtkTextView makes more sense as a singular widget in the Composer dialog due to its rich editing capabilities).

As for the latter, webviews defeats the idea of using a native client. Besides, I can already tell that spawning a webview instance every time rich markup is expected (which is usually always and everywhere) will skyrocket the RAM usage, which is already abnormal. Might as well just use a browser 😄

Animated emojis is a valid point though. I'll see what we can do about them.

@GeopJr
Copy link
Owner

GeopJr commented Jan 7, 2023

I see, thanks for the info!

For what it's worth, Fractal uses a custom label widget with children: https://gitlab.gnome.org/GNOME/fractal/-/blob/main/src/components/label_with_widgets.rs

@bleakgrey
Copy link
Contributor Author

I absolutely love the idea of using a separate widget for each embedded image. Fractal uses Pango's shape attribute - exactly what I had in mind.

It seems to use these attributes to render custom glyphs in the Label's markup, get their pixel positions and use them for the embedded widgets. I think. Maybe. I wish I had more experience in Rust, it's mostly Greek to me :/

@bleakgrey bleakgrey deleted the sidebar-header-wrapping branch January 11, 2023 10:24
@g1bwt g1bwt mentioned this pull request Sep 27, 2024
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