mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Plugin Client: Respect requested layer-backedness of editor
This commit is contained in:
parent
926bbda4fa
commit
c5ddf64d16
10 changed files with 98 additions and 33 deletions
|
|
@ -29,7 +29,7 @@
|
|||
#if JucePlugin_Build_AAX && (JUCE_MAC || JUCE_WINDOWS)
|
||||
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeSystemHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_PluginUtilities.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_WindowsHooks.h>
|
||||
|
||||
#include <juce_audio_processors/format_types/juce_LegacyAudioParameter.cpp>
|
||||
|
|
@ -454,7 +454,7 @@ namespace AAXClasses
|
|||
#endif
|
||||
{
|
||||
component->setVisible (true);
|
||||
component->addToDesktop (0, nativeViewToAttachTo);
|
||||
component->addToDesktop (detail::PluginUtilities::getDesktopFlags (component->pluginEditor.get()), nativeViewToAttachTo);
|
||||
|
||||
if (ModifierKeyReceiver* modReceiver = dynamic_cast<ModifierKeyReceiver*> (component->getPeer()))
|
||||
modReceiver->setModifierKeyProvider (this);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
|||
|
||||
#define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
|
||||
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_PluginUtilities.h>
|
||||
|
||||
#include <juce_audio_basics/native/juce_mac_CoreAudioLayouts.h>
|
||||
#include <juce_audio_basics/native/juce_mac_CoreAudioTimeConversions.h>
|
||||
|
|
@ -1600,7 +1600,7 @@ public:
|
|||
object: nil];
|
||||
activeUIs.add (view);
|
||||
|
||||
editorCompHolder->addToDesktop (0, (void*) view);
|
||||
editorCompHolder->addToDesktop (detail::PluginUtilities::getDesktopFlags (editor), view);
|
||||
editorCompHolder->setVisible (view);
|
||||
|
||||
return view;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
|
||||
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeSystemHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_PluginUtilities.h>
|
||||
|
||||
#import <CoreAudioKit/CoreAudioKit.h>
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
|
|
@ -1834,7 +1834,7 @@ public:
|
|||
editor->setVisible (true);
|
||||
#endif
|
||||
|
||||
editor->addToDesktop (0, view);
|
||||
detail::PluginUtilities::addToDesktop (*editor, view);
|
||||
|
||||
#if JUCE_IOS
|
||||
if (JUCE_IOS_MAC_VIEW* peerView = [[[myself view] subviews] objectAtIndex: 0])
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include <juce_audio_plugin_client/juce_audio_plugin_client.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_CheckSettingMacros.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_PluginUtilities.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_LinuxMessageThread.h>
|
||||
|
||||
#include <juce_audio_processors/utilities/juce_FlagCache.h>
|
||||
|
|
@ -1534,7 +1535,7 @@ public:
|
|||
setOpaque (true);
|
||||
setVisible (false);
|
||||
removeFromDesktop();
|
||||
addToDesktop (0, parent);
|
||||
addToDesktop (detail::PluginUtilities::getDesktopFlags (editor.get()), parent);
|
||||
editor->addComponentListener (this);
|
||||
|
||||
*widget = getWindowHandle();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#if JucePlugin_Build_Unity
|
||||
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_PluginUtilities.h>
|
||||
#include <juce_audio_processors/format_types/juce_LegacyAudioParameter.cpp>
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
|
|
@ -298,7 +298,7 @@ public:
|
|||
{
|
||||
pluginInstanceEditor.reset (pluginInstance->createEditorIfNeeded());
|
||||
pluginInstanceEditor->setVisible (true);
|
||||
pluginInstanceEditor->addToDesktop (0);
|
||||
detail::PluginUtilities::addToDesktop (*pluginInstanceEditor, nullptr);
|
||||
}
|
||||
|
||||
juceParameters.update (*pluginInstance, false);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
|||
#define JUCE_VSTINTERFACE_H_INCLUDED 1
|
||||
#define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1
|
||||
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_PluginUtilities.h>
|
||||
|
||||
using namespace juce;
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ namespace juce
|
|||
{
|
||||
#if JUCE_MAC
|
||||
extern JUCE_API void initialiseMacVST();
|
||||
extern JUCE_API void* attachComponentToWindowRefVST (Component*, void* parent, bool isNSView);
|
||||
extern JUCE_API void* attachComponentToWindowRefVST (Component*, int, void* parent, bool isNSView);
|
||||
extern JUCE_API void detachComponentFromWindowRefVST (Component*, void* window, bool isNSView);
|
||||
extern JUCE_API void setNativeHostWindowSizeVST (void* window, Component*, int newWidth, int newHeight, bool isNSView);
|
||||
extern JUCE_API void checkWindowVisibilityVST (void* window, Component*, bool isNSView);
|
||||
|
|
@ -1003,8 +1003,10 @@ public:
|
|||
{
|
||||
setVisible (false);
|
||||
|
||||
const auto desktopFlags = detail::PluginUtilities::getDesktopFlags (getEditorComp());
|
||||
|
||||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
|
||||
addToDesktop (0, args.ptr);
|
||||
addToDesktop (desktopFlags, args.ptr);
|
||||
hostWindow = (HostWindowType) args.ptr;
|
||||
|
||||
#if JUCE_LINUX || JUCE_BSD
|
||||
|
|
@ -1021,7 +1023,7 @@ public:
|
|||
startTimer (500);
|
||||
#endif
|
||||
#elif JUCE_MAC
|
||||
hostWindow = attachComponentToWindowRefVST (this, args.ptr, wrapper.useNSView);
|
||||
hostWindow = attachComponentToWindowRefVST (this, desktopflags, args.ptr, wrapper.useNSView);
|
||||
#endif
|
||||
|
||||
setVisible (true);
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ void initialiseMacVST()
|
|||
#endif
|
||||
}
|
||||
|
||||
JUCE_API void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, bool isNSView);
|
||||
void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, [[maybe_unused]] bool isNSView)
|
||||
JUCE_API void* attachComponentToWindowRefVST (Component* comp, int, void* parentWindowOrView, bool isNSView);
|
||||
void* attachComponentToWindowRefVST (Component* comp, int desktopFlags, void* parentWindowOrView, [[maybe_unused]] bool isNSView)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
|
|
@ -138,11 +138,13 @@ void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView,
|
|||
|
||||
updateEditorCompBoundsVST (comp);
|
||||
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
#endif
|
||||
const auto defaultFlags =
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses;
|
||||
#else
|
||||
ComponentPeer::windowIsTemporary;
|
||||
#endif
|
||||
comp->addToDesktop (desktopFlags | defaultFlags);
|
||||
|
||||
comp->setVisible (true);
|
||||
comp->toFront (false);
|
||||
|
|
@ -163,11 +165,13 @@ void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView,
|
|||
|
||||
NSView* parentView = [(NSView*) parentWindowOrView retain];
|
||||
|
||||
#if JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (0, parentView);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIgnoresKeyPresses, parentView);
|
||||
#endif
|
||||
const auto defaultFlags =
|
||||
#if JucePlugin_EditorRequiresKeyboardFocus
|
||||
0;
|
||||
#else
|
||||
ComponentPeer::windowIgnoresKeyPresses;
|
||||
#endif
|
||||
comp->addToDesktop (desktopFlags | defaultFlags, parentView);
|
||||
|
||||
// (this workaround is because Wavelab provides a zero-size parent view..)
|
||||
if ([parentView frame].size.height == 0)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ JUCE_BEGIN_NO_SANITIZE ("vptr")
|
|||
|
||||
#include <juce_audio_plugin_client/utility/juce_CheckSettingMacros.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeSystemHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_PluginUtilities.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_WindowsHooks.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_LinuxMessageThread.h>
|
||||
#include <juce_audio_processors/format_types/juce_LegacyAudioParameter.cpp>
|
||||
|
|
@ -108,14 +108,14 @@ using namespace Steinberg;
|
|||
|
||||
//==============================================================================
|
||||
#if JUCE_MAC
|
||||
extern void initialiseMacVST();
|
||||
void initialiseMacVST();
|
||||
|
||||
#if ! JUCE_64BIT
|
||||
extern void updateEditorCompBoundsVST (Component*);
|
||||
void updateEditorCompBoundsVST (Component*);
|
||||
#endif
|
||||
|
||||
extern JUCE_API void* attachComponentToWindowRefVST (Component*, void* parentWindowOrView, bool isNSView);
|
||||
extern JUCE_API void detachComponentFromWindowRefVST (Component*, void* nsWindow, bool isNSView);
|
||||
JUCE_API void* attachComponentToWindowRefVST (Component*, int desktopFlags, void* parentWindowOrView, bool isNSView);
|
||||
JUCE_API void detachComponentFromWindowRefVST (Component*, void* nsWindow, bool isNSView);
|
||||
#endif
|
||||
|
||||
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
|
||||
|
|
@ -1783,6 +1783,8 @@ private:
|
|||
|
||||
createContentWrapperComponentIfNeeded();
|
||||
|
||||
const auto desktopFlags = detail::PluginUtilities::getDesktopFlags (component->pluginEditor.get());
|
||||
|
||||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
|
||||
// If the plugin was last opened at a particular scale, try to reapply that scale here.
|
||||
// Note that we do this during attach(), rather than in JuceVST3Editor(). During the
|
||||
|
|
@ -1798,7 +1800,7 @@ private:
|
|||
#endif
|
||||
|
||||
component->setOpaque (true);
|
||||
component->addToDesktop (0, (void*) systemWindow);
|
||||
component->addToDesktop (desktopFlags, systemWindow);
|
||||
component->setVisible (true);
|
||||
|
||||
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
|
||||
|
|
@ -1807,7 +1809,7 @@ private:
|
|||
|
||||
#else
|
||||
isNSView = (strcmp (type, kPlatformTypeNSView) == 0);
|
||||
macHostWindow = juce::attachComponentToWindowRefVST (component.get(), parent, isNSView);
|
||||
macHostWindow = juce::attachComponentToWindowRefVST (component.get(), desktopFlags, parent, isNSView);
|
||||
#endif
|
||||
|
||||
component->resizeHostWindow();
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <juce_audio_plugin_client/juce_audio_plugin_client.h>
|
||||
#include <juce_audio_plugin_client/utility/juce_CreatePluginFilter.h>
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - Raw Material Software Limited
|
||||
|
||||
JUCE is an open source library subject to commercial or open-source
|
||||
licensing.
|
||||
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
www.gnu.org/licenses).
|
||||
|
||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
|
||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
|
||||
DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h>
|
||||
|
||||
namespace juce::detail
|
||||
{
|
||||
|
||||
struct PluginUtilities
|
||||
{
|
||||
PluginUtilities() = delete;
|
||||
|
||||
static int getDesktopFlags (const AudioProcessorEditor& editor)
|
||||
{
|
||||
return editor.wantsLayerBackedView()
|
||||
? 0
|
||||
: ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering;
|
||||
}
|
||||
|
||||
static int getDesktopFlags (const AudioProcessorEditor* editor)
|
||||
{
|
||||
return editor != nullptr ? getDesktopFlags (*editor) : 0;
|
||||
}
|
||||
|
||||
static void addToDesktop (AudioProcessorEditor& editor, void* parent)
|
||||
{
|
||||
editor.addToDesktop (getDesktopFlags (editor), parent);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace juce::detail
|
||||
Loading…
Add table
Add a link
Reference in a new issue