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


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


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


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




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

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


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


/*! /*!
* TESTING * TESTING


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

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


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


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


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


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


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




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

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


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


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




Loading…
Cancel
Save