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
Allow gtk modifiers to be expressed as css attributes. #345
Allow gtk modifiers to be expressed as css attributes. #345
Conversation
…background modifier and added rectangle overlay (border) modifier.
Next up: allow attributes to be merged - and allow specifying something like |
I didn't know that GTK supports this. Do you think we could share any of this code with the HTML and DOM renderers? |
I'm by no means an expert, but gtk has a css based theming engine, so a user can place style sheets and icons somewhere in their home directory in order to have all of their gtk apps themed. As for sharing code with the HTML/DOM renderers, I don't think there's much to gain. With regards to performance, it would probably be better to implement a custom gtk 'style provider' rather than parsing css snippets all the time, but that also might be a bit of work, so I chose the existing css style provider for now. It makes it easy to play with the possibilities at least! :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test it, but it seems legit 👍
I wonder if we could integrate the SnapshotTesting library at some point to verify that everything is rendered as we expect? |
@mortenbekditlevsen I've sent you an invitation to the GTK Tokamak team, but it's no longer listed in the pending invitations list for some reason. Did you receive it or did it expire then? |
@MaxDesiatov Thanks! 😊 I didn't receive an email about it. |
The snapshot testing library is built to be extended and I can see in the gtk documentation that there is an offscreen window 'widget' exactly for offscreen rendering purposes. https://developer.gnome.org/gtk3/stable/GtkOffscreenWindow.html |
That makes sense. At least when rendering for it is stable enough, we should strongly consider having some tests that cover it (and that's why snapshot testing came to mind) to prevent regressions. |
Thanks, I completely missed your message about the invitation, but I just saw it and accepted. I'm currently experimenting with Shapes using a drawing area widget and importing GDK in order to get access to the drawing routines. I have a few thoughts about how to implement CGPath on non-Darwin machines - inspired by the CGPath.apply function that exposes some of the internals of CGPath. |
Excited about your progress with Feel free to merge your PRs after they're approved, you may wait for a couple days for more people to approve before you merge. But this one has been in the review queue for long enough, has already at least one approval, and seems trivial enough to be merged already 🙂 |
Excellent! And the check-labels failing check is ok? Regarding CGPath I failed to realize that SwiftUI.Path is basically the same API. But I'll try to add support for paths using path segments instead of the other storage shortcuts. |
Apply this to background modifier and added rectangle overlay (border) modifier.
I don't know if it's the best API to have to conform to both
WidgetModifier
andWidgetAttributeModifier
, but it does the trick...