-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
[MERGED] Implement experimental WinUIBackend #75
Conversation
This looks amazing! 🎉 It's very exciting how native it looks! I haven't reviewed the code changes yet but just the screenshots alone look great.
This also isn't part of the Gtk API, it's added by us (kind of a janky way to fix inheriting orientation from parent containers).
Interesting, any idea why the regular SwiftPM build system doesn't work? Had a quick poke around but couldn't find an explanation
Ah yes, that was incredibly annoying in Gtk too lol. Which may indicate that I need to rethink that part of the API to possibly pass the previous options as well as the current options, or something along those lines? Now that I think about it, similar changes could probably be made to avoid the need for |
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.
Just got a few formatting/simple changes, but for the most part it looks great! The GitHub Actions errors should go away once you fix the fileViewExampleDependencies
related issue
No idea, the only exaplanation that I found is this:
I know that they are actively contributing to Swift so maybe they need some experimental feature to make the bindings work?
Yes I think passing the previous options would make it easier, great idea. |
Please wait a bit more to merge as I just found out how to make Grid work, so I'm gonna fix some of the problem that I mentioned earlier |
|
Ah ok, sounds like it's just cause they'll often use features that haven't landed in main yet, makes sense. Probably mostly works with regular toolchains except for when they start using a new feature or something along those lines, I'll have to look into that.
Sounds good, just let me know when you're ready to merge. |
Ok so I gave another try implementig the foregroundColor but I still didn't find a solution. let style = Style(.init(name: "TextBlock", kind: .primitive))
style.setters.append(Setter(TextBlock.foregroundProperty, "Red")) I can now apply this to a text block with: widget.style = style Great now the text is red! In order to handle shared style Windows uses the concept of Resources. You can attach resources to a widget, but even if a style resource is added, those setters are not automatically executed. Because of this there is no form of cascading style like in the web. To apply the Do you have any suggestion? |
Ah very interesting, I've had a few similar issues with frameworks having opposite architectures (e.g. LVGL requires making parents before children, so I ended up making a weird lazy creation system with closures and stuff, it was kinda cool, but a bit dodgy probably). It wouldn't be great, but is it possible to traverse back down from the style container to update all of its children? |
Converted all the StackPanel into a Grid
Hi, sorry but I didn't find time last week to work on this, but I just pushed a few fixes. VStack {
Text("I should be yellow")
.foregroundColor(.yellow)
Text("I should be red")
}
.foregroundColor(.red) Since by drilling down the update I also fixed the Spacer, now it expands both horizontaly and vertically depending if it's inside a VStack or HStack, however I still ignore the values |
I'm trying to test this on my Windows laptop and I can't get Also, for the Windows build action we can probably do something similar to what swift-winrt's GitHub action does here: https://github.com/thebrowsercompany/swift-winrt/blob/main/.github/actions/windows-build/action.yml |
Don't worry about those issues that I was running into, managed to get things sorted out eventually. This is so cool! Can't wait to flesh out the AppKit backend too and essentially have write-once native-everywhere. The windowing seems a little broken but it's broken in many ways on existing platforms anyway so don't worry about that. Happy to merge once Windows CI is passing (and I can help out with sorting out the CI if needed) 👍 |
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'm gonna merge this now since Windows CI is broken due to the xz backdoor anyway (which caused the xz repo to be disabled by GitHub which in turn broke vcpkg install
for anything that depends on xz).
I had to do some weird merge conflict resolution stuff so I merged through the command line and it didn't merge the PR 😭 it mustn't have recognised the commits cause they were rebased. Sorry about that, the commits are still authored by you though. |
This pull request aims to implement a backend that relies on the native Windows Runtime. It uses the bindings provided by thebrowsercompany in order to use modern WinUI components.
As explained in this example a requirement to use this library on Windows is to use the Swift SDK provided at: thebrowsercompany/swift-build
The WinUIBackend manages to run most of the examples, but some things are still not working:
I also have doubt about the way I implemented createLayoutTransparentStack but I think it's working?
Apart from these problems all the controls element seems to be working properly so here some screenshots from my computer (dark theme, purple accent):
Let me know if you have any suggestions.