Skip to content

Commit

Permalink
reFX: fixed issue with VST2 plugin editor being correctly resized onl…
Browse files Browse the repository at this point in the history
…y after 500ms
  • Loading branch information
MarcKamradt committed May 12, 2020
1 parent 1fc0bf4 commit 13b2194
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
Expand Up @@ -1100,6 +1100,7 @@ class JuceVSTWrapper : public AudioProcessorListener,
ignoreUnused (fakeMouseGenerator);

#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
handleWindowsDpiScaling ();
startTimer (500);
#endif
}
Expand All @@ -1126,6 +1127,9 @@ class JuceVSTWrapper : public AudioProcessorListener,
#if JUCE_WINDOWS
addToDesktop (0, args.ptr);
hostWindow = (HWND) args.ptr;
#if JUCE_WIN_PER_MONITOR_DPI_AWARE
handleWindowsDpiScaling ();
#endif
#elif JUCE_LINUX
addToDesktop (0, args.ptr);
hostWindow = (Window) args.ptr;
Expand Down Expand Up @@ -1337,6 +1341,7 @@ class JuceVSTWrapper : public AudioProcessorListener,
}
}


void setContentScaleFactor (float scale)
{
if (! approximatelyEqual (scale, editorScaleFactor))
Expand All @@ -1351,13 +1356,19 @@ class JuceVSTWrapper : public AudioProcessorListener,
}

#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
void timerCallback() override

void handleWindowsDpiScaling ()
{
auto hostWindowScale = (float) getScaleFactorForWindow (hostWindow);

if (hostWindowScale > 0.0f && ! approximatelyEqual (hostWindowScale, editorScaleFactor))
wrapper.handleSetContentScaleFactor (hostWindowScale);
}

void timerCallback() override
{
handleWindowsDpiScaling ();
}
#endif

#if JUCE_WINDOWS
Expand Down

0 comments on commit 13b2194

Please sign in to comment.