diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile
index 8355f15bb9..709abca49b 100644
--- a/Builds/Linux/Makefile
+++ b/Builds/Linux/Makefile
@@ -237,7 +237,7 @@ OBJECTS := \
$(OBJDIR)/juce_Colours_89de9488.o \
$(OBJDIR)/juce_EdgeTable_6a5fefda.o \
$(OBJDIR)/juce_FillType_5805677e.o \
- $(OBJDIR)/juce_Graphics_27754bac.o \
+ $(OBJDIR)/juce_GraphicsContext_119e43ed.o \
$(OBJDIR)/juce_Justification_dc284c3b.o \
$(OBJDIR)/juce_LowLevelGraphicsPostScriptRenderer_2e8a92a.o \
$(OBJDIR)/juce_LowLevelGraphicsSoftwareRenderer_97263906.o \
@@ -1377,9 +1377,9 @@ $(OBJDIR)/juce_FillType_5805677e.o: ../../src/gui/graphics/contexts/juce_FillTyp
@echo "Compiling juce_FillType.cpp"
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
-$(OBJDIR)/juce_Graphics_27754bac.o: ../../src/gui/graphics/contexts/juce_Graphics.cpp
+$(OBJDIR)/juce_GraphicsContext_119e43ed.o: ../../src/gui/graphics/contexts/juce_GraphicsContext.cpp
-@mkdir -p $(OBJDIR)
- @echo "Compiling juce_Graphics.cpp"
+ @echo "Compiling juce_GraphicsContext.cpp"
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/juce_Justification_dc284c3b.o: ../../src/gui/graphics/contexts/juce_Justification.cpp
diff --git a/Builds/MacOSX/Juce.xcodeproj/project.pbxproj b/Builds/MacOSX/Juce.xcodeproj/project.pbxproj
index 1397872c3d..6ea3ec4117 100644
--- a/Builds/MacOSX/Juce.xcodeproj/project.pbxproj
+++ b/Builds/MacOSX/Juce.xcodeproj/project.pbxproj
@@ -206,7 +206,7 @@
82A9E0388C9BF3A698DCEF69 = { isa = PBXBuildFile; fileRef = 41AF663E626B8F6D319B9966; };
7F6749BFCF2F134468825D45 = { isa = PBXBuildFile; fileRef = 3EC800323255128D69539BAE; };
277CF246D5EE48868E38E625 = { isa = PBXBuildFile; fileRef = B7251E779500BA77F5522CC7; };
- C80AF2A1AC481DF47D0A9D8D = { isa = PBXBuildFile; fileRef = 3F8C8157E25C3856D967F5D9; };
+ 4D285D9D3F5955F2FD574D04 = { isa = PBXBuildFile; fileRef = EF50EEDCAB08F842AB8DE6DA; };
30F9B53BD00228406F6477DF = { isa = PBXBuildFile; fileRef = 2E03ADF975A126C1F2F7B667; };
759633D5CDB35874FD37DD7F = { isa = PBXBuildFile; fileRef = ED3ED8389001D55FBDCF1087; };
E0F309D93E9A7F0CC71C4503 = { isa = PBXBuildFile; fileRef = 835CC2A1E67E7B19E41F8FBD; };
@@ -831,8 +831,8 @@
BD52C1CCEAF6FEC311B9FDA1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_EdgeTable.h"; path = "../../src/gui/graphics/contexts/juce_EdgeTable.h"; sourceTree = "SOURCE_ROOT"; };
B7251E779500BA77F5522CC7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FillType.cpp"; path = "../../src/gui/graphics/contexts/juce_FillType.cpp"; sourceTree = "SOURCE_ROOT"; };
1F0DB4B2825AF638183B50D6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FillType.h"; path = "../../src/gui/graphics/contexts/juce_FillType.h"; sourceTree = "SOURCE_ROOT"; };
- 3F8C8157E25C3856D967F5D9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Graphics.cpp"; path = "../../src/gui/graphics/contexts/juce_Graphics.cpp"; sourceTree = "SOURCE_ROOT"; };
- C83BFA102896453D4AB96E35 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Graphics.h"; path = "../../src/gui/graphics/contexts/juce_Graphics.h"; sourceTree = "SOURCE_ROOT"; };
+ EF50EEDCAB08F842AB8DE6DA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_GraphicsContext.cpp"; path = "../../src/gui/graphics/contexts/juce_GraphicsContext.cpp"; sourceTree = "SOURCE_ROOT"; };
+ 6320F9BAFA094B5C0C828C58 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_GraphicsContext.h"; path = "../../src/gui/graphics/contexts/juce_GraphicsContext.h"; sourceTree = "SOURCE_ROOT"; };
2E03ADF975A126C1F2F7B667 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Justification.cpp"; path = "../../src/gui/graphics/contexts/juce_Justification.cpp"; sourceTree = "SOURCE_ROOT"; };
36268DD78D00323D391ECAAB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Justification.h"; path = "../../src/gui/graphics/contexts/juce_Justification.h"; sourceTree = "SOURCE_ROOT"; };
D6B4FED1F1D9FB82C6424438 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_LowLevelGraphicsContext.h"; path = "../../src/gui/graphics/contexts/juce_LowLevelGraphicsContext.h"; sourceTree = "SOURCE_ROOT"; };
@@ -1642,8 +1642,8 @@
BD52C1CCEAF6FEC311B9FDA1,
B7251E779500BA77F5522CC7,
1F0DB4B2825AF638183B50D6,
- 3F8C8157E25C3856D967F5D9,
- C83BFA102896453D4AB96E35,
+ EF50EEDCAB08F842AB8DE6DA,
+ 6320F9BAFA094B5C0C828C58,
2E03ADF975A126C1F2F7B667,
36268DD78D00323D391ECAAB,
D6B4FED1F1D9FB82C6424438,
@@ -2266,7 +2266,7 @@
82A9E0388C9BF3A698DCEF69,
7F6749BFCF2F134468825D45,
277CF246D5EE48868E38E625,
- C80AF2A1AC481DF47D0A9D8D,
+ 4D285D9D3F5955F2FD574D04,
30F9B53BD00228406F6477DF,
759633D5CDB35874FD37DD7F,
E0F309D93E9A7F0CC71C4503,
diff --git a/Builds/VisualStudio2005/Juce.vcproj b/Builds/VisualStudio2005/Juce.vcproj
index 3819f4a975..295d21abb5 100644
--- a/Builds/VisualStudio2005/Juce.vcproj
+++ b/Builds/VisualStudio2005/Juce.vcproj
@@ -700,8 +700,8 @@
-
-
+
+
diff --git a/Builds/VisualStudio2008/Juce.vcproj b/Builds/VisualStudio2008/Juce.vcproj
index 88bc194796..46255a9fe2 100644
--- a/Builds/VisualStudio2008/Juce.vcproj
+++ b/Builds/VisualStudio2008/Juce.vcproj
@@ -700,8 +700,8 @@
-
-
+
+
diff --git a/Builds/VisualStudio2008_DLL/Juce.vcproj b/Builds/VisualStudio2008_DLL/Juce.vcproj
index 5bdbc15482..cb359798d0 100644
--- a/Builds/VisualStudio2008_DLL/Juce.vcproj
+++ b/Builds/VisualStudio2008_DLL/Juce.vcproj
@@ -702,8 +702,8 @@
-
-
+
+
diff --git a/Builds/VisualStudio2010/Juce.vcxproj b/Builds/VisualStudio2010/Juce.vcxproj
index 599bc46a5b..080c48240d 100644
--- a/Builds/VisualStudio2010/Juce.vcxproj
+++ b/Builds/VisualStudio2010/Juce.vcxproj
@@ -320,7 +320,7 @@
-
+
@@ -710,7 +710,7 @@
-
+
diff --git a/Builds/VisualStudio2010/Juce.vcxproj.filters b/Builds/VisualStudio2010/Juce.vcxproj.filters
index abff23afd5..c1ce23d49c 100644
--- a/Builds/VisualStudio2010/Juce.vcxproj.filters
+++ b/Builds/VisualStudio2010/Juce.vcxproj.filters
@@ -817,7 +817,7 @@
Juce\Source\gui\graphics\contexts
-
+
Juce\Source\gui\graphics\contexts
@@ -2061,7 +2061,7 @@
Juce\Source\gui\graphics\contexts
-
+
Juce\Source\gui\graphics\contexts
diff --git a/Builds/iOS/Juce.xcodeproj/project.pbxproj b/Builds/iOS/Juce.xcodeproj/project.pbxproj
index 165f589f45..12f6523459 100644
--- a/Builds/iOS/Juce.xcodeproj/project.pbxproj
+++ b/Builds/iOS/Juce.xcodeproj/project.pbxproj
@@ -206,7 +206,7 @@
82A9E0388C9BF3A698DCEF69 = { isa = PBXBuildFile; fileRef = 41AF663E626B8F6D319B9966; };
7F6749BFCF2F134468825D45 = { isa = PBXBuildFile; fileRef = 3EC800323255128D69539BAE; };
277CF246D5EE48868E38E625 = { isa = PBXBuildFile; fileRef = B7251E779500BA77F5522CC7; };
- C80AF2A1AC481DF47D0A9D8D = { isa = PBXBuildFile; fileRef = 3F8C8157E25C3856D967F5D9; };
+ 4D285D9D3F5955F2FD574D04 = { isa = PBXBuildFile; fileRef = EF50EEDCAB08F842AB8DE6DA; };
30F9B53BD00228406F6477DF = { isa = PBXBuildFile; fileRef = 2E03ADF975A126C1F2F7B667; };
759633D5CDB35874FD37DD7F = { isa = PBXBuildFile; fileRef = ED3ED8389001D55FBDCF1087; };
E0F309D93E9A7F0CC71C4503 = { isa = PBXBuildFile; fileRef = 835CC2A1E67E7B19E41F8FBD; };
@@ -831,8 +831,8 @@
BD52C1CCEAF6FEC311B9FDA1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_EdgeTable.h"; path = "../../src/gui/graphics/contexts/juce_EdgeTable.h"; sourceTree = "SOURCE_ROOT"; };
B7251E779500BA77F5522CC7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FillType.cpp"; path = "../../src/gui/graphics/contexts/juce_FillType.cpp"; sourceTree = "SOURCE_ROOT"; };
1F0DB4B2825AF638183B50D6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FillType.h"; path = "../../src/gui/graphics/contexts/juce_FillType.h"; sourceTree = "SOURCE_ROOT"; };
- 3F8C8157E25C3856D967F5D9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Graphics.cpp"; path = "../../src/gui/graphics/contexts/juce_Graphics.cpp"; sourceTree = "SOURCE_ROOT"; };
- C83BFA102896453D4AB96E35 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Graphics.h"; path = "../../src/gui/graphics/contexts/juce_Graphics.h"; sourceTree = "SOURCE_ROOT"; };
+ EF50EEDCAB08F842AB8DE6DA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_GraphicsContext.cpp"; path = "../../src/gui/graphics/contexts/juce_GraphicsContext.cpp"; sourceTree = "SOURCE_ROOT"; };
+ 6320F9BAFA094B5C0C828C58 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_GraphicsContext.h"; path = "../../src/gui/graphics/contexts/juce_GraphicsContext.h"; sourceTree = "SOURCE_ROOT"; };
2E03ADF975A126C1F2F7B667 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Justification.cpp"; path = "../../src/gui/graphics/contexts/juce_Justification.cpp"; sourceTree = "SOURCE_ROOT"; };
36268DD78D00323D391ECAAB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Justification.h"; path = "../../src/gui/graphics/contexts/juce_Justification.h"; sourceTree = "SOURCE_ROOT"; };
D6B4FED1F1D9FB82C6424438 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_LowLevelGraphicsContext.h"; path = "../../src/gui/graphics/contexts/juce_LowLevelGraphicsContext.h"; sourceTree = "SOURCE_ROOT"; };
@@ -1642,8 +1642,8 @@
BD52C1CCEAF6FEC311B9FDA1,
B7251E779500BA77F5522CC7,
1F0DB4B2825AF638183B50D6,
- 3F8C8157E25C3856D967F5D9,
- C83BFA102896453D4AB96E35,
+ EF50EEDCAB08F842AB8DE6DA,
+ 6320F9BAFA094B5C0C828C58,
2E03ADF975A126C1F2F7B667,
36268DD78D00323D391ECAAB,
D6B4FED1F1D9FB82C6424438,
@@ -2270,7 +2270,7 @@
82A9E0388C9BF3A698DCEF69,
7F6749BFCF2F134468825D45,
277CF246D5EE48868E38E625,
- C80AF2A1AC481DF47D0A9D8D,
+ 4D285D9D3F5955F2FD574D04,
30F9B53BD00228406F6477DF,
759633D5CDB35874FD37DD7F,
E0F309D93E9A7F0CC71C4503,
diff --git a/Juce.jucer b/Juce.jucer
index f94bfcdfdd..ef0b8424f3 100644
--- a/Juce.jucer
+++ b/Juce.jucer
@@ -1026,10 +1026,10 @@
file="src/gui/graphics/contexts/juce_FillType.cpp"/>
-
-
+
+
#pragma warning (pop)
-
- #if ! JUCE_PUBLIC_INCLUDES
- #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
- #endif
#endif
#if JUCE_ANDROID
diff --git a/src/core/juce_TargetPlatform.h b/src/core/juce_TargetPlatform.h
index 6e118db8e4..19a5d56b9d 100644
--- a/src/core/juce_TargetPlatform.h
+++ b/src/core/juce_TargetPlatform.h
@@ -39,6 +39,15 @@
- Either JUCE_GCC or JUCE_MSVC
*/
+//==============================================================================
+/* This line is here as a sanity-check to catch syntax errors caused by mistakes in 3rd-party
+ header files that have been included before this one. If you hit an error at this line, there
+ must be some kind of syntax problem in whatever code immediately precedes this header.
+
+ It also causes an error if you attempt to build using a C or obj-C compiler rather than a C++ one.
+*/
+namespace JuceDummyNamespace {}
+
//==============================================================================
#if (defined (_WIN32) || defined (_WIN64))
#define JUCE_WIN32 1
diff --git a/src/gui/components/lookandfeel/juce_LookAndFeel.h b/src/gui/components/lookandfeel/juce_LookAndFeel.h
index 433b99be04..dd97f31252 100644
--- a/src/gui/components/lookandfeel/juce_LookAndFeel.h
+++ b/src/gui/components/lookandfeel/juce_LookAndFeel.h
@@ -26,7 +26,7 @@
#ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
#define __JUCE_LOOKANDFEEL_JUCEHEADER__
-#include "../../graphics/contexts/juce_Graphics.h"
+#include "../../graphics/contexts/juce_GraphicsContext.h"
#include "../../graphics/effects/juce_DropShadowEffect.h"
#include "../controls/juce_Slider.h"
#include "../layout/juce_TabbedComponent.h"
diff --git a/src/gui/graphics/contexts/juce_Graphics.cpp b/src/gui/graphics/contexts/juce_GraphicsContext.cpp
similarity index 96%
rename from src/gui/graphics/contexts/juce_Graphics.cpp
rename to src/gui/graphics/contexts/juce_GraphicsContext.cpp
index 100ab3b28b..d1b3d891df 100644
--- a/src/gui/graphics/contexts/juce_Graphics.cpp
+++ b/src/gui/graphics/contexts/juce_GraphicsContext.cpp
@@ -27,7 +27,7 @@
BEGIN_JUCE_NAMESPACE
-#include "juce_Graphics.h"
+#include "juce_GraphicsContext.h"
#include "../fonts/juce_GlyphArrangement.h"
#include "../geometry/juce_PathStrokeType.h"
#include "juce_LowLevelGraphicsContext.h"
diff --git a/src/gui/graphics/contexts/juce_Graphics.h b/src/gui/graphics/contexts/juce_GraphicsContext.h
similarity index 97%
rename from src/gui/graphics/contexts/juce_Graphics.h
rename to src/gui/graphics/contexts/juce_GraphicsContext.h
index fb5776a7f0..7caf997666 100644
--- a/src/gui/graphics/contexts/juce_Graphics.h
+++ b/src/gui/graphics/contexts/juce_GraphicsContext.h
@@ -23,8 +23,8 @@
==============================================================================
*/
-#ifndef __JUCE_GRAPHICS_JUCEHEADER__
-#define __JUCE_GRAPHICS_JUCEHEADER__
+#ifndef __JUCE_GRAPHICSCONTEXT_JUCEHEADER__
+#define __JUCE_GRAPHICSCONTEXT_JUCEHEADER__
#include "../fonts/juce_Font.h"
#include "../geometry/juce_Rectangle.h"
@@ -701,4 +701,4 @@ private:
};
-#endif // __JUCE_GRAPHICS_JUCEHEADER__
+#endif // __JUCE_GRAPHICSCONTEXT_JUCEHEADER__
diff --git a/src/gui/graphics/effects/juce_ImageEffectFilter.h b/src/gui/graphics/effects/juce_ImageEffectFilter.h
index 350b1b9a1a..246f3ef6b6 100644
--- a/src/gui/graphics/effects/juce_ImageEffectFilter.h
+++ b/src/gui/graphics/effects/juce_ImageEffectFilter.h
@@ -26,7 +26,7 @@
#ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
#define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
-#include "../../graphics/contexts/juce_Graphics.h"
+#include "../../graphics/contexts/juce_GraphicsContext.h"
//==============================================================================
diff --git a/src/gui/graphics/fonts/juce_GlyphArrangement.h b/src/gui/graphics/fonts/juce_GlyphArrangement.h
index 197e68a04e..231fb855b5 100644
--- a/src/gui/graphics/fonts/juce_GlyphArrangement.h
+++ b/src/gui/graphics/fonts/juce_GlyphArrangement.h
@@ -27,7 +27,7 @@
#define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
#include "juce_Font.h"
-#include "../contexts/juce_Graphics.h"
+#include "../contexts/juce_GraphicsContext.h"
//==============================================================================
diff --git a/src/gui/graphics/fonts/juce_TextLayout.cpp b/src/gui/graphics/fonts/juce_TextLayout.cpp
index 5443c96156..e3e14aaef2 100644
--- a/src/gui/graphics/fonts/juce_TextLayout.cpp
+++ b/src/gui/graphics/fonts/juce_TextLayout.cpp
@@ -28,7 +28,7 @@
BEGIN_JUCE_NAMESPACE
#include "juce_TextLayout.h"
-#include "../contexts/juce_Graphics.h"
+#include "../contexts/juce_GraphicsContext.h"
//==============================================================================
diff --git a/src/gui/graphics/imaging/juce_Image.cpp b/src/gui/graphics/imaging/juce_Image.cpp
index 74c70c35af..07fba043dc 100644
--- a/src/gui/graphics/imaging/juce_Image.cpp
+++ b/src/gui/graphics/imaging/juce_Image.cpp
@@ -28,7 +28,7 @@
BEGIN_JUCE_NAMESPACE
#include "juce_Image.h"
-#include "../contexts/juce_Graphics.h"
+#include "../contexts/juce_GraphicsContext.h"
#include "../contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
#include "../colour/juce_PixelFormats.h"
#include "../../../containers/juce_SparseSet.h"
diff --git a/src/gui/graphics/imaging/juce_Image.h b/src/gui/graphics/imaging/juce_Image.h
index fe8f4b60fb..c54f235358 100644
--- a/src/gui/graphics/imaging/juce_Image.h
+++ b/src/gui/graphics/imaging/juce_Image.h
@@ -27,7 +27,7 @@
#define __JUCE_IMAGE_JUCEHEADER__
#include "../colour/juce_Colour.h"
-#include "../contexts/juce_Graphics.h"
+#include "../contexts/juce_GraphicsContext.h"
#include "../../../containers/juce_Variant.h"
#include "../../../containers/juce_NamedValueSet.h"
diff --git a/src/juce_app_includes.h b/src/juce_app_includes.h
index a7adb9bfb6..c3e06a1546 100644
--- a/src/juce_app_includes.h
+++ b/src/juce_app_includes.h
@@ -179,9 +179,7 @@
#ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
#include "audio/plugin_host/formats/juce_LADSPAPluginFormat.h"
#endif
-#ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
- #include "audio/plugin_host/formats/juce_VSTMidiEventList.h"
-#endif
+#include "audio/plugin_host/formats/juce_VSTMidiEventList.h"
#ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
#include "audio/plugin_host/formats/juce_VSTPluginFormat.h"
#endif
@@ -671,8 +669,8 @@
#ifndef __JUCE_FILLTYPE_JUCEHEADER__
#include "gui/graphics/contexts/juce_FillType.h"
#endif
-#ifndef __JUCE_GRAPHICS_JUCEHEADER__
- #include "gui/graphics/contexts/juce_Graphics.h"
+#ifndef __JUCE_GRAPHICSCONTEXT_JUCEHEADER__
+ #include "gui/graphics/contexts/juce_GraphicsContext.h"
#endif
#ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
#include "gui/graphics/contexts/juce_Justification.h"
diff --git a/src/native/mac/juce_ios_UIViewComponentPeer.mm b/src/native/mac/juce_ios_UIViewComponentPeer.mm
index 15e742d361..357af16b77 100644
--- a/src/native/mac/juce_ios_UIViewComponentPeer.mm
+++ b/src/native/mac/juce_ios_UIViewComponentPeer.mm
@@ -831,26 +831,6 @@ void UIViewComponentPeer::viewFocusLoss()
}
}
-void juce_HandleProcessFocusChange()
-{
- if (ComponentPeer::isValidPeer (currentlyFocusedPeer))
- {
- if (Process::isForegroundProcess())
- {
- currentlyFocusedPeer->handleFocusGain();
-
- ModalComponentManager::getInstance()->bringModalComponentsToFront();
- }
- else
- {
- currentlyFocusedPeer->handleFocusLoss();
-
- // turn kiosk mode off if we lose focus..
- Desktop::getInstance().setKioskModeComponent (nullptr);
- }
- }
-}
-
bool UIViewComponentPeer::isFocused() const
{
return isSharedWindow ? this == currentlyFocusedPeer
diff --git a/src/native/mac/juce_mac_MessageManager.mm b/src/native/mac/juce_mac_MessageManager.mm
index 4390084e80..e6e043e5a5 100644
--- a/src/native/mac/juce_mac_MessageManager.mm
+++ b/src/native/mac/juce_mac_MessageManager.mm
@@ -27,6 +27,12 @@
// compiled on its own).
#if JUCE_INCLUDED_FILE
+//==============================================================================
+typedef void (*AppFocusChangeCallback)();
+AppFocusChangeCallback appFocusChangeCallback = nullptr;
+
+typedef bool (*CheckEventBlockedByModalComps) (NSEvent*);
+CheckEventBlockedByModalComps isEventBlockedByModalComps = nullptr;
//==============================================================================
/* When you use multiple DLLs which share similarly-named obj-c classes - like
@@ -91,7 +97,8 @@ public:
virtual void focusChanged()
{
- juce_HandleProcessFocusChange();
+ if (appFocusChangeCallback != nullptr)
+ (*appFocusChangeCallback)();
}
struct CallbackMessagePayload
@@ -328,93 +335,6 @@ void MessageManager::stopDispatchLoop()
[NSEvent startPeriodicEventsAfterDelay: 0 withPeriod: 0.1];
}
-namespace
-{
- bool isEventBlockedByModalComps (NSEvent* e)
- {
- if (Component::getNumCurrentlyModalComponents() == 0)
- return false;
-
- NSWindow* const w = [e window];
- if (w == nil || [w worksWhenModal])
- return false;
-
- bool isKey = false, isInputAttempt = false;
-
- switch ([e type])
- {
- case NSKeyDown:
- case NSKeyUp:
- isKey = isInputAttempt = true;
- break;
-
- case NSLeftMouseDown:
- case NSRightMouseDown:
- case NSOtherMouseDown:
- isInputAttempt = true;
- break;
-
- case NSLeftMouseDragged:
- case NSRightMouseDragged:
- case NSLeftMouseUp:
- case NSRightMouseUp:
- case NSOtherMouseUp:
- case NSOtherMouseDragged:
- if (Desktop::getInstance().getDraggingMouseSource(0) != nullptr)
- return false;
- break;
-
- case NSMouseMoved:
- case NSMouseEntered:
- case NSMouseExited:
- case NSCursorUpdate:
- case NSScrollWheel:
- case NSTabletPoint:
- case NSTabletProximity:
- break;
-
- default:
- return false;
- }
-
- for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
- {
- ComponentPeer* const peer = ComponentPeer::getPeer (i);
- NSView* const compView = (NSView*) peer->getNativeHandle();
-
- if ([compView window] == w)
- {
- if (isKey)
- {
- if (compView == [w firstResponder])
- return false;
- }
- else
- {
- NSViewComponentPeer* nsViewPeer = dynamic_cast (peer);
-
- if ((nsViewPeer == nullptr || ! nsViewPeer->isSharedWindow)
- ? NSPointInRect ([e locationInWindow], NSMakeRect (0, 0, [w frame].size.width, [w frame].size.height))
- : NSPointInRect ([compView convertPoint: [e locationInWindow] fromView: nil], [compView bounds]))
- return false;
- }
- }
- }
-
- if (isInputAttempt)
- {
- if (! [NSApp isActive])
- [NSApp activateIgnoringOtherApps: YES];
-
- Component* const modal = Component::getCurrentlyModalComponent (0);
- if (modal != nullptr)
- modal->inputAttemptWhenModal();
- }
-
- return true;
- }
-}
-
#if JUCE_MODAL_LOOPS_PERMITTED
bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
{
@@ -433,7 +353,7 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
inMode: NSDefaultRunLoopMode
dequeue: YES];
- if (e != nil && ! isEventBlockedByModalComps (e))
+ if (e != nil && (isEventBlockedByModalComps == nullptr || ! (*isEventBlockedByModalComps) (e)))
[NSApp sendEvent: e];
if (Time::getMillisecondCounter() >= endTime)
diff --git a/src/native/mac/juce_mac_NSViewComponentPeer.mm b/src/native/mac/juce_mac_NSViewComponentPeer.mm
index 59d3213190..0789d6434f 100644
--- a/src/native/mac/juce_mac_NSViewComponentPeer.mm
+++ b/src/native/mac/juce_mac_NSViewComponentPeer.mm
@@ -29,6 +29,11 @@
class NSViewComponentPeer;
+typedef void (*AppFocusChangeCallback)();
+extern AppFocusChangeCallback appFocusChangeCallback;
+typedef bool (*CheckEventBlockedByModalComps) (NSEvent*);
+extern CheckEventBlockedByModalComps isEventBlockedByModalComps;
+
//==============================================================================
END_JUCE_NAMESPACE
@@ -304,6 +309,112 @@ public:
static Array keysCurrentlyDown;
private:
+ static void appFocusChanged()
+ {
+ keysCurrentlyDown.clear();
+
+ if (isValidPeer (currentlyFocusedPeer))
+ {
+ if (Process::isForegroundProcess())
+ {
+ currentlyFocusedPeer->handleFocusGain();
+
+ ModalComponentManager::getInstance()->bringModalComponentsToFront();
+ }
+ else
+ {
+ currentlyFocusedPeer->handleFocusLoss();
+
+ // turn kiosk mode off if we lose focus..
+ Desktop::getInstance().setKioskModeComponent (nullptr);
+ }
+ }
+ }
+
+ static bool checkEventBlockedByModalComps (NSEvent* e)
+ {
+ if (Component::getNumCurrentlyModalComponents() == 0)
+ return false;
+
+ NSWindow* const w = [e window];
+ if (w == nil || [w worksWhenModal])
+ return false;
+
+ bool isKey = false, isInputAttempt = false;
+
+ switch ([e type])
+ {
+ case NSKeyDown:
+ case NSKeyUp:
+ isKey = isInputAttempt = true;
+ break;
+
+ case NSLeftMouseDown:
+ case NSRightMouseDown:
+ case NSOtherMouseDown:
+ isInputAttempt = true;
+ break;
+
+ case NSLeftMouseDragged:
+ case NSRightMouseDragged:
+ case NSLeftMouseUp:
+ case NSRightMouseUp:
+ case NSOtherMouseUp:
+ case NSOtherMouseDragged:
+ if (Desktop::getInstance().getDraggingMouseSource(0) != nullptr)
+ return false;
+ break;
+
+ case NSMouseMoved:
+ case NSMouseEntered:
+ case NSMouseExited:
+ case NSCursorUpdate:
+ case NSScrollWheel:
+ case NSTabletPoint:
+ case NSTabletProximity:
+ break;
+
+ default:
+ return false;
+ }
+
+ for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
+ {
+ ComponentPeer* const peer = ComponentPeer::getPeer (i);
+ NSView* const compView = (NSView*) peer->getNativeHandle();
+
+ if ([compView window] == w)
+ {
+ if (isKey)
+ {
+ if (compView == [w firstResponder])
+ return false;
+ }
+ else
+ {
+ NSViewComponentPeer* nsViewPeer = dynamic_cast (peer);
+
+ if ((nsViewPeer == nullptr || ! nsViewPeer->isSharedWindow)
+ ? NSPointInRect ([e locationInWindow], NSMakeRect (0, 0, [w frame].size.width, [w frame].size.height))
+ : NSPointInRect ([compView convertPoint: [e locationInWindow] fromView: nil], [compView bounds]))
+ return false;
+ }
+ }
+ }
+
+ if (isInputAttempt)
+ {
+ if (! [NSApp isActive])
+ [NSApp activateIgnoringOtherApps: YES];
+
+ Component* const modal = Component::getCurrentlyModalComponent (0);
+ if (modal != nullptr)
+ modal->inputAttemptWhenModal();
+ }
+
+ return true;
+ }
+
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NSViewComponentPeer);
};
@@ -821,6 +932,9 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component_,
#endif
recursiveToFrontCall (false)
{
+ appFocusChangeCallback = appFocusChanged;
+ isEventBlockedByModalComps = checkEventBlockedByModalComps;
+
NSRect r = NSMakeRect (0, 0, (CGFloat) component->getWidth(), (CGFloat) component->getHeight());
view = [[JuceNSView alloc] initWithOwner: this withFrame: r];
@@ -1226,28 +1340,6 @@ void NSViewComponentPeer::viewFocusLoss()
}
}
-void juce_HandleProcessFocusChange()
-{
- NSViewComponentPeer::keysCurrentlyDown.clear();
-
- if (NSViewComponentPeer::isValidPeer (NSViewComponentPeer::currentlyFocusedPeer))
- {
- if (Process::isForegroundProcess())
- {
- NSViewComponentPeer::currentlyFocusedPeer->handleFocusGain();
-
- ModalComponentManager::getInstance()->bringModalComponentsToFront();
- }
- else
- {
- NSViewComponentPeer::currentlyFocusedPeer->handleFocusLoss();
-
- // turn kiosk mode off if we lose focus..
- Desktop::getInstance().setKioskModeComponent (nullptr);
- }
- }
-}
-
bool NSViewComponentPeer::isFocused() const
{
return isSharedWindow ? this == currentlyFocusedPeer
diff --git a/src/native/mac/juce_mac_NativeCode.mm b/src/native/mac/juce_mac_NativeCode.mm
index 288954e1a6..11f985e8aa 100644
--- a/src/native/mac/juce_mac_NativeCode.mm
+++ b/src/native/mac/juce_mac_NativeCode.mm
@@ -120,11 +120,11 @@ BEGIN_JUCE_NAMESPACE
#include "../common/juce_MidiDataConcatenator.h"
#if JUCE_IOS
+ #include "juce_ios_MessageManager.mm"
#include "juce_mac_Fonts.mm"
#include "juce_mac_CoreGraphicsContext.mm"
#include "juce_ios_UIViewComponentPeer.mm"
#include "juce_ios_Windowing.mm"
- #include "juce_ios_MessageManager.mm"
#include "juce_mac_FileChooser.mm"
#include "juce_mac_OpenGLComponent.mm"
#include "juce_mac_MouseCursor.mm"
@@ -132,6 +132,7 @@ BEGIN_JUCE_NAMESPACE
#include "juce_ios_Audio.cpp"
#include "juce_mac_CoreMidi.cpp"
#else
+ #include "juce_mac_MessageManager.mm"
#include "juce_mac_Fonts.mm" // (must go before juce_mac_CoreGraphicsContext.mm)
#include "juce_mac_CoreGraphicsContext.mm"
#include "juce_mac_NSViewComponentPeer.mm"
@@ -145,7 +146,6 @@ BEGIN_JUCE_NAMESPACE
#include "juce_mac_QuickTimeMovieComponent.mm"
#include "juce_mac_AudioCDBurner.mm"
#include "juce_mac_AudioCDReader.mm"
- #include "juce_mac_MessageManager.mm"
#include "juce_mac_WebBrowserComponent.mm"
#include "juce_mac_CoreAudio.cpp"
#include "juce_mac_CoreMidi.cpp"
diff --git a/src/native/mac/juce_mac_SystemStats.mm b/src/native/mac/juce_mac_SystemStats.mm
index 76f2cc598d..d5ca80c54b 100644
--- a/src/native/mac/juce_mac_SystemStats.mm
+++ b/src/native/mac/juce_mac_SystemStats.mm
@@ -27,6 +27,18 @@
// compiled on its own).
#if JUCE_INCLUDED_FILE
+//==============================================================================
+ScopedAutoReleasePool::ScopedAutoReleasePool()
+{
+ pool = [[NSAutoreleasePool alloc] init];
+}
+
+ScopedAutoReleasePool::~ScopedAutoReleasePool()
+{
+ [((NSAutoreleasePool*) pool) release];
+}
+
+//==============================================================================
namespace SystemStatsHelpers
{
#if JUCE_INTEL
diff --git a/src/native/mac/juce_osx_ObjCHelpers.h b/src/native/mac/juce_osx_ObjCHelpers.h
index 68b6b92aef..4366bfc26a 100644
--- a/src/native/mac/juce_osx_ObjCHelpers.h
+++ b/src/native/mac/juce_osx_ObjCHelpers.h
@@ -44,16 +44,5 @@ namespace
}
}
-//==============================================================================
-ScopedAutoReleasePool::ScopedAutoReleasePool()
-{
- pool = [[NSAutoreleasePool alloc] init];
-}
-
-ScopedAutoReleasePool::~ScopedAutoReleasePool()
-{
- [((NSAutoreleasePool*) pool) release];
-}
-
#endif // __JUCE_OSX_OBJCHELPERS_JUCEHEADER__