Browse Source

Inform VST2 and JUCE plugins about UI scale factor

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
3ca9a06c26
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 24 additions and 13 deletions
  1. +13
    -7
      source/backend/plugin/CarlaPluginJuce.cpp
  2. +11
    -6
      source/backend/plugin/CarlaPluginVST2.cpp

+ 13
- 7
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -371,17 +371,23 @@ public:

if (yesNo)
{
if (fWindow == nullptr)
if (juce::AudioProcessorEditor* const editor = fInstance->createEditorIfNeeded())
{
juce::String uiName(pData->name);
uiName += " (GUI)";
const EngineOptions& opts(pData->engine->getOptions());

fWindow = new JucePluginWindow(pData->engine->getOptions().frontendWinId);
fWindow->setName(uiName);
}
editor->setScaleFactor(opts.uiScale);

if (fWindow == nullptr)
{
juce::String uiName(pData->name);
uiName += " (GUI)";

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

if (juce::AudioProcessorEditor* const editor = fInstance->createEditorIfNeeded())
fWindow->show(editor);
}
}
else
{


+ 11
- 6
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -497,18 +497,16 @@ public:
if (fUI.window == nullptr)
{
const char* msg = nullptr;
const uintptr_t frontendWinId(pData->engine->getOptions().frontendWinId);
const EngineOptions& opts(pData->engine->getOptions());

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

if (fUI.window == nullptr)
@@ -525,6 +523,13 @@ public:
value = (intptr_t)fUI.window->getDisplay();
#endif

// inform plugin of what UI scale we use
dispatcher(effVendorSpecific,
CCONST('P', 'r', 'e', 'S'),
CCONST('A', 'e', 'C', 's'),
nullptr,
opts.uiScale);

// NOTE: there are far too many broken VST2 plugins, don't bother checking return value
if (dispatcher(effEditOpen, 0, value, fUI.window->getPtr()) != 0 || true)
{


Loading…
Cancel
Save