| @@ -341,14 +341,34 @@ public: | |||||
| int32_t value = 0; | int32_t value = 0; | ||||
| void* const ptr = (void*)container->winId(); | void* const ptr = (void*)container->winId(); | ||||
| ERect* vstRect = nullptr; | |||||
| #ifdef Q_WS_X11 | #ifdef Q_WS_X11 | ||||
| value = (intptr_t)QX11Info::display(); | value = (intptr_t)QX11Info::display(); | ||||
| #endif | #endif | ||||
| // get UI size before opening UI, plugin may refuse this | |||||
| effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f); | |||||
| if (vstRect) | |||||
| { | |||||
| int width = vstRect->right - vstRect->left; | |||||
| int height = vstRect->bottom - vstRect->top; | |||||
| if (width > 0 || height > 0) | |||||
| { | |||||
| container->setFixedSize(width, height); | |||||
| #ifdef BUILD_BRIDGE | |||||
| x_engine->callback(CALLBACK_RESIZE_GUI, m_id, width, height, 1.0); | |||||
| #endif | |||||
| } | |||||
| } | |||||
| // open UI | |||||
| if (effect->dispatcher(effect, effEditOpen, 0, value, ptr, 0.0f) == 1) | if (effect->dispatcher(effect, effEditOpen, 0, value, ptr, 0.0f) == 1) | ||||
| { | { | ||||
| ERect* vstRect = nullptr; | |||||
| // get UI size again, can't fail now | |||||
| vstRect = nullptr; | |||||
| effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f); | effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f); | ||||
| if (vstRect) | if (vstRect) | ||||
| @@ -358,7 +378,7 @@ public: | |||||
| if (width <= 0 || height <= 0) | if (width <= 0 || height <= 0) | ||||
| { | { | ||||
| qCritical("VstPlugin::setGuiContainer(%p) - failed to get proper window size", container); | |||||
| qCritical("VstPlugin::setGuiContainer(%p) - failed to get proper editor size", container); | |||||
| return; | return; | ||||
| } | } | ||||
| @@ -369,7 +389,7 @@ public: | |||||
| qDebug("VstPlugin::setGuiContainer(%p) -> setFixedSize(%i, %i)", container, width, height); | qDebug("VstPlugin::setGuiContainer(%p) -> setFixedSize(%i, %i)", container, width, height); | ||||
| } | } | ||||
| else | else | ||||
| qCritical("VstPlugin::setGuiContainer(%p) - failed to get plugin window size", container); | |||||
| qCritical("VstPlugin::setGuiContainer(%p) - failed to get plugin editor size", container); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -226,7 +226,7 @@ public: | |||||
| engine = nullptr; | engine = nullptr; | ||||
| plugin = nullptr; | plugin = nullptr; | ||||
| pluginGui = new BridgePluginGUI(nullptr, this); | |||||
| pluginGui = nullptr; | |||||
| m_client = this; | m_client = this; | ||||
| } | } | ||||
| @@ -254,6 +254,9 @@ public: | |||||
| void init() | void init() | ||||
| { | { | ||||
| qDebug("BridgePluginClient::init()"); | qDebug("BridgePluginClient::init()"); | ||||
| pluginGui = new BridgePluginGUI(nullptr, this); | |||||
| pluginGui->hide(); | |||||
| } | } | ||||
| void exec(CarlaClient* const, const bool showGui) | void exec(CarlaClient* const, const bool showGui) | ||||
| @@ -552,8 +555,17 @@ public: | |||||
| case CarlaBackend::CALLBACK_RESIZE_GUI: | case CarlaBackend::CALLBACK_RESIZE_GUI: | ||||
| CARLA_ASSERT(value1 > 0 && value2 > 0); | CARLA_ASSERT(value1 > 0 && value2 > 0); | ||||
| nextWidth = value1; | |||||
| nextHeight = value2; | |||||
| if (value3 == 1.0) | |||||
| { | |||||
| nextWidth = 0; | |||||
| nextHeight = 0; | |||||
| pluginGui->setFixedSize(value1, value2); | |||||
| } | |||||
| else if (nextWidth != value1 && nextHeight != value2) | |||||
| { | |||||
| nextWidth = value1; | |||||
| nextHeight = value2; | |||||
| } | |||||
| break; | break; | ||||
| case CarlaBackend::CALLBACK_RELOAD_PARAMETERS: | case CarlaBackend::CALLBACK_RELOAD_PARAMETERS: | ||||
| @@ -674,7 +686,6 @@ int main(int argc, char* argv[]) | |||||
| qargc = argc; | qargc = argc; | ||||
| qargv = argv; | qargv = argv; | ||||
| initSignalHandler(); | |||||
| const char* const oscUrl = argv[1]; | const char* const oscUrl = argv[1]; | ||||
| const char* const stype = argv[2]; | const char* const stype = argv[2]; | ||||
| @@ -715,6 +726,9 @@ int main(int argc, char* argv[]) | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| // Listen for ctrl+c or sigint/sigterm events | |||||
| initSignalHandler(); | |||||
| // Init backend engine | // Init backend engine | ||||
| CarlaBackend::CarlaEngine* engine = CarlaBackend::CarlaEngine::newDriverByName("JACK"); | CarlaBackend::CarlaEngine* engine = CarlaBackend::CarlaEngine::newDriverByName("JACK"); | ||||
| engine->setCallback(client.callback, &client); | engine->setCallback(client.callback, &client); | ||||
| @@ -737,7 +751,7 @@ int main(int argc, char* argv[]) | |||||
| return 2; | return 2; | ||||
| } | } | ||||
| /// Init plugin | |||||
| // Init plugin | |||||
| short id = engine->addPlugin(itype, filename, name, label); | short id = engine->addPlugin(itype, filename, name, label); | ||||
| int ret; | int ret; | ||||