free-audio / clap

Audio Plugin API
https://cleveraudio.org/
MIT License
1.78k stars 100 forks source link

GUI in Bitwig Studio doesn't work #323

Closed sadko4u closed 9 months ago

sadko4u commented 1 year ago

Hello!

I'm just trying to find out why Bitwig Studio doesn't show the CLAP version of LSP plugins. I've built the code with full debug log and see in the debug log that Bitwig creates the UI, initializes it, then calls for set_parent:

[TRC][wrap/clap.cpp: 280] ui_get_preferred_api: plugin = 0xeab5940, api=0x7ffefe75b848, is_floating=0x7ffefe75b847
[TRC][wrap/clap.cpp: 299] ui_create: plugin = 0xeab5940, api=x11, is_floating=0
[TRC][wrap/clap.cpp: 259] ui_is_api_supported: plugin = 0xeab5940, api=x11, is_floating=0
[TRC][wrap/clap.cpp: 325] ui_get_size: plugin = 0xeab5940, width=0x7ffefe75b79c, height=0x7ffefe75b798
[TRC][wrap/clap.cpp: 333] ui_can_resize: plugin = 0xeab5940
[TRC][wrap/clap.cpp: 365] ui_set_parent: plugin = 0xeab5940, window=0x7ffefe75b790 data=0xeaedd20
[TRC][wrap/clap.cpp: 369] ui_set_parent: ui_wrapper=0xeaeea40
[TRC][wrap/clap.cpp: 372] ui_set_parent: plugin = 0xeab5940, window=0x7ffefe75b790 result=true

And then... It immediately destroys the UI:

[TRC][wrap/clap.cpp: 310] ui_destroy: plugin = 0xeab5940

Related LSP ticket is here: https://github.com/sadko4u/lsp-plugins/issues/319

In REAPER DAW all is fine. Any ideas about such behaviour of Bitwig?

sadko4u commented 1 year ago

Found the reason. When Bitwig requested set_parent(), I just remembered the window handle to use it when the show() will be called to lazily instantiate the UI. But as I understand, Bitwig waited for some window being added to it's window. Because there was no window reparented to it's plugin window, it closed the UI.