diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 6a173766..a4048bfc 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -432,6 +432,21 @@ bool Vst3Logger::log_request(bool is_host_vst, }); } +bool Vst3Logger::log_request( + bool is_host_vst, + const YaPlugView::IsPlatformTypeSupported& request) { + return log_request_base(is_host_vst, [&](auto& message) { + message << request.owner_instance_id + << ": IPlugView::isPLatformTypeSupported(type = \"" + << request.type; + if (request.type == Steinberg::kPlatformTypeX11EmbedWindowID) { + message << "\" (will be translated to \"" + << Steinberg::kPlatformTypeHWND << "\")"; + } + message << ")"; + }); +} + bool Vst3Logger::log_request(bool is_host_vst, const YaPluginBase::Initialize& request) { return log_request_base(is_host_vst, [&](auto& message) { diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index 3e02db4f..1cbff659 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -108,6 +108,8 @@ class Vst3Logger { bool log_request(bool is_host_vst, const YaEditController::SetComponentHandler&); bool log_request(bool is_host_vst, const YaEditController::CreateView&); + bool log_request(bool is_host_vst, + const YaPlugView::IsPlatformTypeSupported&); bool log_request(bool is_host_vst, const YaPluginBase::Initialize&); bool log_request(bool is_host_vst, const YaPluginBase::Terminate&); bool log_request(bool is_host_vst, const YaPluginFactory::Construct&); diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index f870e2ed..4a6ee6e0 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -92,6 +92,7 @@ using ControlRequest = std::variant + void serialize(S& s) { + s.value8b(owner_instance_id); + s.text1b(type, 128); + } + }; + virtual tresult PLUGIN_API isPlatformTypeSupported(Steinberg::FIDString type) override = 0; virtual tresult PLUGIN_API attached(void* parent, diff --git a/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp b/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp index 28b23c13..ea30b644 100644 --- a/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp @@ -42,9 +42,10 @@ Vst3PlugViewProxyImpl::queryInterface(const Steinberg::TUID _iid, void** obj) { tresult PLUGIN_API Vst3PlugViewProxyImpl::isPlatformTypeSupported(Steinberg::FIDString type) { - // TODO: Implement - bridge.logger.log("TODO: IPlugView::isPlatformTypeSupported()"); - return Steinberg::kNotImplemented; + // We'll swap the X11 window ID platform type string for the Win32 HWND + // equivalent on the Wine side + return bridge.send_message(YaPlugView::IsPlatformTypeSupported{ + .owner_instance_id = owner_instance_id(), .type = type}); } tresult PLUGIN_API Vst3PlugViewProxyImpl::attached(void* parent, diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index f4ca651f..5498c796 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -398,6 +398,19 @@ void Vst3Bridge::run() { request.instance_id) : std::nullopt)}; }, + [&](const YaPlugView::IsPlatformTypeSupported& request) + -> YaPlugView::IsPlatformTypeSupported::Response { + // The host will of course want to pass an X11 window ID for the + // plugin to embed itself in, so we'll have to translate this to + // a HWND + const std::string type = + request.type == Steinberg::kPlatformTypeX11EmbedWindowID + ? Steinberg::kPlatformTypeHWND + : request.type; + + return object_instances[request.owner_instance_id] + .plug_view->isPlatformTypeSupported(type.c_str()); + }, [&](YaPluginBase::Initialize& request) -> YaPluginBase::Initialize::Response { // If we got passed a host context, we'll create a proxy object