Browse Source

Fetch desktop scale factor for UI bridge testing; Cleanup

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.4.0
falkTX 3 years ago
parent
commit
181ef832d1
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
7 changed files with 32 additions and 16 deletions
  1. +1
    -0
      source/bridges-ui/.kdev_include_paths
  2. +1
    -1
      source/bridges-ui/CarlaBridgeFormat.cpp
  3. +5
    -0
      source/bridges-ui/CarlaBridgeFormat.hpp
  4. +5
    -0
      source/bridges-ui/CarlaBridgeFormatLV2.cpp
  5. +8
    -8
      source/bridges-ui/CarlaBridgeToolkit.hpp
  6. +6
    -1
      source/bridges-ui/CarlaBridgeToolkitNative.cpp
  7. +6
    -6
      source/utils/CarlaPluginUI.hpp

+ 1
- 0
source/bridges-ui/.kdev_include_paths View File

@@ -1,3 +1,4 @@
../backend/
../includes/ ../includes/
../modules/ ../modules/
../theme/ ../theme/


+ 1
- 1
source/bridges-ui/CarlaBridgeFormat.cpp View File

@@ -254,7 +254,7 @@ bool CarlaBridgeFormat::msgReceived(const char* const msg) noexcept
opts.transientWindowId = transientWindowId; opts.transientWindowId = transientWindowId;


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


fGotOptions = true; fGotOptions = true;
uiOptionsChanged(opts); uiOptionsChanged(opts);


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

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


/*!
* TESTING
*/
virtual void setScaleFactor(double scaleFactor) = 0;

/*! /*!
* TESTING * TESTING
*/ */


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

@@ -831,6 +831,11 @@ public:
fUiOptions.useThemeColors = opts.useThemeColors; fUiOptions.useThemeColors = opts.useThemeColors;
} }


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

void uiResized(const uint width, const uint height) override void uiResized(const uint width, const uint height) override
{ {
if (fHandle != nullptr && fExt.resize != nullptr) if (fHandle != nullptr && fExt.resize != nullptr)


+ 8
- 8
source/bridges-ui/CarlaBridgeToolkit.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Bridge UI * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -31,21 +31,21 @@ class CarlaBridgeToolkit
public: public:
virtual ~CarlaBridgeToolkit() {} virtual ~CarlaBridgeToolkit() {}


virtual bool init(const int argc, const char* argv[]) = 0;
virtual void exec(const bool showUI) = 0;
virtual bool init(int argc, const char* argv[]) = 0;
virtual void exec(bool showUI) = 0;
virtual void quit() = 0; virtual void quit() = 0;


virtual void show() = 0; virtual void show() = 0;
virtual void focus() = 0; virtual void focus() = 0;
virtual void hide() = 0; virtual void hide() = 0;
virtual void setChildWindow(void* const ptr) = 0;
virtual void setSize(const uint width, const uint height) = 0;
virtual void setTitle(const char* const title) = 0;
virtual void setChildWindow(void* ptr) = 0;
virtual void setSize(uint width, uint height) = 0;
virtual void setTitle(const char* title) = 0;


virtual void* getContainerId() const { return nullptr; }
virtual void* getContainerId() const { return nullptr; }
virtual void* getContainerId2() const { return nullptr; } virtual void* getContainerId2() const { return nullptr; }


static CarlaBridgeToolkit* createNew(CarlaBridgeFormat* const format);
static CarlaBridgeToolkit* createNew(CarlaBridgeFormat* format);


protected: protected:
CarlaBridgeFormat* const fPlugin; CarlaBridgeFormat* const fPlugin;


+ 6
- 1
source/bridges-ui/CarlaBridgeToolkitNative.cpp View File

@@ -20,6 +20,7 @@


#include "CarlaMainLoop.hpp" #include "CarlaMainLoop.hpp"
#include "CarlaPluginUI.hpp" #include "CarlaPluginUI.hpp"
#include "CarlaUtils.h"


#if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA) #if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA)
# include "CarlaMacUtils.hpp" # include "CarlaMacUtils.hpp"
@@ -71,9 +72,12 @@ public:
#endif #endif
CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr, false); CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr, false);


if (options.isStandalone)
fPlugin->setScaleFactor(carla_get_desktop_scale_factor());

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


#if (defined(CARLA_OS_WIN) && defined(BRIDGE_HWND)) || (defined(HAVE_X11) && defined(BRIDGE_X11))
#ifndef CARLA_OS_MAC
if (options.transientWindowId != 0) if (options.transientWindowId != 0)
{ {
fHostUI->setTransientWinId(options.transientWindowId); fHostUI->setTransientWinId(options.transientWindowId);
@@ -235,5 +239,6 @@ CARLA_BRIDGE_UI_END_NAMESPACE
#define CARLA_PLUGIN_UI_CLASS_PREFIX ToolkitNative #define CARLA_PLUGIN_UI_CLASS_PREFIX ToolkitNative
#include "CarlaPluginUI.cpp" #include "CarlaPluginUI.cpp"
#include "CarlaMacUtils.cpp" #include "CarlaMacUtils.cpp"
#include "utils/Windows.cpp"


// ------------------------------------------------------------------------- // -------------------------------------------------------------------------

+ 6
- 6
source/utils/CarlaPluginUI.hpp View File

@@ -29,7 +29,7 @@ public:
public: public:
virtual ~Callback() {} virtual ~Callback() {}
virtual void handlePluginUIClosed() = 0; virtual void handlePluginUIClosed() = 0;
virtual void handlePluginUIResized(const uint width, const uint height) = 0;
virtual void handlePluginUIResized(uint width, uint height) = 0;
}; };


virtual ~CarlaPluginUI() {} virtual ~CarlaPluginUI() {}
@@ -37,17 +37,17 @@ public:
virtual void hide() = 0; virtual void hide() = 0;
virtual void focus() = 0; virtual void focus() = 0;
virtual void idle() = 0; virtual void idle() = 0;
virtual void setSize(const uint with, const uint height, const bool forceUpdate) = 0;
virtual void setTitle(const char* const title) = 0;
virtual void setChildWindow(void* const ptr) = 0;
virtual void setTransientWinId(const uintptr_t winId) = 0;
virtual void setSize(uint with, uint height, bool forceUpdate) = 0;
virtual void setTitle(const char* title) = 0;
virtual void setChildWindow(void* ptr) = 0;
virtual void setTransientWinId(uintptr_t winId) = 0;
virtual void* getPtr() const noexcept = 0; virtual void* getPtr() const noexcept = 0;
#ifdef HAVE_X11 #ifdef HAVE_X11
virtual void* getDisplay() const noexcept = 0; virtual void* getDisplay() const noexcept = 0;
#endif #endif


#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
static bool tryTransientWinIdMatch(const uintptr_t pid, const char* const uiTitle, const uintptr_t winId, const bool centerUI);
static bool tryTransientWinIdMatch(uintptr_t pid, const char* uiTitle, uintptr_t winId, bool centerUI);
#endif #endif


#ifdef CARLA_OS_MAC #ifdef CARLA_OS_MAC


Loading…
Cancel
Save