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

Windows: Always define RunningInUnity flag in juce_gui_basics TU

This commit is contained in:
reuk 2023-03-27 14:20:04 +01:00
parent 9dfaab24e0
commit 4fbc4da29a
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
5 changed files with 40 additions and 17 deletions

View file

@ -30,13 +30,6 @@
namespace juce::detail namespace juce::detail
{ {
bool isRunningInUnity();
#if JucePlugin_Build_Unity
bool isRunningInUnity() { return PluginHostType::getPluginLoadedAs() == AudioProcessor::wrapperType_Unity; }
#else
bool isRunningInUnity() { return false; }
#endif
struct PluginUtilities struct PluginUtilities
{ {
PluginUtilities() = delete; PluginUtilities() = delete;

View file

@ -36,6 +36,8 @@
#include <juce_audio_plugin_client/Unity/juce_UnityPluginInterface.h> #include <juce_audio_plugin_client/Unity/juce_UnityPluginInterface.h>
#include <juce_events/native/juce_RunningInUnity.h>
//============================================================================== //==============================================================================
namespace juce namespace juce
{ {
@ -292,6 +294,7 @@ class AudioProcessorUnityWrapper
public: public:
AudioProcessorUnityWrapper (bool isTemporary) AudioProcessorUnityWrapper (bool isTemporary)
{ {
detail::RunningInUnity::state = true;
pluginInstance = createPluginFilterOfType (AudioProcessor::wrapperType_Unity); pluginInstance = createPluginFilterOfType (AudioProcessor::wrapperType_Unity);
if (! isTemporary && pluginInstance->hasEditor()) if (! isTemporary && pluginInstance->hasEditor())

View file

@ -81,6 +81,7 @@
#endif #endif
#elif JUCE_WINDOWS #elif JUCE_WINDOWS
#include "native/juce_RunningInUnity.h"
#include "native/juce_win32_Messaging.cpp" #include "native/juce_win32_Messaging.cpp"
#if JUCE_EVENTS_INCLUDE_WINRT_WRAPPER #if JUCE_EVENTS_INCLUDE_WINRT_WRAPPER
#include "native/juce_win32_WinRTWrapper.cpp" #include "native/juce_win32_WinRTWrapper.cpp"

View file

@ -0,0 +1,35 @@
/*
==============================================================================
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.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
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
namespace juce::detail
{
class RunningInUnity
{
public:
/* @internal */
static inline bool state = false;
};
} // namespace juce::detail

View file

@ -25,15 +25,6 @@ namespace juce
extern HWND juce_messageWindowHandle; extern HWND juce_messageWindowHandle;
namespace detail
{
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client
bool isRunningInUnity();
#else
constexpr bool isRunningInUnity() { return false; }
#endif
} // namespace detail
#if JUCE_MODULE_AVAILABLE_juce_gui_extra #if JUCE_MODULE_AVAILABLE_juce_gui_extra
LRESULT juce_offerEventToActiveXControl (::MSG&); LRESULT juce_offerEventToActiveXControl (::MSG&);
#endif #endif
@ -99,7 +90,7 @@ public:
if (! shouldTriggerMessageQueueDispatch) if (! shouldTriggerMessageQueueDispatch)
return; return;
if (detail::isRunningInUnity()) if (detail::RunningInUnity::state)
{ {
SendNotifyMessage (juce_messageWindowHandle, customMessageID, 0, 0); SendNotifyMessage (juce_messageWindowHandle, customMessageID, 0, 0);
return; return;