You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice that there is provision regarding UI Scale in the headers clap_plugin_gui->set_scale()
However, there are a couple of points that I'm unclear on (or perhaps misunderstanding).
Scale is not called on floating windows. I presume this is because they are independent of the host, but it could be beneficial for them to know the scaling that the host is using.
Scale is set after clap_plugin_gui->create() is called. This means that the create should not layout any elements until the scale has been set (or get_size() is called) and their layout and size will be unknown until scale is given (unless an additional re-layout is wanted). I realise that layout/sizing may want to be within a more dynamic nature, for plugins that scale on re-size. However, for any wanting to initialise with a default resolution, knowing the scale up-front could be useful.
This works kind of analogously to VST3, but with all function pointers on the GUI extension structs instead of it being distributed over multiple objects. The whole thing is essentially a builder pattern, and after checking whether the plugin supports an API with clap_plugin_gui::is_api_supported() the host will start the GUI building process with clap_plugin_gui::create(). At that point the plugin can start initializing some things, but the actual window will only be created when clap_plugin_gui::set_parent() is called for embedded windows. For floating windows clap_plugin_gui::set_transient() is the equivalent 'build' function, but I do feel like suggest_title() should probably be before then. This is the current correct order of operations:
Thanks for this - I'm not coming at it from VST(3) experience, so perhaps that's partly why.
I'd missed the set_parent() aspect (it's clearer now you mention it, working through the clap-saw-demo), and can see the builder pattern as you mention. That all makes sense.
I would also agree that suggest_title() would make more sense for floating winfows, although personally I would have preferred an explicit function name that is consistent with both, for a standard - a clear point of state that the host expects the UI to be 'built'. I guess show() could be used in that regard, but that's likely also leaving things too late for anything 'heavy' on the first instance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I notice that there is provision regarding UI Scale in the headers
clap_plugin_gui->set_scale()
However, there are a couple of points that I'm unclear on (or perhaps misunderstanding).
Scale is not called on floating windows. I presume this is because they are independent of the host, but it could be beneficial for them to know the scaling that the host is using.
Scale is set after
clap_plugin_gui->create()
is called. This means that the create should not layout any elements until the scale has been set (or get_size() is called) and their layout and size will be unknown until scale is given (unless an additional re-layout is wanted). I realise that layout/sizing may want to be within a more dynamic nature, for plugins that scale on re-size. However, for any wanting to initialise with a default resolution, knowing the scale up-front could be useful.Beta Was this translation helpful? Give feedback.
All reactions