From c2ce3da7d9ba75455d8d6e95317e872281267e37 Mon Sep 17 00:00:00 2001 From: Guillaume Piolat Date: Thu, 12 Dec 2024 18:06:14 +0100 Subject: [PATCH] Only return desized window size in Cubase. This fixes laggy VST3 size in FLSTudio + macOS, see Issue #888 --- client/dplug/client/client.d | 1 + vst3/dplug/vst3/client.d | 32 ++++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/client/dplug/client/client.d b/client/dplug/client/client.d index ad167e6f..4c750a78 100644 --- a/client/dplug/client/client.d +++ b/client/dplug/client/client.d @@ -442,6 +442,7 @@ nothrow: } /// Only allowed for client implementation. + /// This is helpful for some hosts, like OBS and Cubase, but not others like FL Studio. final bool getDesiredGUISize(int* widthLogicalPixels, int* heightLogicalPixels) nothrow @nogc { createGraphicsLazily(); diff --git a/vst3/dplug/vst3/client.d b/vst3/dplug/vst3/client.d index 915009d5..a348a859 100644 --- a/vst3/dplug/vst3/client.d +++ b/vst3/dplug/vst3/client.d @@ -1952,14 +1952,34 @@ nothrow: scope(exit) _graphicsMutex.unlock(); int widthLogicalPixels, heightLogicalPixels; - if (_vst3Client._client.getDesiredGUISize(&widthLogicalPixels, &heightLogicalPixels)) + + // Different VST3 daws need to return different size :) + // Cubase like the "desired size" so that it can call during a resize. + // FLStudio and probably most hosts wants instead the former size. + // See Issue #888. + if (_daw == DAW.Cubase) { - size.left = 0; - size.top = 0; - size.right = widthLogicalPixels; - size.bottom = heightLogicalPixels; - return kResultTrue; + if (_vst3Client._client.getDesiredGUISize(&widthLogicalPixels, &heightLogicalPixels)) + { + size.left = 0; + size.top = 0; + size.right = widthLogicalPixels; + size.bottom = heightLogicalPixels; + return kResultTrue; + } + } + else + { + if (_vst3Client._client.getGUISize(&widthLogicalPixels, &heightLogicalPixels)) + { + size.left = 0; + size.top = 0; + size.right = widthLogicalPixels; + size.bottom = heightLogicalPixels; + return kResultTrue; + } } + return kResultFalse; }