From 6f65613292821c90855a88474fc19a0009888e5a Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Thu, 22 May 2025 14:05:14 +0900 Subject: [PATCH] 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. --- src/wine-host/bridges/vst3.cpp | 11 +++++++++-- src/wine-host/editor.cpp | 5 +++-- src/wine-host/editor.h | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 35d59cce..eb004526 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -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 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()); diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 40c01e9d..11316c34 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -256,12 +256,13 @@ Editor::Editor(MainContext& main_context, const Configuration& config, Logger& logger, const size_t parent_window_handle, - std::optional> timer_proc) + std::optional> timer_proc, + std::optional 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 diff --git a/src/wine-host/editor.h b/src/wine-host/editor.h index 52eaa4f5..a23dfd4b 100644 --- a/src/wine-host/editor.h +++ b/src/wine-host/editor.h @@ -194,7 +194,8 @@ class Editor { const Configuration& config, Logger& logger, const size_t parent_window_handle, - std::optional> timer_proc = std::nullopt); + std::optional> timer_proc = std::nullopt, + std::optional initial_size = std::nullopt); /** * Resize the `wrapper_window_` to this new size. We need to manually call