| @@ -119,6 +119,13 @@ public: | |||||
| it will return 0 when called from anywhere else. | it will return 0 when called from anywhere else. | ||||
| */ | */ | ||||
| static uintptr_t getNextWindowId() noexcept; | static uintptr_t getNextWindowId() noexcept; | ||||
| /** | |||||
| Get the bundle path that will be used for the next UI. | |||||
| @note: This function is only valid during createUI(), | |||||
| it will return null when called from anywhere else. | |||||
| */ | |||||
| static const char* getNextBundlePath() noexcept; | |||||
| #endif | #endif | ||||
| protected: | protected: | ||||
| @@ -25,12 +25,13 @@ START_NAMESPACE_DISTRHO | |||||
| /* ------------------------------------------------------------------------------------------------------------ | /* ------------------------------------------------------------------------------------------------------------ | ||||
| * Static data, see DistrhoUIInternal.hpp */ | * Static data, see DistrhoUIInternal.hpp */ | ||||
| double d_lastUiSampleRate = 0.0; | |||||
| void* d_lastUiDspPtr = nullptr; | |||||
| double d_lastUiSampleRate = 0.0; | |||||
| void* d_lastUiDspPtr = nullptr; | |||||
| #ifdef HAVE_DGL | #ifdef HAVE_DGL | ||||
| Window* d_lastUiWindow = nullptr; | |||||
| Window* d_lastUiWindow = nullptr; | |||||
| #endif | #endif | ||||
| uintptr_t g_nextWindowId = 0; | |||||
| uintptr_t g_nextWindowId = 0; | |||||
| const char* g_nextBundlePath = nullptr; | |||||
| /* ------------------------------------------------------------------------------------------------------------ | /* ------------------------------------------------------------------------------------------------------------ | ||||
| * UI */ | * UI */ | ||||
| @@ -106,6 +107,11 @@ uintptr_t UI::getNextWindowId() noexcept | |||||
| { | { | ||||
| return g_nextWindowId; | return g_nextWindowId; | ||||
| } | } | ||||
| const char* UI::getNextBundlePath() noexcept | |||||
| { | |||||
| return g_nextBundlePath; | |||||
| } | |||||
| #endif | #endif | ||||
| /* ------------------------------------------------------------------------------------------------------------ | /* ------------------------------------------------------------------------------------------------------------ | ||||
| @@ -32,12 +32,13 @@ START_NAMESPACE_DISTRHO | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // Static data, see DistrhoUI.cpp | // Static data, see DistrhoUI.cpp | ||||
| extern double d_lastUiSampleRate; | |||||
| extern void* d_lastUiDspPtr; | |||||
| extern double d_lastUiSampleRate; | |||||
| extern void* d_lastUiDspPtr; | |||||
| #ifdef HAVE_DGL | #ifdef HAVE_DGL | ||||
| extern Window* d_lastUiWindow; | |||||
| extern Window* d_lastUiWindow; | |||||
| #endif | #endif | ||||
| extern uintptr_t g_nextWindowId; | |||||
| extern uintptr_t g_nextWindowId; | |||||
| extern const char* g_nextBundlePath; | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // UI callbacks | // UI callbacks | ||||
| @@ -199,13 +200,15 @@ private: | |||||
| }; | }; | ||||
| #else | #else | ||||
| static inline | static inline | ||||
| UI* createUiWrapper(void* const dspPtr, const uintptr_t winId) | |||||
| UI* createUiWrapper(void* const dspPtr, const uintptr_t winId, const char* const bundlePath) | |||||
| { | { | ||||
| d_lastUiDspPtr = dspPtr; | |||||
| g_nextWindowId = winId; | |||||
| UI* const ret = createUI(); | |||||
| d_lastUiDspPtr = nullptr; | |||||
| g_nextWindowId = 0; | |||||
| d_lastUiDspPtr = dspPtr; | |||||
| g_nextWindowId = winId; | |||||
| g_nextBundlePath = bundlePath; | |||||
| UI* const ret = createUI(); | |||||
| d_lastUiDspPtr = nullptr; | |||||
| g_nextWindowId = 0; | |||||
| g_nextBundlePath = nullptr; | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -218,14 +221,15 @@ class UIExporter | |||||
| public: | public: | ||||
| UIExporter(void* const ptr, const intptr_t winId, | UIExporter(void* const ptr, const intptr_t winId, | ||||
| const editParamFunc editParamCall, const setParamFunc setParamCall, const setStateFunc setStateCall, const sendNoteFunc sendNoteCall, const setSizeFunc setSizeCall, | const editParamFunc editParamCall, const setParamFunc setParamCall, const setStateFunc setStateCall, const sendNoteFunc sendNoteCall, const setSizeFunc setSizeCall, | ||||
| void* const dspPtr = nullptr) | |||||
| void* const dspPtr = nullptr, | |||||
| const char* const bundlePath = nullptr) | |||||
| #ifdef HAVE_DGL | #ifdef HAVE_DGL | ||||
| : glApp(), | : glApp(), | ||||
| glWindow(glApp, winId, dspPtr), | glWindow(glApp, winId, dspPtr), | ||||
| fChangingSize(false), | fChangingSize(false), | ||||
| fUI(glWindow.getUI()), | fUI(glWindow.getUI()), | ||||
| #else | #else | ||||
| : fUI(createUiWrapper(dspPtr, winId)), | |||||
| : fUI(createUiWrapper(dspPtr, winId, bundlePath)), | |||||
| #endif | #endif | ||||
| fData((fUI != nullptr) ? fUI->pData : nullptr) | fData((fUI != nullptr) ? fUI->pData : nullptr) | ||||
| { | { | ||||
| @@ -238,6 +242,11 @@ public: | |||||
| fData->setStateCallbackFunc = setStateCall; | fData->setStateCallbackFunc = setStateCall; | ||||
| fData->sendNoteCallbackFunc = sendNoteCall; | fData->sendNoteCallbackFunc = sendNoteCall; | ||||
| fData->setSizeCallbackFunc = setSizeCall; | fData->setSizeCallbackFunc = setSizeCall; | ||||
| #ifdef HAVE_DGL | |||||
| // unused | |||||
| return; (void)bundlePath; | |||||
| #endif | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -39,11 +39,11 @@ START_NAMESPACE_DISTRHO | |||||
| class UiLv2 | class UiLv2 | ||||
| { | { | ||||
| public: | public: | ||||
| UiLv2(const intptr_t winId, | |||||
| UiLv2(const char* const bundlePath, const intptr_t winId, | |||||
| const LV2_Options_Option* options, const LV2_URID_Map* const uridMap, const LV2UI_Resize* const uiResz, const LV2UI_Touch* uiTouch, | const LV2_Options_Option* options, const LV2_URID_Map* const uridMap, const LV2UI_Resize* const uiResz, const LV2UI_Touch* uiTouch, | ||||
| const LV2UI_Controller controller, const LV2UI_Write_Function writeFunc, | const LV2UI_Controller controller, const LV2UI_Write_Function writeFunc, | ||||
| LV2UI_Widget* const widget, void* const dspPtr) | LV2UI_Widget* const widget, void* const dspPtr) | ||||
| : fUI(this, winId, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, setSizeCallback, dspPtr), | |||||
| : fUI(this, winId, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, setSizeCallback, dspPtr, bundlePath), | |||||
| fUridMap(uridMap), | fUridMap(uridMap), | ||||
| fUiResize(uiResz), | fUiResize(uiResz), | ||||
| fUiTouch(uiTouch), | fUiTouch(uiTouch), | ||||
| @@ -319,7 +319,8 @@ private: | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, const char*, LV2UI_Write_Function writeFunction, LV2UI_Controller controller, LV2UI_Widget* widget, const LV2_Feature* const* features) | |||||
| static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, const char* bundlePath, | |||||
| LV2UI_Write_Function writeFunction, LV2UI_Controller controller, LV2UI_Widget* widget, const LV2_Feature* const* features) | |||||
| { | { | ||||
| if (uri == nullptr || std::strcmp(uri, DISTRHO_PLUGIN_URI) != 0) | if (uri == nullptr || std::strcmp(uri, DISTRHO_PLUGIN_URI) != 0) | ||||
| { | { | ||||
| @@ -421,7 +422,7 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, | |||||
| d_lastUiSampleRate = 44100.0; | d_lastUiSampleRate = 44100.0; | ||||
| } | } | ||||
| return new UiLv2(winId, options, uridMap, uiResize, uiTouch, controller, writeFunction, widget, instance); | |||||
| return new UiLv2(bundlePath, winId, options, uridMap, uiResize, uiTouch, controller, writeFunction, widget, instance); | |||||
| } | } | ||||
| #define uiPtr ((UiLv2*)ui) | #define uiPtr ((UiLv2*)ui) | ||||