Browse Source

Implement LV2 uiresize to UIs in bridges

tags/1.9.7
falkTX 9 years ago
parent
commit
e7d78890e0
3 changed files with 21 additions and 4 deletions
  1. +2
    -1
      source/bridges-ui/CarlaBridgeToolkitPlugin.cpp
  2. +14
    -3
      source/bridges-ui/CarlaBridgeUI-LV2.cpp
  3. +5
    -0
      source/bridges-ui/CarlaBridgeUI.hpp

+ 2
- 1
source/bridges-ui/CarlaBridgeToolkitPlugin.cpp View File

@@ -191,8 +191,9 @@ protected:
fIdling = false;
}

void handlePluginUIResized(uint,uint) override
void handlePluginUIResized(const uint width, const uint height) override
{
ui->uiResized(width, height);
}

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


+ 14
- 3
source/bridges-ui/CarlaBridgeUI-LV2.cpp View File

@@ -503,15 +503,18 @@ public:

if (fDescriptor->extension_data != nullptr)
{
fExt.programs = (const LV2_Programs_UI_Interface*)fDescriptor->extension_data(LV2_PROGRAMS__UIInterface);
fExt.options = (const LV2_Options_Interface*)fDescriptor->extension_data(LV2_OPTIONS__interface);
fExt.programs = (const LV2_Programs_UI_Interface*)fDescriptor->extension_data(LV2_PROGRAMS__UIInterface);
fExt.idle = (const LV2UI_Idle_Interface*)fDescriptor->extension_data(LV2_UI__idleInterface);
fExt.resize = (const LV2UI_Resize*)fDescriptor->extension_data(LV2_UI__resize);

// check if invalid
if (fExt.programs != nullptr && fExt.programs->select_program == nullptr)
fExt.programs = nullptr;
if (fExt.idle != nullptr && fExt.idle->idle == nullptr)
fExt.idle = nullptr;
if (fExt.resize != nullptr && fExt.resize->ui_resize == nullptr)
fExt.resize = nullptr;
}

return true;
@@ -620,6 +623,12 @@ public:
fUiOptions.transientWindowId = transientWindowId;
}

void uiResized(const uint width, const uint height) override
{
if (fHandle != nullptr && fExt.resize != nullptr)
fExt.resize->ui_resize(fHandle, static_cast<int>(width), static_cast<int>(height));
}

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

LV2_URID getCustomURID(const char* const uri)
@@ -743,13 +752,15 @@ private:

struct Extensions {
const LV2_Options_Interface* options;
const LV2UI_Idle_Interface* idle;
const LV2_Programs_UI_Interface* programs;
const LV2UI_Idle_Interface* idle;
const LV2UI_Resize* resize;

Extensions()
: options(nullptr),
programs(nullptr),
idle(nullptr),
programs(nullptr) {}
resize(nullptr) {}
} fExt;

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


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

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

/*!
* TESTING
*/
virtual void uiResized(const uint width, const uint height) = 0;

/*!
* Options.
*/


Loading…
Cancel
Save