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,
reinterpret_cast<LPCSTR>(window_class),
"yabridge plugin", WS_POPUP, CW_USEDEFAULT,
CW_USEDEFAULT, 256, 256, nullptr, nullptr,
CW_USEDEFAULT, 2048, 2048, nullptr, nullptr,
GetModuleHandle(nullptr), nullptr),
&DestroyWindow);
+14 -4
View File
@@ -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<VstRect**>(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<short>(value),
static_cast<short>(index)});