1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Plugin Client: Move all private helper functions into detail namespace

This commit is contained in:
reuk 2023-03-08 19:23:37 +00:00
parent a760307d0f
commit 10bd8235e7
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
17 changed files with 228 additions and 210 deletions

View file

@ -327,6 +327,8 @@ void MessageManager::broadcastMessage (const String&)
// TODO
}
namespace detail
{
// this function expects that it will NEVER be called simultaneously for two concurrent threads
bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages)
{
@ -349,6 +351,7 @@ bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages)
return true;
}
} // namespace detail
//==============================================================================
void LinuxEventLoop::registerFdCallback (int fd, std::function<void (int)> readCallback, short eventMask)

View file

@ -459,27 +459,6 @@ void MessageManager::broadcastMessage (const String& message)
userInfo: info];
}
// Special function used by some plugin classes to re-post carbon events
void repostCurrentNSEvent();
void repostCurrentNSEvent()
{
struct EventReposter : public CallbackMessage
{
EventReposter() : e ([[NSApp currentEvent] retain]) {}
~EventReposter() override { [e release]; }
void messageCallback() override
{
[NSApp postEvent: e atStart: YES];
}
NSEvent* e;
};
(new EventReposter())->post();
}
//==============================================================================
#if JUCE_MAC
struct MountedVolumeListChangeDetector::Pimpl

View file

@ -25,9 +25,14 @@ namespace juce
extern HWND juce_messageWindowHandle;
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client && JucePlugin_Build_Unity
bool juce_isRunningInUnity();
#endif
namespace detail
{
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client && JucePlugin_Build_Unity
bool isRunningInUnity();
#else
constexpr bool isRunningInUnity() { return false; }
#endif
} // namespace detail
#if JUCE_MODULE_AVAILABLE_juce_gui_extra
LRESULT juce_offerEventToActiveXControl (::MSG&);
@ -94,13 +99,11 @@ public:
if (! shouldTriggerMessageQueueDispatch)
return;
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client && JucePlugin_Build_Unity
if (juce_isRunningInUnity())
if (detail::isRunningInUnity())
{
SendNotifyMessage (juce_messageWindowHandle, customMessageID, 0, 0);
return;
}
#endif
PostMessage (juce_messageWindowHandle, customMessageID, 0, 0);
}
@ -260,6 +263,9 @@ JUCE_IMPLEMENT_SINGLETON (InternalMessageQueue)
const TCHAR InternalMessageQueue::messageWindowName[] = _T("JUCEWindow");
//==============================================================================
namespace detail
{
bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages)
{
if (auto* queue = InternalMessageQueue::getInstanceWithoutCreating())
@ -268,6 +274,8 @@ bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages)
return false;
}
} // namespace detail
bool MessageManager::postMessageToSystemQueue (MessageManager::MessageBase* const message)
{
if (auto* queue = InternalMessageQueue::getInstanceWithoutCreating())