-
Notifications
You must be signed in to change notification settings - Fork 236
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
Add the custom UI host #111
base: develop
Are you sure you want to change the base?
Conversation
I like the idea and I'm also surprised you need only such small diff to build custom host implementation. I think there could be added some checks like |
It works, but note that at this moment I don't build with Elements's cmake, I build the source myself. When defining Cmake suggests this solution which works, link A to B and link B to A. |
You should be able to do the same. Just link target in both directions. Optionally, as the documentation says, use an object library. |
One of the important decisions I had was to make it very easy to port Elements to just about any target, by implementing only a handful of files in the "host" directory. There was a time when I seriously considered Pugl as a backend. I would very much like to directly support pugl instead of a generic "custom" target. That would mean, bringing in the whole port. Oh, and while you are at it, a bonus would be actually documenting how you did the port that we can add to the documentation currently being written. Thoughts? |
Another thought is to go back to its roots: originally, elements' base_window (nonexistent now) and base_view were abstract classes, which means that you can actually have multiple 'backends' working at the same time, by instantiating each. It was "cool" but I thought was not really practical at the time: I haven't really come across a case where a platform supports multiple 'backends',... until now. OSes (mac, windows, linux), will have their own unique backends, and so I thought... incorrectly. |
As a side note both GTK and Qt can be used under Windows and macOS, and looking at wxWidgets you have also more than a GTK version (2 and 3 AFAIK). |
GTK2 will not be supported because it does not support HiDPI. |
sorry, it was just an example to point out that other than more than one backend per platform there could be also a matter of versions of the same one, and this could lead to some choice where there should be applied some limit to avoid too many versions, if taken into account. |
Very good point! I think we should also be checking versions then. |
To bring the whole port, sure, when having some free time to dedicate for this task.
|
I see. I guess we have to take this one step at a time then. What is the view handle type that Pugl uses? Is it really void* ? If possible, I'd like to have a bit more type-safety, by possibly also specifying the actual handle type exposed as a macro that I can typedef as well. |
The My implementation keeps Pugl window data separately, which exists in a global map whose keys are window ID. At the time of implementing, I determined that I needed By no means it's a fantastic solution, but I could not find a way to do without the global. |
Alright, then we can still have a two cmake options, one for TBH, I am slowly being tempted to just make base_view and friends abstract classes. It shouldn't be to much work for me... But I am not sure if that will hide the handle type. Let me think about this some more... |
As suggested, I'm going to place this one in an experimental branch. Before I do, I just want to make sure. Is this PR still updated with the latest cmake changes and stuff? |
3c3b6d8
to
2d6f517
Compare
HI, this permits to implements another custom UI host than the 3 choices offered.
This is in particular for Linux audio plugins, in which case Gtk cannot work.
Instead I implement a custom host over the window library pugl.
However this needs some small changes in Elements, which are brought by this PR.
For reference my host is located here.
https://github.com/jpcima/sfizz/tree/editor%2Belements/editor/src/host