Resize windows when needed

This commit is contained in:
Robbert van der Helm
2020-03-23 22:57:56 +01:00
parent d2be82285a
commit dc08d8032d
2 changed files with 15 additions and 5 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ HWND Editor::open() {
CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_ACCEPTFILES, CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_ACCEPTFILES,
reinterpret_cast<LPCSTR>(window_class), reinterpret_cast<LPCSTR>(window_class),
"yabridge plugin", WS_POPUP, CW_USEDEFAULT, "yabridge plugin", WS_POPUP, CW_USEDEFAULT,
CW_USEDEFAULT, 256, 256, nullptr, nullptr, CW_USEDEFAULT, 2048, 2048, nullptr, nullptr,
GetModuleHandle(nullptr), nullptr), GetModuleHandle(nullptr), nullptr),
&DestroyWindow); &DestroyWindow);
+14 -4
View File
@@ -243,6 +243,17 @@ intptr_t PluginBridge::dispatch_wrapper(AEffect* plugin,
return return_value; return return_value;
break; 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<VstRect**>(data);
editor.resize(size);
return return_value;
}
default: default:
return plugin->dispatcher(plugin, opcode, index, value, data, return plugin->dispatcher(plugin, opcode, index, value, data,
option); option);
@@ -293,10 +304,9 @@ class HostCallbackDataConverter : DefaultDataConverter {
return AEffect(*plugin); return AEffect(*plugin);
break; break;
case audioMasterSizeWindow: case audioMasterSizeWindow:
// TODO: Do all plugins send this? Or should we also use // TODO: Does the plugin not do this automatically? Check Some
// effEditGetRect`or add hooks int oresize events. // plugins will the host that their size has changed, so
// The plugin sends it's own width and hieght in the index and // we'll have to change the window for it.
// value parameters
editor.resize(VstRect{0, 0, static_cast<short>(value), editor.resize(VstRect{0, 0, static_cast<short>(value),
static_cast<short>(index)}); static_cast<short>(index)});