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
Replace GtkToolbar with GtkBox for gtk4 #5114
base: master
Are you sure you want to change the base?
Conversation
1d99d9b
to
d2bda8a
Compare
I changed every GtkToolItem into a normal Widget and adapted them to the GAction business set up in #4372. Although the GTK 4 migration guide says we should just replace GtkToolbars with GtkBoxes, this creates an issue when resizing the window and the toolbar overflows. Here is a comparison of various solutions I tried.
I'm not quite sure what a good solution would be. I could not find any Adwaita container doing to trick either, implementing our own container with a decent overflow mechanism (like in this post) looks like a hassle. Edit: added the GtkScrolledWindow video |
Did you use the "toolbox" style for the GtkBox, and checked that it has not been overriden somehow? |
I tried that, but I don't think this could influence the overflow/wrapping of children in the box. Running |
I think implementing our own version is the only satisfactory version (for gtk3). I don't know how the box behaves in gtk4. It may be that it is implemented in an expected way, because the box is supposed to replace the toolbar. If that's the case, I would just use a scrollbar (maybe hide the scrollbar itself). This is the most flexible, nice and fast solution. |
Playing with the |
We could do that for gtk3 but whatever we come up with will need important work when actually switching to gtk4 (with the GtkContainer abstract class being removed and the new LayoutManager business). Not sure it's worth it.
No it's not. I tried it out by playing with gtk4-demo 's Builder example. They set up a toolbar, add a the right css class and a bunch of buttons. Same behaviour as in Gtk3. |
I added a video with scrollbars in the post above. The looks can of course be tuned via CSS. |
0a08572
to
8dd692b
Compare
I find the GtkScrolledWindow solution quite acceptable. It has some advantages over the overflow menu (where for example we don't see the color for a menu corresponding to a color toolbar button.
|
eee72b9
to
9394f84
Compare
I can split this PR into two parts. In the first part, I'd only put the refactoring of the buttons so that
The second part would essentially contain 9394f84 If you try the version I just pushed without 9394f84, you get an overflow menu looking like this: |
ed05159
to
37989b0
Compare
5fa90bf
to
9dc83db
Compare
1c8da80
to
8ebaf15
Compare
This is an early draft, based on #4372.
Some things don't work yet, but the code base seems to be simplified quite a bit.