You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
3.4KB

  1. diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  2. index e9a5c6cb1..712543ac7 100644
  3. --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  4. +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  5. @@ -902,7 +902,7 @@ public:
  6. if (auto* ed = processor->createEditorIfNeeded())
  7. {
  8. setHasEditorFlag (true);
  9. - editorComp.reset (new EditorCompWrapper (*this, *ed));
  10. + editorComp.reset (new EditorCompWrapper (*this, *ed, lastScaleFactorReceived));
  11. }
  12. else
  13. {
  14. @@ -1026,11 +1026,14 @@ public:
  15. , public Timer
  16. #endif
  17. {
  18. - EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor)
  19. - : wrapper (w)
  20. + EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor, float scaleFactor)
  21. + : wrapper (w),
  22. + editorScaleFactor (scaleFactor)
  23. {
  24. editor.setOpaque (true);
  25. editor.setVisible (true);
  26. + editor.setScaleFactor (scaleFactor);
  27. +
  28. setOpaque (true);
  29. setTopLeftPosition (editor.getPosition());
  30. @@ -1064,6 +1067,24 @@ public:
  31. {
  32. auto b = getSizeToContainChild();
  33. bounds = convertToHostBounds ({ 0, 0, (int16) b.getHeight(), (int16) b.getWidth() });
  34. +
  35. + #if JUCE_LINUX
  36. + if (auto* ed = getEditorComp())
  37. + {
  38. + if (auto* peer = ed->getPeer())
  39. + {
  40. + auto scale = (float) peer->getPlatformScaleFactor();
  41. +
  42. + if (approximatelyEqual (scale, 1.0f))
  43. + return;
  44. +
  45. + bounds.upper *= scale;
  46. + bounds.leftmost *= scale;
  47. + bounds.lower *= scale;
  48. + bounds.rightmost *= scale;
  49. + }
  50. + }
  51. + #endif
  52. }
  53. void attachToHost (VstOpCodeArguments args)
  54. @@ -1169,9 +1190,9 @@ public:
  55. setTopLeftPosition (0, getHeight() - pos.getHeight());
  56. #endif
  57. + #if ! JUCE_LINUX // setSize() on linux causes renoise and energyxt to fail.
  58. resizeHostWindow (pos.getWidth(), pos.getHeight());
  59. - #if ! JUCE_LINUX // setSize() on linux causes renoise and energyxt to fail.
  60. if (! resizeEditor) // this is needed to prevent an infinite resizing loop due to coordinate rounding
  61. shouldResizeEditor = false;
  62. @@ -1186,6 +1207,9 @@ public:
  63. if (auto* peer = ed->getPeer())
  64. scale *= (float) peer->getPlatformScaleFactor();
  65. + resizeHostWindow (roundToInt (pos.getWidth() * scale),
  66. + roundToInt (pos.getHeight() * scale));
  67. +
  68. X11Symbols::getInstance()->xResizeWindow (display, (Window) getWindowHandle(),
  69. static_cast<unsigned int> (roundToInt (pos.getWidth() * scale)),
  70. static_cast<unsigned int> (roundToInt (pos.getHeight() * scale)));