Browse Source

Do not set scale factor for LV2 plugin UIs on macOS

tags/v2.5.1
falkTX 2 years ago
parent
commit
658b5e30c6
4 changed files with 26 additions and 0 deletions
  1. +10
    -0
      source/backend/plugin/CarlaPluginLV2.cpp
  2. +2
    -0
      source/bridges-ui/CarlaBridgeFormat.hpp
  3. +12
    -0
      source/bridges-ui/CarlaBridgeFormatLV2.cpp
  4. +2
    -0
      source/bridges-ui/CarlaBridgeToolkitNative.cpp

+ 10
- 0
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -149,7 +149,9 @@ enum CarlaLv2URIDs {
// ui stuff
kUridBackgroundColor,
kUridForegroundColor,
#ifndef CARLA_OS_MAC
kUridScaleFactor,
#endif
kUridWindowTitle,
// custom carla props
kUridCarlaAtomWorkerIn,
@@ -353,7 +355,9 @@ struct CarlaPluginLV2Options {
TransientWinId,
BackgroundColor,
ForegroundColor,
#ifndef CARLA_OS_MAC
ScaleFactor,
#endif
WindowTitle,
Null,
Count
@@ -431,6 +435,7 @@ struct CarlaPluginLV2Options {
optForegroundColor.type = kUridAtomInt;
optForegroundColor.value = &fgColor;

#ifndef CARLA_OS_MAC
LV2_Options_Option& optScaleFactor(opts[ScaleFactor]);
optScaleFactor.context = LV2_OPTIONS_INSTANCE;
optScaleFactor.subject = 0;
@@ -438,6 +443,7 @@ struct CarlaPluginLV2Options {
optScaleFactor.size = sizeof(float);
optScaleFactor.type = kUridAtomFloat;
optScaleFactor.value = &uiScale;
#endif

LV2_Options_Option& optSampleRate(opts[SampleRate]);
optSampleRate.context = LV2_OPTIONS_INSTANCE;
@@ -7877,8 +7883,10 @@ private:
return kUridBackgroundColor;
if (std::strcmp(uri, LV2_UI__foregroundColor) == 0)
return kUridForegroundColor;
#ifndef CARLA_OS_MAC
if (std::strcmp(uri, LV2_UI__scaleFactor) == 0)
return kUridScaleFactor;
#endif
if (std::strcmp(uri, LV2_UI__windowTitle) == 0)
return kUridWindowTitle;

@@ -8015,8 +8023,10 @@ private:
return LV2_UI__backgroundColor;
case kUridForegroundColor:
return LV2_UI__foregroundColor;
#ifndef CARLA_OS_MAC
case kUridScaleFactor:
return LV2_UI__scaleFactor;
#endif
case kUridWindowTitle:
return LV2_UI__windowTitle;



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

@@ -103,10 +103,12 @@ public:
*/
virtual void* getWidget() const noexcept = 0;

#ifndef CARLA_OS_MAC
/*!
* TESTING
*/
virtual void setScaleFactor(double scaleFactor) = 0;
#endif

/*!
* TESTING


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

@@ -103,7 +103,9 @@ enum CarlaLv2URIDs {
// ui stuff
kUridBackgroundColor,
kUridForegroundColor,
#ifndef CARLA_OS_MAC
kUridScaleFactor,
#endif
kUridWindowTitle,
// custom carla props
kUridCarlaAtomWorkerIn,
@@ -148,7 +150,9 @@ struct Lv2PluginOptions {
TransientWinId,
BackgroundColor,
ForegroundColor,
#ifndef CARLA_OS_MAC
ScaleFactor,
#endif
WindowTitle,
Null,
Count
@@ -192,6 +196,7 @@ struct Lv2PluginOptions {
optForegroundColor.type = kUridAtomInt;
optForegroundColor.value = &fgColor;

#ifndef CARLA_OS_MAC
LV2_Options_Option& optScaleFactor(opts[ScaleFactor]);
optScaleFactor.context = LV2_OPTIONS_INSTANCE;
optScaleFactor.subject = 0;
@@ -199,6 +204,7 @@ struct Lv2PluginOptions {
optScaleFactor.size = sizeof(float);
optScaleFactor.type = kUridAtomFloat;
optScaleFactor.value = &uiScale;
#endif

LV2_Options_Option& optTransientWinId(opts[TransientWinId]);
optTransientWinId.context = LV2_OPTIONS_INSTANCE;
@@ -831,10 +837,12 @@ public:
fUiOptions.useThemeColors = opts.useThemeColors;
}

#ifndef CARLA_OS_MAC
void setScaleFactor(const double scaleFactor) override
{
fLv2Options.uiScale = static_cast<float>(scaleFactor);
}
#endif

void uiResized(const uint width, const uint height) override
{
@@ -1314,8 +1322,10 @@ private:
return kUridBackgroundColor;
if (std::strcmp(uri, LV2_UI__foregroundColor) == 0)
return kUridForegroundColor;
#ifndef CARLA_OS_MAC
if (std::strcmp(uri, LV2_UI__scaleFactor) == 0)
return kUridScaleFactor;
#endif
if (std::strcmp(uri, LV2_UI__windowTitle) == 0)
return kUridWindowTitle;

@@ -1452,8 +1462,10 @@ private:
return LV2_UI__backgroundColor;
case kUridForegroundColor:
return LV2_UI__foregroundColor;
#ifndef CARLA_OS_MAC
case kUridScaleFactor:
return LV2_UI__scaleFactor;
#endif
case kUridWindowTitle:
return LV2_UI__windowTitle;



+ 2
- 0
source/bridges-ui/CarlaBridgeToolkitNative.cpp View File

@@ -72,8 +72,10 @@ public:
#endif
CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr, false);

#ifndef CARLA_OS_MAC
if (options.isStandalone)
fPlugin->setScaleFactor(carla_get_desktop_scale_factor());
#endif

fHostUI->setTitle(options.windowTitle.buffer());



Loading…
Cancel
Save