Closed BillyDM closed 2 years ago
Alright, I've merged the latest commit to my branch. I tested the MacOS code on both unparented and as a plugin, and they both seem to work now (except for manually closing a plugin window from the user's code since I'm not sure how to get that to work. Custom "close window" buttons aren't common in plugins anyway so it's probably not a big deal right now).
I've also renamed the HostWindowHandle
struct to ChildWindowHandle
(and HostHandle
to ParentHandle
).
I've added a method that allows the user to close the window from their code. This is fairly straightforward.
I've also added two new structs:
HostHandle
andHostWindowHandle
. These are used when opening a window in parented mode. TheHostWindowHandle
is sent back to the user (which they will use as the UI handle in baseplug), and theHostHandle
is stored internally in the baseview window.When the
HostWindowHandle
is dropped, then the window is closed automatically Also vice versa, if theHostHandle
drops unexpectedly, it will trip a flag in theHostWindowHandle
, alerting the host/parent (I'm not sure how useful the latter case is, but it was trivial to add in).I've tested the parentless version of this on Linux, Windows, and Mac. Also the parentless mode in Mac OS was broken anyway, so I've also made changes to fix that as well.
I have also tested this in a plugin context in Bitwig under Linux and Windows. This seems to fix an issue I was having before with the window not opening again after being closed.
Although I have not tested the plugin context in Mac yet since I can't seem to get baseplug working for some reason.