Browse Source

UI bridge fixing

tags/1.9.6
falkTX 10 years ago
parent
commit
cd147ad1b4
6 changed files with 69 additions and 47 deletions
  1. +4
    -8
      source/bridges-ui/CarlaBridgeToolkitGtk.cpp
  2. +11
    -8
      source/bridges-ui/CarlaBridgeToolkitPlugin.cpp
  3. +4
    -9
      source/bridges-ui/CarlaBridgeToolkitQt.cpp
  4. +40
    -20
      source/bridges-ui/CarlaBridgeUI-LV2.cpp
  5. +7
    -0
      source/bridges-ui/CarlaBridgeUI.cpp
  6. +3
    -2
      source/bridges-ui/CarlaBridgeUI.hpp

+ 4
- 8
source/bridges-ui/CarlaBridgeToolkitGtk.cpp View File

@@ -85,7 +85,7 @@ public:
gtk_container_add(GTK_CONTAINER(fWindow), widget);

gtk_window_set_resizable(gtkWindow, options.isResizable);
gtk_window_set_title(gtkWindow, options.windowTitle);
gtk_window_set_title(gtkWindow, options.windowTitle.buffer());

if (showUI || fNeedsShow)
{
@@ -195,14 +195,10 @@ protected:
gtk_window_get_size(GTK_WINDOW(fWindow), &fLastWidth, &fLastHeight);
}

ui->idlePipe();
ui->idleUI();
if (ui->isPipeRunning())
ui->idlePipe();

// if (! fUi)
// {
// gtk_main_quit_if_needed();
// return false;
// }
ui->idleUI();

return true;
}


+ 11
- 8
source/bridges-ui/CarlaBridgeToolkitPlugin.cpp View File

@@ -65,7 +65,7 @@ public:
#endif
CARLA_SAFE_ASSERT_RETURN(fUI != nullptr, false);

fUI->setTitle(options.windowTitle);
fUI->setTitle(options.windowTitle.buffer());
fUI->setTransientWinId(options.transientWindowId);

return true;
@@ -90,12 +90,12 @@ public:

for (; fIdling;)
{
fUI->idle();
ui->idlePipe();
if (ui->isPipeRunning())
ui->idlePipe();

ui->idleUI();

//if (! kClient->oscIdle())
// break;
fUI->idle();

#if defined(CARLA_OS_WIN) || defined(CARLA_OS_MAC)
if (MessageManager* const msgMgr = MessageManager::getInstance())
@@ -108,13 +108,16 @@ public:

void quit() override
{
CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,);
carla_debug("CarlaBridgeToolkitPlugin::quit()");

fIdling = false;

delete fUI;
fUI = nullptr;
if (fUI != nullptr)
{
fUI->hide();
delete fUI;
fUI = nullptr;
}
}

void show() override


+ 4
- 9
source/bridges-ui/CarlaBridgeToolkitQt.cpp View File

@@ -112,7 +112,7 @@ public:
}

fWindow->setWindowIcon(QIcon::fromTheme("carla", QIcon(":/scalable/carla.svg")));
fWindow->setWindowTitle(options.windowTitle);
fWindow->setWindowTitle(options.windowTitle.buffer());

if (options.transientWindowId != 0)
{
@@ -226,15 +226,10 @@ protected:
{
CARLA_SAFE_ASSERT_RETURN(ui != nullptr,);

ui->idlePipe();
ui->idleUI();
if (ui->isPipeRunning())
ui->idlePipe();

// if (! kClient->oscIdle())
// {
// killTimer(fMsgTimer);
// fMsgTimer = 0;
// fApp->quit();
// }
ui->idleUI();
}

private:


+ 40
- 20
source/bridges-ui/CarlaBridgeUI-LV2.cpp View File

@@ -377,12 +377,6 @@ public:

bool init(const int argc, const char* argv[]) override
{
// -----------------------------------------------------------------
// init UI

if (! CarlaBridgeUI::init(argc, argv))
return false;

const char* pluginURI = argv[1];
const char* uiURI = argv[2];

@@ -422,6 +416,45 @@ public:

CARLA_SAFE_ASSERT_RETURN(fRdfUiDescriptor != nullptr, false);

// -----------------------------------------------------------
// check if not resizable

#if defined(BRIDGE_COCOA) || defined(BRIDGE_HWND) || defined(BRIDGE_X11)
// embed UIs can only be resizable if they provide resize extension
fUiOptions.isResizable = false;

for (uint32_t i=0; i < fRdfUiDescriptor->ExtensionCount; ++i)
{
carla_stdout("Test UI extension %s", fRdfUiDescriptor->Extensions[i]);

if (std::strcmp(fRdfUiDescriptor->Extensions[i], LV2_UI__resize) == 0)
{
fUiOptions.isResizable = true;
break;
}
}
#endif

for (uint32_t i=0; i < fRdfUiDescriptor->FeatureCount; ++i)
{
carla_stdout("Test UI feature %s", fRdfUiDescriptor->Features[i].URI);

if (std::strcmp(fRdfUiDescriptor->Features[i].URI, LV2_UI__fixedSize ) == 0 ||
std::strcmp(fRdfUiDescriptor->Features[i].URI, LV2_UI__noUserResize) == 0)
{
fUiOptions.isResizable = false;
break;
}
}

carla_stdout("Is resizable => %s", bool2str(fUiOptions.isResizable));

// -----------------------------------------------------------------
// init UI

if (! CarlaBridgeUI::init(argc, argv))
return false;

// -----------------------------------------------------------------
// open DLL

@@ -465,19 +498,6 @@ public:
fHandle = fDescriptor->instantiate(fDescriptor, fRdfDescriptor->URI, fRdfUiDescriptor->Bundle, carla_lv2_ui_write_function, this, &fWidget, fFeatures);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false);

// -----------------------------------------------------------
// check if not resizable

for (uint32_t j=0; j < fRdfUiDescriptor->FeatureCount; ++j)
{
if (std::strcmp(fRdfUiDescriptor->Features[j].URI, LV2_UI__fixedSize ) == 0 ||
std::strcmp(fRdfUiDescriptor->Features[j].URI, LV2_UI__noUserResize) == 0)
{
fUiOptions.isResizable = false;
break;
}
}

// -----------------------------------------------------------
// check for known extensions

@@ -568,7 +588,7 @@ public:

void dspAtomReceived(const uint32_t portIndex, const LV2_Atom* const atom) override
{
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,)
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(atom != nullptr,);



+ 7
- 0
source/bridges-ui/CarlaBridgeUI.cpp View File

@@ -245,6 +245,8 @@ bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept
{
fQuitReceived = true;
fToolkit->quit();
delete fToolkit;
fToolkit = nullptr;
return true;
}

@@ -300,6 +302,11 @@ bool CarlaBridgeUI::init(const int argc, const char* argv[])
}
#endif
}
else
{
// no mapping needed
fUridMapComplete = true;
}

return true;
}


+ 3
- 2
source/bridges-ui/CarlaBridgeUI.hpp View File

@@ -21,6 +21,7 @@
#include "CarlaBridgeToolkit.hpp"
#include "CarlaLibUtils.hpp"
#include "CarlaPipeUtils.hpp"
#include "CarlaString.hpp"

#ifdef BRIDGE_LV2
# include "lv2/atom.h"
@@ -115,7 +116,7 @@ public:
/*!
* Window title.
*/
const char* windowTitle;
CarlaString windowTitle;

/*!
* Transient window id (parent), null if zero.
@@ -129,7 +130,7 @@ public:
: isResizable(true),
useTheme(true),
useThemeColors(true),
windowTitle(nullptr),
windowTitle("TestUI"),
transientWindowId(0) {}
};



Loading…
Cancel
Save