Browse Source

Add PLUGIN_HAS_CUSTOM_RESIZABLE_UI flag, useful on embed

pull/2020/merge
falkTX 1 month ago
parent
commit
12bc40fd6c
8 changed files with 59 additions and 11 deletions
  1. +5
    -0
      source/backend/CarlaBackend.h
  2. +1
    -1
      source/backend/plugin/CarlaPluginBridge.cpp
  3. +2
    -0
      source/backend/plugin/CarlaPluginCLAP.cpp
  4. +12
    -1
      source/backend/plugin/CarlaPluginLV2.cpp
  5. +2
    -0
      source/backend/plugin/CarlaPluginVST3.cpp
  6. +16
    -5
      source/backend/utils/CachedPlugins.cpp
  7. +6
    -4
      source/discovery/carla-discovery.cpp
  8. +15
    -0
      source/frontend/carla_backend.py

+ 5
- 0
source/backend/CarlaBackend.h View File

@@ -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; 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;

/** @} */ /** @} */


/* ------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------


+ 1
- 1
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -2193,7 +2193,7 @@ public:
if (fBridgeVersion < 9 || fBinaryType == BINARY_WIN32 || fBinaryType == BINARY_WIN64) if (fBridgeVersion < 9 || fBinaryType == BINARY_WIN32 || fBinaryType == BINARY_WIN64)
#endif #endif
{ {
pData->hints &= ~PLUGIN_HAS_CUSTOM_EMBED_UI;
pData->hints &= ~(PLUGIN_HAS_CUSTOM_EMBED_UI|PLUGIN_HAS_CUSTOM_RESIZABLE_UI);
} }


fInfo.category = static_cast<PluginCategory>(category); fInfo.category = static_cast<PluginCategory>(category);


+ 2
- 0
source/backend/plugin/CarlaPluginCLAP.cpp View File

@@ -1811,6 +1811,8 @@ public:
pData->hints |= PLUGIN_HAS_CUSTOM_UI; pData->hints |= PLUGIN_HAS_CUSTOM_UI;
pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI;
pData->hints |= PLUGIN_NEEDS_UI_MAIN_THREAD; 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)) else if (guiExt->is_api_supported(fPlugin, CLAP_WINDOW_API_NATIVE, true))
{ {


+ 12
- 1
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -3315,7 +3315,18 @@ public:
case LV2_UI_OLD_EXTERNAL: case LV2_UI_OLD_EXTERNAL:
break; break;
default: 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; break;
} }
} }


+ 2
- 0
source/backend/plugin/CarlaPluginVST3.cpp View File

@@ -2319,6 +2319,8 @@ public:
pData->hints |= PLUGIN_HAS_CUSTOM_UI; pData->hints |= PLUGIN_HAS_CUSTOM_UI;
pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI;
pData->hints |= PLUGIN_NEEDS_UI_MAIN_THREAD; 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 #endif




+ 16
- 5
source/backend/utils/CachedPlugins.cpp View File

@@ -262,15 +262,26 @@ static const CarlaCachedPluginInfo* get_cached_plugin_lv2(Lv2WorldClass& lv2Worl
if (false) if (false)
#endif #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<LilvNodes*>(lilvSupportedFeatureNodes.me));
break; 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<LilvNodes*>(lilvUIs.me)); lilv_nodes_free(const_cast<LilvNodes*>(lilvUIs.me));
} }


+ 6
- 4
source/discovery/carla-discovery.cpp View File

@@ -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) if (v3_cpp_obj(view)->is_platform_type_supported(view, V3_VIEW_PLATFORM_TYPE_NATIVE) == V3_TRUE)
{ {
hints |= PLUGIN_HAS_CUSTOM_UI; hints |= PLUGIN_HAS_CUSTOM_UI;
#ifndef BUILD_BRIDGE
hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; 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); 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) if (gui != nullptr)
{ {
hints |= PLUGIN_HAS_CUSTOM_UI; hints |= PLUGIN_HAS_CUSTOM_UI;
#ifndef BUILD_BRIDGE
if (gui->is_api_supported(plugin, CLAP_WINDOW_API_NATIVE, false)) if (gui->is_api_supported(plugin, CLAP_WINDOW_API_NATIVE, false))
{
hints |= PLUGIN_HAS_CUSTOM_EMBED_UI; hints |= PLUGIN_HAS_CUSTOM_EMBED_UI;
#endif
if (gui->can_resize(plugin))
hints |= PLUGIN_HAS_CUSTOM_RESIZABLE_UI;
}
} }
#endif #endif




+ 15
- 0
source/frontend/carla_backend.py View File

@@ -207,6 +207,21 @@ PLUGIN_USES_MULTI_PROGS = 0x400
# Plugin can make use of inline display API. # Plugin can make use of inline display API.
PLUGIN_HAS_INLINE_DISPLAY = 0x800 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 # Plugin Options
# Various plugin options. # Various plugin options.


Loading…
Cancel
Save