From dc08d8032dd004dac876fbfe26a4a2a02a787e65 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 23 Mar 2020 22:57:56 +0100 Subject: [PATCH] Resize windows when needed --- src/wine-host/editor.cpp | 2 +- src/wine-host/plugin-bridge.cpp | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 6d6a027b..e996857e 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -45,7 +45,7 @@ HWND Editor::open() { CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_ACCEPTFILES, reinterpret_cast(window_class), "yabridge plugin", WS_POPUP, CW_USEDEFAULT, - CW_USEDEFAULT, 256, 256, nullptr, nullptr, + CW_USEDEFAULT, 2048, 2048, nullptr, nullptr, GetModuleHandle(nullptr), nullptr), &DestroyWindow); diff --git a/src/wine-host/plugin-bridge.cpp b/src/wine-host/plugin-bridge.cpp index 97fb9f7f..ace3f3ab 100644 --- a/src/wine-host/plugin-bridge.cpp +++ b/src/wine-host/plugin-bridge.cpp @@ -243,6 +243,17 @@ intptr_t PluginBridge::dispatch_wrapper(AEffect* plugin, return return_value; break; } + case effEditGetRect: { + const intptr_t return_value = + plugin->dispatcher(plugin, opcode, index, value, data, option); + + // Intercept these calls to make sure that the window (embedded + // within the X11 window) is large enough. + const auto size = **static_cast(data); + editor.resize(size); + + return return_value; + } default: return plugin->dispatcher(plugin, opcode, index, value, data, option); @@ -293,10 +304,9 @@ class HostCallbackDataConverter : DefaultDataConverter { return AEffect(*plugin); break; case audioMasterSizeWindow: - // TODO: Do all plugins send this? Or should we also use - // effEditGetRect`or add hooks int oresize events. - // The plugin sends it's own width and hieght in the index and - // value parameters + // TODO: Does the plugin not do this automatically? Check Some + // plugins will the host that their size has changed, so + // we'll have to change the window for it. editor.resize(VstRect{0, 0, static_cast(value), static_cast(index)});