Browse Source

AudioProcessorEditor: Add method to configure layer-backedness of plugin editors

v7.0.9
reuk reuk 2 years ago
parent
commit
926bbda4fa
2 changed files with 29 additions and 0 deletions
  1. +12
    -0
      modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp
  2. +17
    -0
      modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h

+ 12
- 0
modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp View File

@@ -225,4 +225,16 @@ ComponentPeer* AudioProcessorEditor::createNewPeer ([[maybe_unused]] int styleFl
return Component::createNewPeer (styleFlags, nativeWindow);
}
bool AudioProcessorEditor::wantsLayerBackedView() const
{
#if JUCE_MODULE_AVAILABLE_juce_opengl && JUCE_MAC
if (@available (macOS 10.14, *))
return true;
return false;
#else
return true;
#endif
}
} // namespace juce

+ 17
- 0
modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h View File

@@ -206,6 +206,23 @@ public:
*/
std::unique_ptr<ResizableCornerComponent> resizableCorner;
/** The plugin wrapper will call this function to decide whether to use a layer-backed view to
host the editor on macOS and iOS.
Layer-backed views generally provide better performance, and are recommended in most
situations. However, on older macOS versions (confirmed on 10.12 and 10.13), displaying an
OpenGL context inside a layer-backed view can lead to deadlocks, so it is recommended to
avoid layer-backed views when using OpenGL on these OS versions.
The default behaviour of this function is to return false if and only if the juce_opengl
module is present and the current platform is macOS 10.13 or earlier.
You may want to override this behaviour if your plugin has an option to enable and disable
OpenGL rendering. If you know your plugin editor will never use OpenGL rendering, you can
set this function to return true in all situations.
*/
virtual bool wantsLayerBackedView() const;
private:
//==============================================================================
struct AudioProcessorEditorListener : public ComponentListener


Loading…
Cancel
Save