Replace GTK Widgets with Custom Widgets to Help with Upgrade to GTK4#325
Draft
Lepidopteran wants to merge 9 commits intotauri-apps:feat/gtk4from
Draft
Replace GTK Widgets with Custom Widgets to Help with Upgrade to GTK4#325Lepidopteran wants to merge 9 commits intotauri-apps:feat/gtk4from
Lepidopteran wants to merge 9 commits intotauri-apps:feat/gtk4from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After messing around with
gtk4-rsto see if we could get icons on thePopoverMenuBarandPopoverMenu, I had no luck.After researching and looking at the
gtksource code, I made a discovery:while
GtkPopverMenudoes watch for aniconattribute on anGMenuItemit does not display it if has a text with it.Additionally from what I could find,
GtkPopoverMenuBardoesn't even look for icon.So that leads me to the conclusion in order to keep icon support, we have to create custom widget versions of
GtkPopverMenuandGtkPopoverMenuBar.So far I've gotten moderate success with recreating
GtkPopoverMenuBarexample below.I've done this before for creating a custom font family chooser dropdown, it's not necessarily easy but it is doable from my experience.
I've gathered some source files and how it looks like they are structured if anyone is interested in helping:
gtkpopovermenubar.cgtkpopovermenu.cgtkmenusectionbox.cgtkmodelbutton.cgtkmenutracker.cgtkmenutrackeritem.cAdditionally I'd like to get
separatorsworking again, possibly creating a custom object that extendsGMenuModelso we can control how the menus are built but I haven't tested that yet.I currently haven't touched anything about the
gtkback-end so I've marked this as draft request, but the end goal is to use the custom widgets for said back-end.I personally don't see the need for icons for menu bars but I'm not okay with limiting developers.
I've also made an example to test the compatibility between the
gtk4widgets and the custom widgets, you can run it using the following:Tasks
gtkback-end with newly created widgets.MenuBarwidgetGMenuModelPopoverMenuwidget.mudacan use itFinal Thoughts
Helps with #270, #259, and #272
Please let me know if what I'm doing is unwanted or if you have any feedback!