-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Expose TokamakCore as a library (for GTK renderer) #306
Expose TokamakCore as a library (for GTK renderer) #306
Conversation
… external dependency
My main worry about making Would you be interested in submitting your GTK renderer as a PR to this repository directly? I'm not sure other maintainers would directly contribute to it, but at least with working CI we'd make efforts not to break this new renderer when changes are made to |
I think putting the Renderer in the repo is the best choice here. I also have a working but unfinished GTK wrapper, and that’s how I did it, but would be very interested to see your implementation and possibly contribute. |
Hi @MaxDesiatov and @carson-katri , |
I added a screenshot to a topic on swift evolution if you’d like to see how it looks currently: |
Thank you so much, this is amazing work! 👏 |
Awesome, glad to see others getting involved in making renderers! I just uploaded my implementation to my fork if you wanted to take a look at how I approached it. I didn't use |
Hi @carson-katri , I agree that it is definitely the best strategy to use GTK directly instead of pulling in an extra dependency. I attempted changing the Package.swift and TokamakShims to work on macOS too - and fixed some extraneous flags generated by pkg-config that caused an error.
I guess that the issue isn't actually with the _phasePublisher. That looks alright, so the problem is likely something else. I am using the swift version bundled in Xcode-12.2:
I think that I can get the project building without using the TokamakGTKCHelpers, since the macros it uses expand to simple c function calls (when not compiled with gcc). I haven't checked if the casts I perform work, however, since I can't get the full project to compile. If the c helpers can be skipped then I assume that the makefile is not necessary, right? It's a shame spm can't use pkg-config for non-system-library targets - it would make sense to allow it for something like the c helpers, it seems... I think I'll park my own experiments with the extra But it was a lot of fun too! You have done an excellent job at abstracting out the renderer so it was quite easy to get started. Your renderer implementation guide is excellent too - and was very helpful to get started. |
Hi @carson-katri , |
I haven’t looked into it yet but maybe it’s using OpenCombine instead of native Combine (via the shim) on macOS? I’ll see if I can get it working this weekend if that doesn’t help... |
The updated code is on my fork, lmk if you have any problems @mortenbekditlevsen |
Thanks so much! |
Hi @carson-katri , I started playing with it and experienced a crash - the closureboxes were released immediately in the handler, but the reference to them outlived the lifetime of the handler. As I gather from the GTK documentation, the correct place to release them is in the 'destroy_handler' |
I also experimented with removing the TokamakGTKCHelpers dependency entirely - as well as the functionality in GtkContainer+forEach.swift, since it currently appears to be unused.
so I guess that is related. |
Thanks again for all your continued work on this! I would very much like to see this in the main Tokamak repository. Please feel free to submit PRs here, they don't have to have everything working at once. I'd be happy to review separate small PRs that introduce an empty GTK renderer module, and then making that work and fixing bugs bit by bit. I know that maintaining forks is hard, so having that work here would help you avoid big merge conflicts that are difficult to resolve later. |
Hi @MaxDesiatov , |
This was addressed to both of you 🙂 @carson-katri are you currently busy with #316? If so, would you mind if in the meantime I create a few PRs that merge GTK-related commits from your fork into this repo? |
Yeah, that'd be good 👍 |
Do any of you get I've also tried
but that doesn't work... |
Ok, I need |
I have only made it build and run using the Makefile which runs pkgconf to get the compiler and linker flags. |
As far as I understand, |
Excellent, that would explain it. I'll see if I can find a bug tracking that issue. |
Closing as superseded by #333. |
Based on the work discussed in #306. * TokamakGTK implementation * Fix macOS GTK Renderer impl * Always release text in Picker. Use 'destroy_data' parameter to release closure boxes in GSignal.swift * Revert commenting out this code * Specify the product explicitly in Makefile * Add GTK renderer build for macOS on CI * Prevent xcodebuild from seeing GTK code Co-authored-by: Carson Katri <carson.katri@gmail.com> Co-authored-by: Morten Bek Ditlevsen <morten@ka-ching.dk>
Expose TokamakCore as a library so that it can be used directly as an external dependency.
I tried building a GTK wrapper using TokamakCore and lack the possibility of referencing the library directly.