diff --git a/source/backend/CarlaBackend.h b/source/backend/CarlaBackend.h index 33d9a51c4..ba0c66260 100644 --- a/source/backend/CarlaBackend.h +++ b/source/backend/CarlaBackend.h @@ -210,6 +210,11 @@ static constexpr const uint PLUGIN_HAS_CUSTOM_UI_USING_FILE_OPEN = 0x2000; */ static constexpr const uint PLUGIN_NEEDS_MAIN_THREAD_IDLE = 0x4000; +/*! + * Plugin has its own custom UI which is user resizable. + */ +static constexpr const uint PLUGIN_HAS_CUSTOM_RESIZABLE_UI = 0x8000; + /** @} */ /* ------------------------------------------------------------------------------------------------------------ diff --git a/source/backend/plugin/CarlaPluginBridge.cpp b/source/backend/plugin/CarlaPluginBridge.cpp index 5b29acd42..c206a54cc 100644 --- a/source/backend/plugin/CarlaPluginBridge.cpp +++ b/source/backend/plugin/CarlaPluginBridge.cpp @@ -2193,7 +2193,7 @@ public: if (fBridgeVersion < 9 || fBinaryType == BINARY_WIN32 || fBinaryType == BINARY_WIN64) #endif { - pData->hints &= ~PLUGIN_HAS_CUSTOM_EMBED_UI; + pData->hints &= ~(PLUGIN_HAS_CUSTOM_EMBED_UI|PLUGIN_HAS_CUSTOM_RESIZABLE_UI); } fInfo.category = static_cast(category); diff --git a/source/backend/plugin/CarlaPluginCLAP.cpp b/source/backend/plugin/CarlaPluginCLAP.cpp index 43b7de9a2..c01bb62b8 100644 --- a/source/backend/plugin/CarlaPluginCLAP.cpp +++ b/source/backend/plugin/CarlaPluginCLAP.cpp @@ -1811,6 +1811,8 @@ public: pData->hints |= PLUGIN_HAS_CUSTOM_UI; pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; pData->hints |= PLUGIN_NEEDS_UI_MAIN_THREAD; + if (guiExt->can_resize(fPlugin)) + pData->hints |= PLUGIN_HAS_CUSTOM_RESIZABLE_UI; } else if (guiExt->is_api_supported(fPlugin, CLAP_WINDOW_API_NATIVE, true)) { diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index 2ecfc1130..001abc252 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -3315,7 +3315,18 @@ public: case LV2_UI_OLD_EXTERNAL: break; default: - pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; + pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI|PLUGIN_HAS_CUSTOM_RESIZABLE_UI; + for (uint32_t i = 0; i < fUI.rdfDescriptor->ExtensionCount; ++i) + { + const char* const extension = fUI.rdfDescriptor->Extensions[i]; + CARLA_SAFE_ASSERT_CONTINUE(extension != nullptr); + + if (std::strcmp(extension, LV2_UI__noUserResize) == 0) + { + pData->hints &= ~PLUGIN_HAS_CUSTOM_RESIZABLE_UI; + break; + } + } break; } } diff --git a/source/backend/plugin/CarlaPluginVST3.cpp b/source/backend/plugin/CarlaPluginVST3.cpp index b5e4643d5..0e7f16b26 100644 --- a/source/backend/plugin/CarlaPluginVST3.cpp +++ b/source/backend/plugin/CarlaPluginVST3.cpp @@ -2319,6 +2319,8 @@ public: pData->hints |= PLUGIN_HAS_CUSTOM_UI; pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; pData->hints |= PLUGIN_NEEDS_UI_MAIN_THREAD; + if (v3_cpp_obj(fV3.view)->can_resize(fV3.view) == V3_TRUE) + pData->hints |= PLUGIN_HAS_CUSTOM_RESIZABLE_UI; } #endif diff --git a/source/backend/utils/CachedPlugins.cpp b/source/backend/utils/CachedPlugins.cpp index 6ad7abc03..bec3462a7 100644 --- a/source/backend/utils/CachedPlugins.cpp +++ b/source/backend/utils/CachedPlugins.cpp @@ -262,15 +262,26 @@ static const CarlaCachedPluginInfo* get_cached_plugin_lv2(Lv2WorldClass& lv2Worl if (false) #endif { - info.hints |= CB::PLUGIN_HAS_CUSTOM_EMBED_UI; + info.hints |= CB::PLUGIN_HAS_CUSTOM_EMBED_UI|CB::PLUGIN_HAS_CUSTOM_RESIZABLE_UI; + + Lilv::Nodes lilvSupportedFeatureNodes(lilvUI.get_supported_features()); + LILV_FOREACH(nodes, it, lilvSupportedFeatureNodes) + { + Lilv::Node lilvFeatureNode(lilvSupportedFeatureNodes.get(it)); + const char* const featureURI(lilvFeatureNode.as_uri()); + CARLA_SAFE_ASSERT_CONTINUE(featureURI != nullptr); + + if (std::strcmp(featureURI, LV2_UI__noUserResize) == 0) + { + info.hints &= ~CB::PLUGIN_HAS_CUSTOM_RESIZABLE_UI; + break; + } + } + lilv_nodes_free(const_cast(lilvSupportedFeatureNodes.me)); break; } } } -#ifdef CARLA_OS_LINUX - else if (lilvPlugin.get_modgui_resources_directory().as_uri() != nullptr) - info.hints |= CB::PLUGIN_HAS_CUSTOM_UI; -#endif lilv_nodes_free(const_cast(lilvUIs.me)); } diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index ed2b16ec1..3d40a0ab7 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -1824,9 +1824,9 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo if (v3_cpp_obj(view)->is_platform_type_supported(view, V3_VIEW_PLATFORM_TYPE_NATIVE) == V3_TRUE) { hints |= PLUGIN_HAS_CUSTOM_UI; - #ifndef BUILD_BRIDGE hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; - #endif + if (v3_cpp_obj(view)->can_resize(view) == V3_TRUE) + hints |= PLUGIN_HAS_CUSTOM_RESIZABLE_UI; } v3_cpp_obj_unref(view); @@ -2634,10 +2634,12 @@ static bool do_clap_check(lib_t& libHandle, const char* const filename, const bo if (gui != nullptr) { hints |= PLUGIN_HAS_CUSTOM_UI; - #ifndef BUILD_BRIDGE if (gui->is_api_supported(plugin, CLAP_WINDOW_API_NATIVE, false)) + { hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; - #endif + if (gui->can_resize(plugin)) + hints |= PLUGIN_HAS_CUSTOM_RESIZABLE_UI; + } } #endif diff --git a/source/frontend/carla_backend.py b/source/frontend/carla_backend.py index 49c41f2ae..15b93a158 100644 --- a/source/frontend/carla_backend.py +++ b/source/frontend/carla_backend.py @@ -207,6 +207,21 @@ PLUGIN_USES_MULTI_PROGS = 0x400 # Plugin can make use of inline display API. PLUGIN_HAS_INLINE_DISPLAY = 0x800 +# Plugin has its own custom UI which can be embed into another Window. +# @see carla_embed_custom_ui() +# @note This is very experimental and subject to change at this point +PLUGIN_HAS_CUSTOM_EMBED_UI = 0x1000 + +# Plugin custom UI is a fake one that simply invokes an open file browser dialog. +PLUGIN_HAS_CUSTOM_UI_USING_FILE_OPEN = 0x2000 + +# Plugin needs all idle events in the main thread. +# @note Not possible on all engine implementations. +PLUGIN_NEEDS_MAIN_THREAD_IDLE = 0x4000 + +# Plugin has its own custom UI which is user resizable. +PLUGIN_HAS_CUSTOM_RESIZABLE_UI = 0x8000 + # --------------------------------------------------------------------------------------------------------------------- # Plugin Options # Various plugin options.