@@ -85,7 +85,7 @@ public: | |||||
gtk_container_add(GTK_CONTAINER(fWindow), widget); | gtk_container_add(GTK_CONTAINER(fWindow), widget); | ||||
gtk_window_set_resizable(gtkWindow, options.isResizable); | 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) | if (showUI || fNeedsShow) | ||||
{ | { | ||||
@@ -195,14 +195,10 @@ protected: | |||||
gtk_window_get_size(GTK_WINDOW(fWindow), &fLastWidth, &fLastHeight); | 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; | return true; | ||||
} | } | ||||
@@ -65,7 +65,7 @@ public: | |||||
#endif | #endif | ||||
CARLA_SAFE_ASSERT_RETURN(fUI != nullptr, false); | CARLA_SAFE_ASSERT_RETURN(fUI != nullptr, false); | ||||
fUI->setTitle(options.windowTitle); | |||||
fUI->setTitle(options.windowTitle.buffer()); | |||||
fUI->setTransientWinId(options.transientWindowId); | fUI->setTransientWinId(options.transientWindowId); | ||||
return true; | return true; | ||||
@@ -90,12 +90,12 @@ public: | |||||
for (; fIdling;) | for (; fIdling;) | ||||
{ | { | ||||
fUI->idle(); | |||||
ui->idlePipe(); | |||||
if (ui->isPipeRunning()) | |||||
ui->idlePipe(); | |||||
ui->idleUI(); | ui->idleUI(); | ||||
//if (! kClient->oscIdle()) | |||||
// break; | |||||
fUI->idle(); | |||||
#if defined(CARLA_OS_WIN) || defined(CARLA_OS_MAC) | #if defined(CARLA_OS_WIN) || defined(CARLA_OS_MAC) | ||||
if (MessageManager* const msgMgr = MessageManager::getInstance()) | if (MessageManager* const msgMgr = MessageManager::getInstance()) | ||||
@@ -108,13 +108,16 @@ public: | |||||
void quit() override | void quit() override | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||||
carla_debug("CarlaBridgeToolkitPlugin::quit()"); | carla_debug("CarlaBridgeToolkitPlugin::quit()"); | ||||
fIdling = false; | fIdling = false; | ||||
delete fUI; | |||||
fUI = nullptr; | |||||
if (fUI != nullptr) | |||||
{ | |||||
fUI->hide(); | |||||
delete fUI; | |||||
fUI = nullptr; | |||||
} | |||||
} | } | ||||
void show() override | void show() override | ||||
@@ -112,7 +112,7 @@ public: | |||||
} | } | ||||
fWindow->setWindowIcon(QIcon::fromTheme("carla", QIcon(":/scalable/carla.svg"))); | fWindow->setWindowIcon(QIcon::fromTheme("carla", QIcon(":/scalable/carla.svg"))); | ||||
fWindow->setWindowTitle(options.windowTitle); | |||||
fWindow->setWindowTitle(options.windowTitle.buffer()); | |||||
if (options.transientWindowId != 0) | if (options.transientWindowId != 0) | ||||
{ | { | ||||
@@ -226,15 +226,10 @@ protected: | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(ui != nullptr,); | 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: | private: | ||||
@@ -377,12 +377,6 @@ public: | |||||
bool init(const int argc, const char* argv[]) override | 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* pluginURI = argv[1]; | ||||
const char* uiURI = argv[2]; | const char* uiURI = argv[2]; | ||||
@@ -422,6 +416,45 @@ public: | |||||
CARLA_SAFE_ASSERT_RETURN(fRdfUiDescriptor != nullptr, false); | 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 | // open DLL | ||||
@@ -465,19 +498,6 @@ public: | |||||
fHandle = fDescriptor->instantiate(fDescriptor, fRdfDescriptor->URI, fRdfUiDescriptor->Bundle, carla_lv2_ui_write_function, this, &fWidget, fFeatures); | fHandle = fDescriptor->instantiate(fDescriptor, fRdfDescriptor->URI, fRdfUiDescriptor->Bundle, carla_lv2_ui_write_function, this, &fWidget, fFeatures); | ||||
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false); | 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 | // check for known extensions | ||||
@@ -568,7 +588,7 @@ public: | |||||
void dspAtomReceived(const uint32_t portIndex, const LV2_Atom* const atom) override | 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(fDescriptor != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(atom != nullptr,); | CARLA_SAFE_ASSERT_RETURN(atom != nullptr,); | ||||
@@ -245,6 +245,8 @@ bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept | |||||
{ | { | ||||
fQuitReceived = true; | fQuitReceived = true; | ||||
fToolkit->quit(); | fToolkit->quit(); | ||||
delete fToolkit; | |||||
fToolkit = nullptr; | |||||
return true; | return true; | ||||
} | } | ||||
@@ -300,6 +302,11 @@ bool CarlaBridgeUI::init(const int argc, const char* argv[]) | |||||
} | } | ||||
#endif | #endif | ||||
} | } | ||||
else | |||||
{ | |||||
// no mapping needed | |||||
fUridMapComplete = true; | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
@@ -21,6 +21,7 @@ | |||||
#include "CarlaBridgeToolkit.hpp" | #include "CarlaBridgeToolkit.hpp" | ||||
#include "CarlaLibUtils.hpp" | #include "CarlaLibUtils.hpp" | ||||
#include "CarlaPipeUtils.hpp" | #include "CarlaPipeUtils.hpp" | ||||
#include "CarlaString.hpp" | |||||
#ifdef BRIDGE_LV2 | #ifdef BRIDGE_LV2 | ||||
# include "lv2/atom.h" | # include "lv2/atom.h" | ||||
@@ -115,7 +116,7 @@ public: | |||||
/*! | /*! | ||||
* Window title. | * Window title. | ||||
*/ | */ | ||||
const char* windowTitle; | |||||
CarlaString windowTitle; | |||||
/*! | /*! | ||||
* Transient window id (parent), null if zero. | * Transient window id (parent), null if zero. | ||||
@@ -129,7 +130,7 @@ public: | |||||
: isResizable(true), | : isResizable(true), | ||||
useTheme(true), | useTheme(true), | ||||
useThemeColors(true), | useThemeColors(true), | ||||
windowTitle(nullptr), | |||||
windowTitle("TestUI"), | |||||
transientWindowId(0) {} | transientWindowId(0) {} | ||||
}; | }; | ||||