From d60fc69a9d023750f3be9d69bc85549d28098b32 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 21 Apr 2013 00:29:50 +0100 Subject: [PATCH] Implement UIsAlwaysOnTop option in backend; Enable ui-bridge option --- resources/ui/carla_settings.ui | 3 - .../native/distrho/DistrhoPluginCarla.cpp | 10 +++- source/backend/plugin/CarlaPluginGui.cpp | 11 +++- source/backend/plugin/Lv2Plugin.cpp | 56 +++++++++++++++---- 4 files changed, 61 insertions(+), 19 deletions(-) diff --git a/resources/ui/carla_settings.ui b/resources/ui/carla_settings.ui index 987ccbe74..cdc6b6442 100644 --- a/resources/ui/carla_settings.ui +++ b/resources/ui/carla_settings.ui @@ -854,9 +854,6 @@ You can disable these checks to get a faster scanning time (at your own risk). - - false - Use OSC-GUI bridges when possible, this way separating the UI from DSP code diff --git a/source/backend/native/distrho/DistrhoPluginCarla.cpp b/source/backend/native/distrho/DistrhoPluginCarla.cpp index c367a8fee..0887122a4 100644 --- a/source/backend/native/distrho/DistrhoPluginCarla.cpp +++ b/source/backend/native/distrho/DistrhoPluginCarla.cpp @@ -19,7 +19,7 @@ #include "DistrhoPluginMain.cpp" -#include +#include #if DISTRHO_PLUGIN_HAS_UI # if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) @@ -52,7 +52,6 @@ public: fUi(this, 0, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, uiResizeCallback) #endif { - setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint); #ifdef DISTRHO_UI_OPENGL setCentralWidget(&fWidget); #else @@ -63,6 +62,13 @@ public: setWindowTitle(QString("%1 (GUI)").arg(fUi.name())); uiResize(fUi.width(), fUi.height()); + + { + QSettings settings; + + if (settings.value("Engine/UIsAlwaysOnTop", true).toBool()) + setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint); + } } ~UICarla() diff --git a/source/backend/plugin/CarlaPluginGui.cpp b/source/backend/plugin/CarlaPluginGui.cpp index e40ecf26d..4d3be115c 100644 --- a/source/backend/plugin/CarlaPluginGui.cpp +++ b/source/backend/plugin/CarlaPluginGui.cpp @@ -17,6 +17,8 @@ #include "CarlaPluginGui.hpp" +# include + #ifdef Q_WS_X11 # include #endif @@ -52,9 +54,14 @@ CarlaPluginGui::CarlaPluginGui(CarlaEngine* const engine, Callback* const callba setWindowFlags(windowFlags()|Qt::MSWindowsFixedSizeDialogHint); #endif - setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint); - connect(this, SIGNAL(setSizeSafeSignal(int,int)), SLOT(setSizeSafeSlot(int,int))); + + { + QSettings settings; + + if (settings.value("Engine/UIsAlwaysOnTop", true).toBool()) + setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint); + } } CarlaPluginGui::~CarlaPluginGui() diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index 2f541b7f1..dd785cb98 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -3239,6 +3239,45 @@ protected: // ------------------------------------------------------------------- + LV2_Worker_Status handleWorkerSchedule(const uint32_t size, const void* const data) + { + carla_stdout("Lv2Plugin::handleWorkerSchedule(%i, %p)", size, data); + +#if 0 + if (! ext.worker) + { + carla_stderr("Lv2Plugin::handleWorkerSchedule(%i, %p) - plugin has no worker", size, data); + return LV2_WORKER_ERR_UNKNOWN; + } + + if (x_engine->isOffline()) + ext.worker->work(handle, carla_lv2_worker_respond, this, size, data); + else + postponeEvent(PluginPostEventCustom, size, 0, 0.0, data); +#endif + + return LV2_WORKER_SUCCESS; + } + + LV2_Worker_Status handleWorkerRespond(const uint32_t size, const void* const data) + { + carla_stdout("Lv2Plugin::handleWorkerRespond(%i, %p)", size, data); + +#if 0 + LV2_Atom_Worker workerAtom; + workerAtom.atom.type = CARLA_URI_MAP_ID_ATOM_WORKER; + workerAtom.atom.size = sizeof(LV2_Atom_Worker_Body); + workerAtom.body.size = size; + workerAtom.body.data = data; + + atomQueueIn.put(0, (const LV2_Atom*)&workerAtom); +#endif + + return LV2_WORKER_SUCCESS; + } + + // ------------------------------------------------------------------- + void handleExternalUiClosed() { CARLA_ASSERT(fUi.type == PLUGIN_UI_EXTERNAL); @@ -3595,6 +3634,9 @@ public: fFeatures[kFeatureIdWorker]->URI = LV2_WORKER__schedule; fFeatures[kFeatureIdWorker]->data = workerFt; + if (! needsFixedBuffer()) + fFeatures[kFeatureIdBufSizeFixed]->URI = LV2_BUF_SIZE__boundedBlockLength; + // --------------------------------------------------------------- // get DLL main entry @@ -4475,12 +4517,7 @@ private: if (handle == nullptr) return LV2_WORKER_ERR_UNKNOWN; - //return ((Lv2Plugin*)handle)->handleWorkerSchedule(size, data); - return LV2_WORKER_ERR_UNKNOWN; - - // todo - (void)size; - (void)data; + return ((Lv2Plugin*)handle)->handleWorkerSchedule(size, data); } static LV2_Worker_Status carla_lv2_worker_respond(LV2_Worker_Respond_Handle handle, uint32_t size, const void* data) @@ -4491,12 +4528,7 @@ private: if (handle == nullptr) return LV2_WORKER_ERR_UNKNOWN; - //return ((Lv2Plugin*)handle)->handleWorkerRespond(size, data); - return LV2_WORKER_ERR_UNKNOWN; - - // todo - (void)size; - (void)data; + return ((Lv2Plugin*)handle)->handleWorkerRespond(size, data); } // -------------------------------------------------------------------