VST3: Create the window with the plugin-returned initial size

Instead of creating the window as 128x128 and then resizing, create it
with the size requested by the plugin. Fixes Korg VST3 plugins.
This commit is contained in:
Asahi Lina
2025-05-22 14:05:14 +09:00
committed by Robbert van der Helm
parent b2db9cc0a6
commit 6f65613292
3 changed files with 14 additions and 5 deletions
+9 -2
View File
@@ -799,9 +799,16 @@ void Vst3Bridge::run() {
// be done in the main UI thread
return main_context_
.run_in_context([&, &instance = instance]() -> tresult {
Steinberg::ViewRect size;
std::optional<Size> initial_size;
if (instance.plug_view_instance->plug_view->getSize(
&size) == Steinberg::kResultOk) {
initial_size.emplace(size.getWidth(),
size.getHeight());
}
Editor& editor_instance = instance.editor.emplace(
main_context_, config_, generic_logger_,
x11_handle);
main_context_, config_, generic_logger_, x11_handle,
std::nullopt, initial_size);
const tresult result =
instance.plug_view_instance->plug_view->attached(
editor_instance.win32_handle(), type.c_str());
+3 -2
View File
@@ -256,12 +256,13 @@ Editor::Editor(MainContext& main_context,
const Configuration& config,
Logger& logger,
const size_t parent_window_handle,
std::optional<fu2::unique_function<void()>> timer_proc)
std::optional<fu2::unique_function<void()>> timer_proc,
std::optional<Size> initial_size)
: use_force_dnd_(config.editor_force_dnd),
logger_(logger),
x11_connection_(xcb_connect(nullptr, nullptr), xcb_disconnect),
dnd_proxy_handle_(WineXdndProxy::get_handle()),
wrapper_window_size_({128, 128}),
wrapper_window_size_(initial_size.value_or(Size(128, 128))),
host_window_config_({}),
parent_window_config_({}),
// Create a window without any decoratiosn for easy embedding. The
+2 -1
View File
@@ -194,7 +194,8 @@ class Editor {
const Configuration& config,
Logger& logger,
const size_t parent_window_handle,
std::optional<fu2::unique_function<void()>> timer_proc = std::nullopt);
std::optional<fu2::unique_function<void()>> timer_proc = std::nullopt,
std::optional<Size> initial_size = std::nullopt);
/**
* Resize the `wrapper_window_` to this new size. We need to manually call