Browse Source

Implement a way to set plugins as standalones

tags/v2.3.2
falkTX 3 years ago
parent
commit
1ff775e726
20 changed files with 118 additions and 56 deletions
  1. +11
    -2
      source/backend/CarlaBackend.h
  2. +1
    -0
      source/backend/CarlaEngine.hpp
  3. +0
    -2
      source/backend/CarlaHost.h
  4. +3
    -3
      source/backend/CarlaHostImpl.hpp
  5. +14
    -5
      source/backend/CarlaStandalone.cpp
  6. +10
    -7
      source/backend/engine/CarlaEngine.cpp
  7. +2
    -1
      source/backend/engine/CarlaEngineData.cpp
  8. +1
    -1
      source/backend/plugin/CarlaPluginJuce.cpp
  9. +5
    -4
      source/backend/plugin/CarlaPluginLV2.cpp
  10. +3
    -3
      source/backend/plugin/CarlaPluginVST2.cpp
  11. +2
    -1
      source/bridges-plugin/CarlaBridgePlugin.cpp
  12. +3
    -0
      source/bridges-ui/CarlaBridgeFormat.cpp
  13. +9
    -2
      source/bridges-ui/CarlaBridgeFormat.hpp
  14. +1
    -0
      source/bridges-ui/CarlaBridgeFormatLV2.cpp
  15. +4
    -4
      source/bridges-ui/CarlaBridgeToolkitNative.cpp
  16. +4
    -1
      source/frontend/carla_backend.py
  17. +7
    -1
      source/utils/CarlaBackendUtils.hpp
  18. +19
    -12
      source/utils/CarlaPluginUI.cpp
  19. +9
    -5
      source/utils/CarlaPluginUI.hpp
  20. +10
    -2
      source/utils/JucePluginWindow.hpp

+ 11
- 2
source/backend/CarlaBackend.h View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -1368,6 +1368,7 @@ typedef enum {
*/
ENGINE_OPTION_AUDIO_DEVICE = 14,

#ifndef BUILD_BRIDGE
/*!
* Wherever to enable OSC support in the engine.
*/
@@ -1389,6 +1390,7 @@ typedef enum {
* @note Valid ports begin at 1024 and end at 32767 (inclusive)
*/
ENGINE_OPTION_OSC_PORT_UDP = 17,
#endif

/*!
* Set path used for a specific file type.
@@ -1475,17 +1477,24 @@ typedef enum {
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32,
#endif

#ifndef BUILD_BRIDGE
/*!
* Capture console output into debug callbacks.
*/
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33,
#endif

/*!
* A prefix to give to all plugin clients created by Carla.
* Mostly useful for JACK multi-client mode.
* @note MUST include at least one "." (dot).
*/
ENGINE_OPTION_CLIENT_NAME_PREFIX = 34
ENGINE_OPTION_CLIENT_NAME_PREFIX = 34,

/*!
* Treat loaded plugins as standalone (that is, there is no host UI to manage them)
*/
ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35

} EngineOption;



+ 1
- 0
source/backend/CarlaEngine.hpp View File

@@ -242,6 +242,7 @@ struct CARLA_API EngineOptions {
bool preferPluginBridges;
bool preferUiBridges;
bool uisAlwaysOnTop;
bool pluginsAreStandalone;
uint bgColor;
uint fgColor;
float uiScale;


+ 0
- 2
source/backend/CarlaHost.h View File

@@ -489,7 +489,6 @@ CARLA_EXPORT bool carla_set_engine_about_to_close(CarlaHostHandle handle);
*/
CARLA_EXPORT void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func, void* ptr);

#ifndef BUILD_BRIDGE
/*!
* Set an engine option.
* @param option Option
@@ -497,7 +496,6 @@ CARLA_EXPORT void carla_set_engine_callback(CarlaHostHandle handle, EngineCallba
* @param valueStr Value as string
*/
CARLA_EXPORT void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr);
#endif

/*!
* Set the file callback function.


+ 3
- 3
source/backend/CarlaHostImpl.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -57,8 +57,8 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
FileCallbackFunc fileCallback;
void* fileCallbackPtr;

#ifndef BUILD_BRIDGE
EngineOptions engineOptions;
#ifndef BUILD_BRIDGE
CarlaLogThread logThread;
bool logThreadEnabled;
#endif
@@ -71,8 +71,8 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
engineCallbackPtr(nullptr),
fileCallback(nullptr),
fileCallbackPtr(nullptr),
#ifndef BUILD_BRIDGE
engineOptions(),
#ifndef BUILD_BRIDGE
logThread(),
logThreadEnabled(false),
#endif


+ 14
- 5
source/backend/CarlaStandalone.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Standalone
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -388,6 +388,8 @@ static void carla_engine_init_common(const CarlaHostStandalone& standalone, Carl
# endif

engine->setOption(CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, standalone.engineOptions.clientNamePrefix);

engine->setOption(CB::ENGINE_OPTION_PLUGINS_ARE_STANDALONE, standalone.engineOptions.pluginsAreStandalone, nullptr);
#endif // BUILD_BRIDGE
}

@@ -694,7 +696,6 @@ void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func,
handle->engine->setCallback(func, ptr);
}

#ifndef BUILD_BRIDGE
void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr)
{
carla_debug("carla_set_engine_option(%p, %i:%s, %i, \"%s\")",
@@ -811,6 +812,7 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
shandle.engineOptions.audioDevice = carla_strdup_safe(valueStr);
break;

#ifndef BUILD_BRIDGE
case CB::ENGINE_OPTION_OSC_ENABLED:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
shandle.engineOptions.oscEnabled = (value != 0);
@@ -825,6 +827,7 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,);
shandle.engineOptions.oscPortUDP = value;
break;
#endif

case CB::ENGINE_OPTION_FILE_PATH:
CARLA_SAFE_ASSERT_RETURN(value > CB::FILE_NONE,);
@@ -934,7 +937,7 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
shandle.engineOptions.frontendWinId = static_cast<uintptr_t>(winId);
} break;

# ifndef CARLA_OS_WIN
#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
case CB::ENGINE_OPTION_WINE_EXECUTABLE:
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);

@@ -972,11 +975,13 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
CARLA_SAFE_ASSERT_RETURN(value >= 1 && value <= 99,);
shandle.engineOptions.wine.serverRtPrio = value;
break;
# endif // CARLA_OS_WIN
#endif

#ifndef BUILD_BRIDGE
case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
shandle.logThreadEnabled = (value != 0);
break;
#endif

case CB::ENGINE_OPTION_CLIENT_NAME_PREFIX:
if (shandle.engineOptions.clientNamePrefix != nullptr)
@@ -986,13 +991,17 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
? carla_strdup_safe(valueStr)
: nullptr;
break;

case CB::ENGINE_OPTION_PLUGINS_ARE_STANDALONE:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
shandle.engineOptions.pluginsAreStandalone = (value != 0);
break;
}
}

if (handle->engine != nullptr)
handle->engine->setOption(option, value, valueStr);
}
#endif // BUILD_BRIDGE

void carla_set_file_callback(CarlaHostHandle handle, FileCallbackFunc func, void* ptr)
{


+ 10
- 7
source/backend/engine/CarlaEngine.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -1902,26 +1902,22 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
pData->options.audioDevice = carla_strdup_safe(valueStr);
break;

#ifndef BUILD_BRIDGE
case ENGINE_OPTION_OSC_ENABLED:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
#ifndef BUILD_BRIDGE
pData->options.oscEnabled = (value != 0);
#endif
break;

case ENGINE_OPTION_OSC_PORT_TCP:
CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,);
#ifndef BUILD_BRIDGE
pData->options.oscPortTCP = value;
#endif
break;

case ENGINE_OPTION_OSC_PORT_UDP:
CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,);
#ifndef BUILD_BRIDGE
pData->options.oscPortUDP = value;
#endif
break;
#endif

case ENGINE_OPTION_FILE_PATH:
CARLA_SAFE_ASSERT_RETURN(value > FILE_NONE,);
@@ -2116,8 +2112,10 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
break;
#endif

#ifndef BUILD_BRIDGE
case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
break;
#endif

case ENGINE_OPTION_CLIENT_NAME_PREFIX:
if (pData->options.clientNamePrefix != nullptr)
@@ -2127,6 +2125,11 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
? carla_strdup_safe(valueStr)
: nullptr;
break;

case ENGINE_OPTION_PLUGINS_ARE_STANDALONE:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
pData->options.pluginsAreStandalone = (value != 0);
break;
}
}



+ 2
- 1
source/backend/engine/CarlaEngineData.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -209,6 +209,7 @@ EngineOptions::EngineOptions() noexcept
preferUiBridges(true),
#endif
uisAlwaysOnTop(true),
pluginsAreStandalone(false),
bgColor(0x000000ff),
fgColor(0xffffffff),
uiScale(1.0f),


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

@@ -494,7 +494,7 @@ public:
uiName += " (GUI)";
}

fWindow = new JucePluginWindow(opts.frontendWinId);
fWindow = new JucePluginWindow(opts.frontendWinId, opts.pluginsAreStandalone);
fWindow->setName(uiName);
}



+ 5
- 4
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla LV2 Plugin
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -1892,6 +1892,7 @@ public:
if (fUI.type == UI::TYPE_EMBED && fUI.rdfDescriptor->Type != LV2_UI_NONE && fUI.window == nullptr)
{
const char* msg = nullptr;
const bool isStandalone = pData->engine->getOptions().pluginsAreStandalone;

switch (fUI.rdfDescriptor->Type)
{
@@ -1906,7 +1907,7 @@ public:

case LV2_UI_COCOA:
# ifdef CARLA_OS_MAC
fUI.window = CarlaPluginUI::newCocoa(this, frontendWinId, isUiResizable());
fUI.window = CarlaPluginUI::newCocoa(this, frontendWinId, isStandalone, isUiResizable());
# else
msg = "UI is for MacOS only";
# endif
@@ -1914,7 +1915,7 @@ public:

case LV2_UI_WINDOWS:
# ifdef CARLA_OS_WIN
fUI.window = CarlaPluginUI::newWindows(this, frontendWinId, isUiResizable());
fUI.window = CarlaPluginUI::newWindows(this, frontendWinId, isStandalone, isUiResizable());
# else
msg = "UI is for Windows only";
# endif
@@ -1922,7 +1923,7 @@ public:

case LV2_UI_X11:
# ifdef HAVE_X11
fUI.window = CarlaPluginUI::newX11(this, frontendWinId, isUiResizable(), true);
fUI.window = CarlaPluginUI::newX11(this, frontendWinId, isStandalone, isUiResizable(), true);
# else
msg = "UI is only for systems with X11";
# endif


+ 3
- 3
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -546,11 +546,11 @@ public:
const EngineOptions& opts(pData->engine->getOptions());

#if defined(CARLA_OS_MAC)
fUI.window = CarlaPluginUI::newCocoa(this, opts.frontendWinId, false);
fUI.window = CarlaPluginUI::newCocoa(this, opts.frontendWinId, opts.pluginsAreStandalone, false);
#elif defined(CARLA_OS_WIN)
fUI.window = CarlaPluginUI::newWindows(this, opts.frontendWinId, false);
fUI.window = CarlaPluginUI::newWindows(this, opts.frontendWinId, opts.pluginsAreStandalone, false);
#elif defined(HAVE_X11)
fUI.window = CarlaPluginUI::newX11(this, opts.frontendWinId, false, false);
fUI.window = CarlaPluginUI::newX11(this, opts.frontendWinId, opts.pluginsAreStandalone, false, false);
#else
msg = "Unsupported UI type";
#endif


+ 2
- 1
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Bridge Plugin
* Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -661,6 +661,7 @@ int main(int argc, char* argv[])
if (! useBridge)
{
carla_set_active(gHostHandle, 0, true);
carla_set_engine_option(gHostHandle, CarlaBackend::ENGINE_OPTION_PLUGINS_ARE_STANDALONE, 1, nullptr);

if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(gHostHandle, 0))
{


+ 3
- 0
source/bridges-ui/CarlaBridgeFormat.cpp View File

@@ -253,6 +253,9 @@ bool CarlaBridgeFormat::msgReceived(const char* const msg) noexcept
CARLA_SAFE_ASSERT_RETURN(readNextLineAsULong(transientWindowId), true);
opts.transientWindowId = transientWindowId;

// we can assume we are not standalone if we got options from controller side
opts.isStandalone = true;

fGotOptions = true;
uiOptionsChanged(opts);



+ 9
- 2
source/bridges-ui/CarlaBridgeFormat.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla Bridge UI
* Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -77,6 +77,7 @@ protected:
uint32_t bgColor;
uint32_t fgColor;
float uiScale;
bool isStandalone;
bool useTheme;
bool useThemeColors;
const char* windowTitle;
@@ -111,6 +112,11 @@ public:
* Options.
*/
struct Options {
/*!
* UI is standalone, not controlled by another application.
*/
bool isStandalone;

/*!
* UI is resizable by the user.
* The UI can still sometimes resize itself internally if this is false.
@@ -142,7 +148,8 @@ public:
* Constructor for default options.
*/
Options() noexcept
: isResizable(true),
: isStandalone(true),
isResizable(true),
useTheme(true),
useThemeColors(true),
windowTitle("TestUI"),


+ 1
- 0
source/bridges-ui/CarlaBridgeFormatLV2.cpp View File

@@ -826,6 +826,7 @@ public:
// ------------------------------------------------------------------------------------------------------------
// other

fUiOptions.isStandalone = opts.isStandalone;
fUiOptions.useTheme = opts.useTheme;
fUiOptions.useThemeColors = opts.useThemeColors;
}


+ 4
- 4
source/bridges-ui/CarlaBridgeToolkitNative.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Bridge UI
* Copyright (C) 2014-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -57,12 +57,12 @@ public:
const CarlaBridgeFormat::Options& options(fPlugin->getOptions());

#if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA)
fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isResizable);
fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isStandalone, options.isResizable);
#elif defined(CARLA_OS_WIN) && defined(BRIDGE_HWND)
fHostUI = CarlaPluginUI::newWindows(this, 0, options.isResizable);
fHostUI = CarlaPluginUI::newWindows(this, 0, options.isStandalone, options.isResizable);
#elif defined(HAVE_X11) && defined(BRIDGE_X11)
XInitThreads();
fHostUI = CarlaPluginUI::newX11(this, 0, options.isResizable, true /* assumes LV2 */);
fHostUI = CarlaPluginUI::newX11(this, 0, options.isStandalone, options.isResizable, true);
#endif
CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr, false);



+ 4
- 1
source/frontend/carla_backend.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# Carla Backend code
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@@ -1045,6 +1045,9 @@ ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33
# @note MUST include at least one "." (dot).
ENGINE_OPTION_CLIENT_NAME_PREFIX = 34

# Treat loaded plugins as standalone (that is, there is no host UI to manage them)
ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35

# ---------------------------------------------------------------------------------------------------------------------
# Engine Process Mode
# Engine process mode.


+ 7
- 1
source/utils/CarlaBackendUtils.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla Backend utils
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -360,12 +360,14 @@ const char* EngineOption2Str(const EngineOption option) noexcept
return "ENGINE_OPTION_AUDIO_DRIVER";
case ENGINE_OPTION_AUDIO_DEVICE:
return "ENGINE_OPTION_AUDIO_DEVICE";
#ifndef BUILD_BRIDGE
case ENGINE_OPTION_OSC_ENABLED:
return "ENGINE_OPTION_OSC_ENABLED";
case ENGINE_OPTION_OSC_PORT_UDP:
return "ENGINE_OPTION_OSC_PORT_UDP";
case ENGINE_OPTION_OSC_PORT_TCP:
return "ENGINE_OPTION_OSC_PORT_TCP";
#endif
case ENGINE_OPTION_FILE_PATH:
return "ENGINE_OPTION_FILE_PATH";
case ENGINE_OPTION_PLUGIN_PATH:
@@ -398,10 +400,14 @@ const char* EngineOption2Str(const EngineOption option) noexcept
case ENGINE_OPTION_WINE_SERVER_RT_PRIO:
return "ENGINE_OPTION_WINE_SERVER_RT_PRIO";
#endif
#ifndef BUILD_BRIDGE
case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
return "ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT";
#endif
case ENGINE_OPTION_CLIENT_NAME_PREFIX:
return "ENGINE_OPTION_CLIENT_NAME_PREFIX";
case ENGINE_OPTION_PLUGINS_ARE_STANDALONE:
return "ENGINE_OPTION_PLUGINS_ARE_STANDALONE";
}

carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option);


+ 19
- 12
source/utils/CarlaPluginUI.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin UI
* Copyright (C) 2014-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -59,8 +59,8 @@ class X11PluginUI : public CarlaPluginUI
{
public:
X11PluginUI(Callback* const cb, const uintptr_t parentId,
const bool isResizable, const bool canMonitorChildren) noexcept
: CarlaPluginUI(cb, isResizable),
const bool isStandalone, const bool isResizable, const bool canMonitorChildren) noexcept
: CarlaPluginUI(cb, isStandalone, isResizable),
fDisplay(nullptr),
fHostWindow(0),
fChildWindow(0),
@@ -571,8 +571,8 @@ private:
class CocoaPluginUI : public CarlaPluginUI
{
public:
CocoaPluginUI(Callback* const callback, const uintptr_t parentId, const bool isResizable) noexcept
: CarlaPluginUI(callback, isResizable),
CocoaPluginUI(Callback* const callback, const uintptr_t parentId, const bool isStandalone, const bool isResizable) noexcept
: CarlaPluginUI(callback, isStandalone, isResizable),
fView(nullptr),
fParentWindow(nullptr),
fWindow(nullptr)
@@ -792,8 +792,8 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
class WindowsPluginUI : public CarlaPluginUI
{
public:
WindowsPluginUI(Callback* const cb, const uintptr_t parentId, const bool isResizable) noexcept
: CarlaPluginUI(cb, isResizable),
WindowsPluginUI(Callback* const cb, const uintptr_t parentId, const bool isStandalone, const bool isResizable) noexcept
: CarlaPluginUI(cb, isStandalone, isResizable),
fWindow(nullptr),
fChildWindow(nullptr),
fParentWindow(nullptr),
@@ -1392,24 +1392,31 @@ bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* cons
#ifdef HAVE_X11
CarlaPluginUI* CarlaPluginUI::newX11(Callback* const cb,
const uintptr_t parentId,
const bool isStandalone,
const bool isResizable,
const bool isLV2)
{
return new X11PluginUI(cb, parentId, isResizable, isLV2);
return new X11PluginUI(cb, parentId, isStandalone, isResizable, isLV2);
}
#endif

#ifdef CARLA_OS_MAC
CarlaPluginUI* CarlaPluginUI::newCocoa(Callback* const cb, const uintptr_t parentId, const bool isResizable)
CarlaPluginUI* CarlaPluginUI::newCocoa(Callback* const cb,
const uintptr_t parentId,
const bool isStandalone,
const bool isResizable)
{
return new CocoaPluginUI(cb, parentId, isResizable);
return new CocoaPluginUI(cb, parentId, isStandalone, isResizable);
}
#endif

#ifdef CARLA_OS_WIN
CarlaPluginUI* CarlaPluginUI::newWindows(Callback* const cb, const uintptr_t parentId, const bool isResizable)
CarlaPluginUI* CarlaPluginUI::newWindows(Callback* const cb,
const uintptr_t parentId,
const bool isStandalone,
const bool isResizable)
{
return new WindowsPluginUI(cb, parentId, isResizable);
return new WindowsPluginUI(cb, parentId, isStandalone, isResizable);
}
#endif



+ 9
- 5
source/utils/CarlaPluginUI.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin UI
* Copyright (C) 2014-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -51,22 +51,26 @@ public:
#endif

#ifdef CARLA_OS_MAC
static CarlaPluginUI* newCocoa(Callback*, uintptr_t, bool isResizable);
static CarlaPluginUI* newCocoa(Callback*, uintptr_t, bool isStandalone, bool isResizable);
#endif
#ifdef CARLA_OS_WIN
static CarlaPluginUI* newWindows(Callback*, uintptr_t, bool isResizable);
static CarlaPluginUI* newWindows(Callback*, uintptr_t, bool isStandalone, bool isResizable);
#endif
#ifdef HAVE_X11
static CarlaPluginUI* newX11(Callback*, uintptr_t, bool isResizable, bool canMonitorChildren);
static CarlaPluginUI* newX11(Callback*, uintptr_t, bool isStandalone, bool isResizable, bool canMonitorChildren);
#endif

protected:
bool fIsIdling;
bool fIsStandalone;
bool fIsResizable;
Callback* fCallback;

CarlaPluginUI(Callback* const cb, const bool isResizable) noexcept
CarlaPluginUI(Callback* const cb,
const bool isStandalone,
const bool isResizable) noexcept
: fIsIdling(false),
fIsStandalone(isStandalone),
fIsResizable(isResizable),
fCallback(cb) {}



+ 10
- 2
source/utils/JucePluginWindow.hpp View File

@@ -42,8 +42,9 @@ namespace juce {
class JucePluginWindow : public DialogWindow
{
public:
JucePluginWindow(const uintptr_t parentId)
JucePluginWindow(const uintptr_t parentId, const bool isStandalone)
: DialogWindow("JucePluginWindow", Colour(50, 50, 200), true, false),
fIsStandalone(isStandalone),
fClosed(false),
fShown(false),
fTransientId(parentId)
@@ -106,7 +107,13 @@ protected:

int getDesktopWindowStyleFlags() const override
{
return ComponentPeer::windowHasDropShadow | ComponentPeer::windowHasTitleBar | ComponentPeer::windowHasCloseButton;
int flags = 0;
flags |= ComponentPeer::windowHasCloseButton;
flags |= ComponentPeer::windowHasDropShadow;
flags |= ComponentPeer::windowHasTitleBar;
if (fIsStandalone)
flags |= ComponentPeer::windowAppearsOnTaskbar;
return flags;
}

#ifndef CARLA_OS_LINUX
@@ -123,6 +130,7 @@ protected:
#endif

private:
const bool fIsStandalone;
volatile bool fClosed;
bool fShown;
const uintptr_t fTransientId;


Loading…
Cancel
Save