Skip to content

Commit

Permalink
Fix VST issue #888, FL Studio + macOS + VST2 resize behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Piolat committed Dec 12, 2024
1 parent c2ce3da commit dcd1214
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion gui/dplug/gui/graphics.d
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,28 @@ package:
&& (heightLogicalPixels == _currentLogicalHeight) )
return true;

// Welcome to a very complicated function!
// Most cases of resize are:
// 1. ask for resize,
// 2. then optionally resize window manually
//
// However rare cases necessitate to do the reverse.
bool hostWantsWindowResizeBeforeRequest = false;
version(OSX) {
// See Issue #888, this was found as workaround, similar to their .flp format.
if (_client.getPluginFormat() == PluginFormat.vst2
&& _client.getDAW() == DAW.FLStudio)
hostWantsWindowResizeBeforeRequest = true;
}

// Note: the client might ask back the plugin size inside this call!
// Hence why we have the concept of "desired" size.
bool parentWasResized = _client.requestResize(widthLogicalPixels, heightLogicalPixels);
bool parentWasResized;
if (hostWantsWindowResizeBeforeRequest)
parentWasResized = true; // will ask later
else
parentWasResized = _client.requestResize(widthLogicalPixels, heightLogicalPixels);


// We do not "desire" something else than the current situation, at this point this is in our hands.
_desiredLogicalWidth = _currentLogicalWidth;
Expand Down Expand Up @@ -544,6 +563,11 @@ package:
{
success = _client.notifyResized;
}

// In case the host wanted to be asked afterwards.
if (hostWantsWindowResizeBeforeRequest)
return _client.requestResize(widthLogicalPixels, heightLogicalPixels);

return success;
}

Expand Down

0 comments on commit dcd1214

Please sign in to comment.