diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 70388205..9702f7fd 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -1001,6 +1001,20 @@ void Vst3Logger::log_response(bool is_host_vst, }); } +void Vst3Logger::log_response( + bool is_host_vst, + const YaPlugView::CheckSizeConstraintResponse& response) { + log_response_base(is_host_vst, [&](auto& message) { + message << response.result.string(); + if (response.result == Steinberg::kResultOk) { + message << ", "; + } + }); +} + void Vst3Logger::log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs& args) { log_response_base(is_host_vst, [&](auto& message) { diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index 7cf87565..2eca806e 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -180,6 +180,8 @@ class Vst3Logger { void log_response(bool is_host_vst, const YaEditController::CreateViewResponse&); void log_response(bool is_host_vst, const YaPlugView::GetSizeResponse&); + void log_response(bool is_host_vst, + const YaPlugView::CheckSizeConstraintResponse&); void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&); void log_response(bool is_host_vst, const Configuration&); void log_response(bool is_host_vst, diff --git a/src/common/serialization/vst3/plug-view/plug-view.h b/src/common/serialization/vst3/plug-view/plug-view.h index 1cd663c4..849cc515 100644 --- a/src/common/serialization/vst3/plug-view/plug-view.h +++ b/src/common/serialization/vst3/plug-view/plug-view.h @@ -320,14 +320,27 @@ class YaPlugView : public Steinberg::IPlugView { virtual tresult PLUGIN_API canResize() override = 0; + /** + * The result and updated `ViewRect` from a call to + * `IPlugView::checkSizeConstraint(rect)`. + */ + struct CheckSizeConstraintResponse { + UniversalTResult result; + Steinberg::ViewRect updated_rect; + + template + void serialize(S& s) { + s.object(result); + s.object(updated_rect); + } + }; + /** * Message to pass through a call to `IPlugView::checkSizeConstraint(rect)` * to the Wine plugin host. - * - * TODO: This should also return the updated ViewRect */ struct CheckSizeConstraint { - using Response = UniversalTResult; + using Response = CheckSizeConstraintResponse; native_size_t owner_instance_id; diff --git a/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp b/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp index 3485b73e..1a5d0160 100644 --- a/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp @@ -146,8 +146,13 @@ tresult PLUGIN_API Vst3PlugViewProxyImpl::canResize() { tresult PLUGIN_API Vst3PlugViewProxyImpl::checkSizeConstraint(Steinberg::ViewRect* rect) { if (rect) { - return bridge.send_message(YaPlugView::CheckSizeConstraint{ - .owner_instance_id = owner_instance_id(), .rect = *rect}); + const CheckSizeConstraintResponse response = + bridge.send_message(YaPlugView::CheckSizeConstraint{ + .owner_instance_id = owner_instance_id(), .rect = *rect}); + + *rect = response.updated_rect; + + return response.result; } else { bridge.logger.log( "WARNING: Null pointer passed to " diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 8e89907d..732a1ca5 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -530,8 +530,12 @@ void Vst3Bridge::run() { }, [&](YaPlugView::CheckSizeConstraint& request) -> YaPlugView::CheckSizeConstraint::Response { - return object_instances[request.owner_instance_id] - .plug_view->checkSizeConstraint(&request.rect); + const tresult result = + object_instances[request.owner_instance_id] + .plug_view->checkSizeConstraint(&request.rect); + + return YaPlugView::CheckSizeConstraintResponse{ + .result = result, .updated_rect = std::move(request.rect)}; }, [&](YaPluginBase::Initialize& request) -> YaPluginBase::Initialize::Response {