summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-05-13 16:40:19 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-06-05 00:03:51 +0200
commitdf2e029a06f065c82dacc28ec885b4307260b6fb (patch)
tree7c1c8f334c9036c0b5438c944fce1b205b962293 /src/plugins
parentc7d80486dee44c096ba993cbda8f69612441a264 (diff)
macOS: Clean up headers
The headers are now C++ clean and can be used outside of Objective-C code. All includes of Objective-C frameworks have been moved to the implementation files. Header guards have been added in the few places they were missing. All includes are now done via #include, instead of sometimes using the #import variant. Change-Id: Ibb0a9c0bcfefbda4347737212e40e300a3184982 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h19
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.h12
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h14
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.h5
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoainputcontext.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintrospection.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.h5
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamimetypes.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoansmenu.h20
-rw-r--r--src/plugins/platforms/cocoa/qcocoansmenu.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.h10
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoavulkaninstance.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoavulkaninstance.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h13
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm17
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindowmanager.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindowmanager.mm2
-rw-r--r--src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h2
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.h2
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm2
-rw-r--r--src/plugins/platforms/cocoa/qmultitouch_mac.mm2
-rw-r--r--src/plugins/platforms/cocoa/qmultitouch_mac_p.h8
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h12
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm3
-rw-r--r--src/plugins/platforms/cocoa/qnsview_accessibility.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.h13
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.h6
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm2
60 files changed, 183 insertions, 129 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.h b/src/plugins/platforms/cocoa/qcocoaaccessibility.h
index 539d876094..5f89a41e65 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.h
@@ -36,18 +36,16 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef QCOCOAACCESIBILITY_H
#define QCOCOAACCESIBILITY_H
-#include <AppKit/AppKit.h>
+#ifndef QT_NO_ACCESSIBILITY
-#include <QtGui>
#include <qpa/qplatformaccessibility.h>
#include "qcocoaaccessibilityelement.h"
-#ifndef QT_NO_ACCESSIBILITY
-
QT_BEGIN_NAMESPACE
class QCocoaAccessibility : public QPlatformAccessibility
@@ -81,6 +79,7 @@ namespace QCocoaAccessible {
demand.
*/
+#if defined(__OBJC__)
NSString *macRole(QAccessibleInterface *interface);
NSString *macSubrole(QAccessibleInterface *interface);
bool shouldBeIgnored(QAccessibleInterface *interface);
@@ -89,6 +88,7 @@ NSString *getTranslatedAction(const QString &qtAction);
QString translateAction(NSString *nsAction, QAccessibleInterface *interface);
bool hasValueAttribute(QAccessibleInterface *interface);
id getValueAttribute(QAccessibleInterface *interface);
+#endif // __OBJC__
}
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index 106c226adc..17ee5ba4af 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -36,6 +36,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#include <AppKit/AppKit.h>
+
#include "qcocoaaccessibility.h"
#include "qcocoaaccessibilityelement.h"
#include <QtGui/qaccessible.h>
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
index f74afb8440..93158e562f 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
@@ -36,28 +36,21 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef QCOCOAACCESIBILITYELEMENT_H
#define QCOCOAACCESIBILITYELEMENT_H
-#include <QtCore/qglobal.h>
-
-#include <QtCore/private/qcore_mac_p.h>
-
#ifndef QT_NO_ACCESSIBILITY
-#import <Cocoa/Cocoa.h>
-#import <AppKit/NSAccessibility.h>
-
-#import <qaccessible.h>
+#include <QtCore/qglobal.h>
-@interface QT_MANGLE_NAMESPACE(QMacAccessibilityElement) : NSObject <NSAccessibilityElement>
+#include <QtCore/private/qcore_mac_p.h>
+#include <QtGui/qaccessible.h>
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QMacAccessibilityElement, NSObject <NSAccessibilityElement>
- (instancetype)initWithId:(QAccessible::Id)anId;
+ (instancetype)elementWithId:(QAccessible::Id)anId;
-
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacAccessibilityElement);
+)
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 6ba0738191..4a2574496f 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -36,6 +36,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#include <AppKit/AppKit.h>
+
#include "qcocoaaccessibilityelement.h"
#include "qcocoaaccessibility.h"
#include "qcocoahelpers.h"
@@ -46,8 +49,6 @@
#include <QtGui/private/qaccessiblebridgeutils_p.h>
#include <QtGui/qaccessible.h>
-#import <AppKit/NSAccessibility.h>
-
QT_USE_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.h b/src/plugins/platforms/cocoa/qcocoaapplication.h
index 4314a01ca1..ec21b3cb9f 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.h
@@ -83,16 +83,13 @@
// We mean it.
//
+#ifndef QCOCOAAPPLICATION_H
+#define QCOCOAAPPLICATION_H
+
#include <qglobal.h>
#include <QtCore/private/qcore_mac_p.h>
-#import <AppKit/AppKit.h>
-
-
-@interface QT_MANGLE_NAMESPACE(QNSApplication) : NSApplication
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSApplication);
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QNSApplication, NSApplication)
QT_BEGIN_NAMESPACE
@@ -101,3 +98,4 @@ void qt_resetNSApplicationSendEvent();
QT_END_NAMESPACE
+#endif // QCOCOAAPPLICATION_H
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm
index c6029bcf03..43e3a99a22 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm
@@ -71,6 +71,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoaapplication.h"
#include "qcocoaintrospection.h"
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
index 8ec9d6fbe0..5ceaf2152b 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
@@ -84,24 +84,26 @@
// We mean it.
//
-
-#import <AppKit/AppKit.h>
+#ifndef QCOCOAAPPLICATIONDELEGATE_H
+#define QCOCOAAPPLICATIONDELEGATE_H
#include <qglobal.h>
#include <private/qcore_mac_p.h>
+
#include "qcocoansmenu.h"
-@interface QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) : NSObject <NSApplicationDelegate>
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QCocoaApplicationDelegate, NSObject <NSApplicationDelegate>
@property (nonatomic, retain) NSMenu *dockMenu;
+ (instancetype)sharedDelegate;
- (void)setReflectionDelegate:(NSObject<NSApplicationDelegate> *)oldDelegate;
- (void)removeAppleEventHandlers;
- (bool)inLaunch;
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaApplicationDelegate);
+)
+#if defined(__OBJC__)
@interface QCocoaApplicationDelegate (MenuAPI)
- (void)qt_itemFired:(QCocoaNSMenuItem *)item;
@end
+#endif
+#endif // QCOCOAAPPLICATIONDELEGATE_H
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index e8d789275c..bdc203e4e1 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -71,13 +71,15 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
-#import "qcocoaapplicationdelegate.h"
+#include "qcocoaapplicationdelegate.h"
#include "qcocoaintegration.h"
#include "qcocoamenu.h"
#include "qcocoamenuloader.h"
#include "qcocoamenuitem.h"
#include "qcocoansmenu.h"
+#include "qcocoahelpers.h"
#if QT_CONFIG(sessionmanager)
# include "qcocoasessionmanager.h"
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 97bb4e8bed..26cab9aa58 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoabackingstore.h"
#include "qcocoawindow.h"
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index ff08a306c4..49812423eb 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include <QtCore/qdebug.h>
#include <QtCore/qtimer.h>
#include <qpa/qplatformtheme.h>
@@ -46,8 +48,6 @@
#include "qcocoaeventdispatcher.h"
#include "private/qcoregraphics_p.h"
-#import <AppKit/AppKit.h>
-
QT_USE_NAMESPACE
@interface QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) : NSObject<NSWindowDelegate, QNSPanelDelegate>
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h
index 6589891ef2..c1aac306aa 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.h
+++ b/src/plugins/platforms/cocoa/qcocoacursor.h
@@ -40,11 +40,11 @@
#ifndef QWINDOWSCURSOR_H
#define QWINDOWSCURSOR_H
-#include <AppKit/AppKit.h>
-
#include <QtCore>
#include <qpa/qplatformcursor.h>
+Q_FORWARD_DECLARE_OBJC_CLASS(NSCursor);
+
QT_BEGIN_NAMESPACE
class QCocoaCursor : public QPlatformCursor
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index 8ca72ec619..9e3bdb7b60 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoacursor.h"
#include "qcocoawindow.h"
#include "qcocoascreen.h"
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h
index 975741c270..a062b92506 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.h
+++ b/src/plugins/platforms/cocoa/qcocoadrag.h
@@ -40,7 +40,6 @@
#ifndef QCOCOADRAG_H
#define QCOCOADRAG_H
-#include <AppKit/AppKit.h>
#include <QtGui>
#include <qpa/qplatformdrag.h>
#include <private/qsimpledrag_p.h>
@@ -50,6 +49,10 @@
#include <QtCore/qeventloop.h>
+Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSEvent);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSPasteboard);
+
QT_BEGIN_NAMESPACE
class QCocoaDrag : public QPlatformDrag
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index cf48c50caf..eed9d3a42b 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoadrag.h"
#include "qmacclipboard.h"
#include "qcocoahelpers.h"
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 338a5516d9..597b380caf 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -71,6 +71,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoaeventdispatcher.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
@@ -89,8 +91,6 @@
#include <QtCore/qdebug.h>
-#include <AppKit/AppKit.h>
-
QT_BEGIN_NAMESPACE
static inline CFRunLoopRef mainRunLoop()
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
index add02d342b..1d01c0d1cf 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
@@ -44,12 +44,7 @@
#include <qpa/qplatformdialoghelper.h>
#include <QtCore/private/qcore_mac_p.h>
-#import <AppKit/NSSavePanel.h>
-
-@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject<NSOpenSavePanelDelegate>
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QNSOpenSavePanelDelegate, NSObject<NSOpenSavePanelDelegate>)
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 15e83db48f..d2037923d0 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include <qpa/qplatformtheme.h>
#include "qcocoafiledialoghelper.h"
@@ -64,8 +66,7 @@
#include <qpa/qplatformnativeinterface.h>
-#import <AppKit/NSSavePanel.h>
-#import <CoreFoundation/CFNumber.h>
+#include <CoreFoundation/CFNumber.h>
QT_FORWARD_DECLARE_CLASS(QString)
QT_FORWARD_DECLARE_CLASS(QStringList)
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index 7748c304e3..0e8f09ab30 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include <QtCore/qtimer.h>
#include <QtGui/qfontdatabase.h>
#include <qpa/qplatformtheme.h>
@@ -49,8 +51,6 @@
#include "qcocoahelpers.h"
#include "qcocoaeventdispatcher.h"
-#import <AppKit/AppKit.h>
-
#if !CGFLOAT_DEFINED
typedef float CGFloat; // Should only not be defined on 32-bit platforms
#endif
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 238067568b..f1851a2336 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -46,7 +46,8 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QWindow>
-#include <AppKit/AppKit.h>
+Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLContext);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLPixelFormat);
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 9ca3892cbb..826589e56f 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoaglcontext.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
@@ -46,8 +48,6 @@
#include <QtPlatformHeaders/qcocoanativecontext.h>
#include <dlfcn.h>
-#import <AppKit/AppKit.h>
-
static inline QByteArray getGlString(GLenum param)
{
if (const GLubyte *s = glGetString(param))
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 71e72dca4f..2e84abd739 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -51,8 +51,6 @@
// We mean it.
//
-#include <AppKit/AppKit.h>
-
#include <private/qguiapplication_p.h>
#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qloggingcategory.h>
@@ -62,6 +60,8 @@
#include <objc/runtime.h>
#include <objc/message.h>
+#if defined(__OBJC__)
+
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSView));
struct mach_header;
@@ -377,5 +377,7 @@ QSendSuperHelper<Args...> qt_objcDynamicSuperHelper(id receiver, SEL selector, A
// Same as calling super, but the super_class field resolved at runtime instead of compile time
#define qt_objcDynamicSuper(...) qt_objcDynamicSuperHelper(self, _cmd, ##__VA_ARGS__)
+#endif // __OBJC__
+
#endif //QCOCOAHELPERS_H
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index f8c1242259..6c21d1a374 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include <qpa/qplatformtheme.h>
#include "qcocoahelpers.h"
diff --git a/src/plugins/platforms/cocoa/qcocoainputcontext.mm b/src/plugins/platforms/cocoa/qcocoainputcontext.mm
index 000bcd708b..49c622e83b 100644
--- a/src/plugins/platforms/cocoa/qcocoainputcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoainputcontext.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qnsview.h"
#include "qcocoainputcontext.h"
#include "qcocoanativeinterface.h"
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 2fb16faca5..d2fffc8e73 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -40,8 +40,6 @@
#ifndef QPLATFORMINTEGRATION_COCOA_H
#define QPLATFORMINTEGRATION_COCOA_H
-#include <AppKit/AppKit.h>
-
#include "qcocoacursor.h"
#include "qcocoawindow.h"
#include "qcocoanativeinterface.h"
@@ -59,6 +57,8 @@
#include <qpa/qplatformintegration.h>
#include <QtGui/private/qcoretextfontdatabase_p.h>
+Q_FORWARD_DECLARE_OBJC_CLASS(NSToolbar);
+
QT_BEGIN_NAMESPACE
class QCocoaIntegration : public QObject, public QPlatformIntegration
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 712d933c04..49e8f8eada 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoaintegration.h"
#include "qcocoawindow.h"
diff --git a/src/plugins/platforms/cocoa/qcocoaintrospection.h b/src/plugins/platforms/cocoa/qcocoaintrospection.h
index 20001ac71d..21b55a1711 100644
--- a/src/plugins/platforms/cocoa/qcocoaintrospection.h
+++ b/src/plugins/platforms/cocoa/qcocoaintrospection.h
@@ -71,8 +71,11 @@
**
****************************************************************************/
+#ifndef QCOCOAINTROSPECTION_H
+#define QCOCOAINTROSPECTION_H
+
#include <qglobal.h>
-#import <objc/objc-class.h>
+#include <objc/objc-class.h>
QT_BEGIN_NAMESPACE
@@ -80,3 +83,5 @@ void qt_cocoa_change_implementation(Class baseClass, SEL originalSel, Class prox
void qt_cocoa_change_back_implementation(Class baseClass, SEL originalSel, SEL backupSel);
QT_END_NAMESPACE
+
+#endif // QCOCOAINTROSPECTION_H
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.h b/src/plugins/platforms/cocoa/qcocoakeymapper.h
index 2624f19978..b4eacf7a76 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.h
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.h
@@ -40,14 +40,13 @@
#ifndef QCOCOAKEYMAPPER_H
#define QCOCOAKEYMAPPER_H
-#include "qcocoahelpers.h"
-
-#include <AppKit/AppKit.h>
#include <Carbon/Carbon.h>
#include <QtCore/QList>
#include <QtGui/QKeyEvent>
+#include <QtCore/private/qcore_mac_p.h>
+
QT_BEGIN_NAMESPACE
/*
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
index 350ae4b9be..8d923bb9ec 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoakeymapper.h"
#include <QtCore/QDebug>
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 1dccf0621c..32f9c0820f 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -43,6 +43,7 @@
#include <QtCore/QList>
#include <qpa/qplatformmenu.h>
+
#include "qcocoamenuitem.h"
#include "qcocoansmenu.h"
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 90d5180fed..c19fd5b752 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -38,6 +38,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoamenu.h"
#include "qcocoansmenu.h"
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 653e4a337e..c51edb3dec 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -38,6 +38,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include <qpa/qplatformtheme.h>
#include "qcocoamenuitem.h"
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.h b/src/plugins/platforms/cocoa/qcocoamenuloader.h
index 5e83327854..797d6b46d2 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.h
@@ -51,12 +51,11 @@
// We mean it.
//
-#import <AppKit/AppKit.h>
#include <QtCore/private/qcore_mac_p.h>
QT_FORWARD_DECLARE_CLASS(QCocoaMenuItem);
-@interface QT_MANGLE_NAMESPACE(QCocoaMenuLoader) : NSObject
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QCocoaMenuLoader, NSObject
+ (instancetype)sharedMenuLoader;
- (NSMenu *)menu;
- (void)ensureAppMenuInMenu:(NSMenu *)menu;
@@ -68,8 +67,6 @@ QT_FORWARD_DECLARE_CLASS(QCocoaMenuItem);
- (NSMenuItem *)appSpecificMenuItem:(QCocoaMenuItem *)platformItem;
- (void)qtTranslateApplicationMenu;
- (NSArray<NSMenuItem *> *)mergeable;
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuLoader);
+)
#endif // QCOCOAMENULOADER_P_H
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index a7c17fc177..56e5b4bdee 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoamenuloader.h"
#include "qcocoahelpers.h"
diff --git a/src/plugins/platforms/cocoa/qcocoamimetypes.mm b/src/plugins/platforms/cocoa/qcocoamimetypes.mm
index 6b88def642..82ff8fe002 100644
--- a/src/plugins/platforms/cocoa/qcocoamimetypes.mm
+++ b/src/plugins/platforms/cocoa/qcocoamimetypes.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoamimetypes.h"
#include <QtGui/private/qmacmime_p.h>
#include "qcocoahelpers.h"
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index fbc2e8f13e..ba4ad719d2 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -37,9 +37,12 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoanativeinterface.h"
#include "qcocoawindow.h"
#include "qcocoamenu.h"
+#include "qcocoansmenu.h"
#include "qcocoamenubar.h"
#include "qcocoahelpers.h"
#include "qcocoaapplicationdelegate.h"
@@ -63,8 +66,6 @@
#include <QtPlatformHeaders/qcocoawindowfunctions.h>
-#include <AppKit/AppKit.h>
-
#if QT_CONFIG(vulkan)
#include <MoltenVK/mvk_vulkan.h>
#endif
diff --git a/src/plugins/platforms/cocoa/qcocoansmenu.h b/src/plugins/platforms/cocoa/qcocoansmenu.h
index bd0334e061..0ea7d1331d 100644
--- a/src/plugins/platforms/cocoa/qcocoansmenu.h
+++ b/src/plugins/platforms/cocoa/qcocoansmenu.h
@@ -51,32 +51,26 @@
// We mean it.
//
-#import <AppKit/AppKit.h>
-
-#include "qcocoahelpers.h"
+#include <QtCore/private/qcore_mac_p.h>
QT_FORWARD_DECLARE_CLASS(QCocoaMenu);
QT_FORWARD_DECLARE_CLASS(QCocoaMenuItem);
-@interface QT_MANGLE_NAMESPACE(QCocoaNSMenuDelegate) : NSObject <NSMenuDelegate>
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QCocoaNSMenuDelegate, NSObject <NSMenuDelegate>
+ (instancetype)sharedMenuDelegate;
- (NSMenuItem *)findItemInMenu:(NSMenu *)menu forKey:(NSString *)key modifiers:(NSUInteger)modifiers;
-@end
+)
-@interface QT_MANGLE_NAMESPACE(QCocoaNSMenu) : NSMenu
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QCocoaNSMenu, NSMenu
@property (readonly, nonatomic) QCocoaMenu *platformMenu;
- (instancetype)initWithPlatformMenu:(QCocoaMenu *)menu;
-@end
+)
-@interface QT_MANGLE_NAMESPACE(QCocoaNSMenuItem) : NSMenuItem
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QCocoaNSMenuItem, NSMenuItem
@property (nonatomic) QCocoaMenuItem *platformMenuItem;
+ (instancetype)separatorItemWithPlatformMenuItem:(QCocoaMenuItem *)menuItem;
- (instancetype)initWithPlatformMenuItem:(QCocoaMenuItem *)menuItem;
- (instancetype)init;
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenu);
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenuItem);
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenuDelegate);
+)
#endif // QCOCOANSMENU_H
diff --git a/src/plugins/platforms/cocoa/qcocoansmenu.mm b/src/plugins/platforms/cocoa/qcocoansmenu.mm
index c51460282a..44e574e83d 100644
--- a/src/plugins/platforms/cocoa/qcocoansmenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoansmenu.mm
@@ -37,12 +37,15 @@
**
****************************************************************************/
-#import "qcocoansmenu.h"
+#include <AppKit/AppKit.h>
+
+#include "qcocoansmenu.h"
#include "qcocoamenu.h"
#include "qcocoamenuitem.h"
#include "qcocoamenubar.h"
#include "qcocoawindow.h"
-#import "qnsview.h"
+#include "qnsview.h"
+#include "qcocoahelpers.h"
#include <QtCore/qcoreapplication.h>
#include <QtCore/qcoreevent.h>
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.h b/src/plugins/platforms/cocoa/qcocoascreen.h
index dcf6f1c753..5a5d7fc735 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.h
+++ b/src/plugins/platforms/cocoa/qcocoascreen.h
@@ -40,12 +40,16 @@
#ifndef QCOCOASCREEN_H
#define QCOCOASCREEN_H
-#include <AppKit/AppKit.h>
-
#include "qcocoacursor.h"
#include <qpa/qplatformintegration.h>
+#include <CoreGraphics/CoreGraphics.h>
+#include <CoreVideo/CoreVideo.h>
+
+Q_FORWARD_DECLARE_OBJC_CLASS(NSScreen);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSArray);
+
QT_BEGIN_NAMESPACE
class QCocoaIntegration;
@@ -136,8 +140,10 @@ QDebug operator<<(QDebug debug, const QCocoaScreen *screen);
QT_END_NAMESPACE
+#if defined(__OBJC__)
@interface NSScreen (QtExtras)
@property(readonly) CGDirectDisplayID qt_displayId;
@end
+#endif
#endif // QCOCOASCREEN_H
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm
index 6a3172fb19..ebf1afb57d 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.mm
+++ b/src/plugins/platforms/cocoa/qcocoascreen.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoascreen.h"
#include "qcocoawindow.h"
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
index 141995d1b1..ddc76f6b72 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
@@ -47,18 +47,20 @@
#if QT_CONFIG(systemtrayicon)
#include <QtCore/qstring.h>
+#include <QtCore/private/qcore_mac_p.h>
+
#include <QtGui/qpa/qplatformsystemtrayicon.h>
#include "qcocoamenu.h"
QT_FORWARD_DECLARE_CLASS(QCocoaSystemTrayIcon);
-@interface QT_MANGLE_NAMESPACE(QStatusItemDelegate) : NSObject <NSUserNotificationCenterDelegate>
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QStatusItemDelegate, NSObject <NSUserNotificationCenterDelegate>
- (instancetype)initWithSysTray:(QCocoaSystemTrayIcon *)platformSystemTray;
@property (nonatomic, assign) QCocoaSystemTrayIcon *platformSystemTray;
-@end
+)
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QStatusItemDelegate);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSStatusItem);
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 8c96b2376f..3b5b5fc6f8 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -72,6 +72,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoasystemtrayicon.h"
#ifndef QT_NO_SYSTEMTRAYICON
@@ -83,14 +85,13 @@
#include <QtCore/private/qcore_mac_p.h>
#include "qcocoamenu.h"
+#include "qcocoansmenu.h"
#include "qcocoahelpers.h"
#include "qcocoaintegration.h"
#include "qcocoascreen.h"
#include <QtGui/private/qcoregraphics_p.h>
-#import <AppKit/AppKit.h>
-
QT_BEGIN_NAMESPACE
void QCocoaSystemTrayIcon::init()
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 838a7cbbf1..13e1b9da2b 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#import <AppKit/AppKit.h>
+#include <AppKit/AppKit.h>
#include "qcocoatheme.h"
diff --git a/src/plugins/platforms/cocoa/qcocoavulkaninstance.h b/src/plugins/platforms/cocoa/qcocoavulkaninstance.h
index e6b69ba54f..e9ffab3fb4 100644
--- a/src/plugins/platforms/cocoa/qcocoavulkaninstance.h
+++ b/src/plugins/platforms/cocoa/qcocoavulkaninstance.h
@@ -49,8 +49,6 @@
#include <QtCore/QHash>
#include <QtGui/private/qbasicvulkanplatforminstance_p.h>
-#include <AppKit/AppKit.h>
-
QT_BEGIN_NAMESPACE
class QCocoaVulkanInstance : public QBasicPlatformVulkanInstance
diff --git a/src/plugins/platforms/cocoa/qcocoavulkaninstance.mm b/src/plugins/platforms/cocoa/qcocoavulkaninstance.mm
index 9e714859f2..b491387e07 100644
--- a/src/plugins/platforms/cocoa/qcocoavulkaninstance.mm
+++ b/src/plugins/platforms/cocoa/qcocoavulkaninstance.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoavulkaninstance.h"
#include "qcocoawindow.h"
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 4688598da7..e4debd669d 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -40,8 +40,6 @@
#ifndef QCOCOAWINDOW_H
#define QCOCOAWINDOW_H
-#include <AppKit/AppKit.h>
-
#include <qpa/qplatformwindow.h>
#include <QRect>
#include <QPointer>
@@ -56,6 +54,15 @@
#include <MoltenVK/mvk_vulkan.h>
#endif
+Q_FORWARD_DECLARE_OBJC_CLASS(NSWindow);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSCursor);
+
+#if !defined(__OBJC__)
+using NSInteger = long;
+using NSUInteger = unsigned long;
+#endif
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_DEBUG_STREAM
@@ -262,7 +269,7 @@ public: // for QNSView
static const int NoAlertRequest;
NSInteger m_alertRequest;
- id monitor;
+ NSObject *m_monitor;
bool m_drawContentBorderGradient;
int m_topContentBorderThickness;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 14833267d2..13a7523ade 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -36,6 +36,10 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#include <AppKit/AppKit.h>
+#include <QuartzCore/QuartzCore.h>
+
#include "qcocoawindow.h"
#include "qcocoaintegration.h"
#include "qcocoascreen.h"
@@ -57,9 +61,6 @@
#include <QtGui/private/qcoregraphics_p.h>
#include <QtGui/private/qhighdpiscaling_p.h>
-#include <AppKit/AppKit.h>
-#include <QuartzCore/QuartzCore.h>
-
#include <QDebug>
#include <vector>
@@ -149,7 +150,7 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle)
, m_registerTouchCount(0)
, m_resizableTransientParent(false)
, m_alertRequest(NoAlertRequest)
- , monitor(nil)
+ , m_monitor(nil)
, m_drawContentBorderGradient(false)
, m_topContentBorderThickness(0)
, m_bottomContentBorderThickness(0)
@@ -389,7 +390,7 @@ void QCocoaWindow::setVisible(bool visible)
removeMonitor();
NSEventMask eventMask = NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown
| NSEventMaskOtherMouseDown | NSEventMaskMouseMoved;
- monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *e) {
+ m_monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *e) {
const auto button = cocoaButton2QtButton(e);
const auto buttons = currentlyPressedMouseButtons();
const auto eventType = cocoaEvent2QtMouseEvent(e);
@@ -1678,10 +1679,10 @@ bool QCocoaWindow::alwaysShowToolWindow() const
void QCocoaWindow::removeMonitor()
{
- if (!monitor)
+ if (!m_monitor)
return;
- [NSEvent removeMonitor:monitor];
- monitor = nil;
+ [NSEvent removeMonitor:m_monitor];
+ m_monitor = nil;
}
bool QCocoaWindow::setWindowModified(bool modified)
diff --git a/src/plugins/platforms/cocoa/qcocoawindowmanager.h b/src/plugins/platforms/cocoa/qcocoawindowmanager.h
index 54f17eeccd..2877dcd5ef 100644
--- a/src/plugins/platforms/cocoa/qcocoawindowmanager.h
+++ b/src/plugins/platforms/cocoa/qcocoawindowmanager.h
@@ -42,8 +42,6 @@
#include <QtCore/qglobal.h>
-#include <AppKit/AppKit.h>
-
QT_BEGIN_NAMESPACE
class QCocoaWindowManager
diff --git a/src/plugins/platforms/cocoa/qcocoawindowmanager.mm b/src/plugins/platforms/cocoa/qcocoawindowmanager.mm
index 5e218157c2..bb72fea5e6 100644
--- a/src/plugins/platforms/cocoa/qcocoawindowmanager.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindowmanager.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qcocoawindowmanager.h"
#include "qcocoawindow.h"
diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
index e070ba977d..5d4b6d6a71 100644
--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
@@ -43,6 +43,8 @@
#include <qpa/qplatformgraphicsbuffer.h>
#include <private/qcore_mac_p.h>
+#include <IOSurface/IOSurface.h>
+
QT_BEGIN_NAMESPACE
class QIOSurfaceGraphicsBuffer : public QPlatformGraphicsBuffer
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.h b/src/plugins/platforms/cocoa/qmacclipboard.h
index 40441d924c..0cb6239690 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.h
+++ b/src/plugins/platforms/cocoa/qmacclipboard.h
@@ -43,7 +43,7 @@
#include <QtGui>
#include <QtGui/private/qmacmime_p.h>
-#import <AppKit/AppKit.h>
+#include <ApplicationServices/ApplicationServices.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm
index 3202c6926e..2afd3f6e13 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.mm
+++ b/src/plugins/platforms/cocoa/qmacclipboard.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qmacclipboard.h"
#include <QtGui/qclipboard.h>
#include <QtGui/qguiapplication.h>
diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac.mm b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
index ac2317b217..3f7402aeed 100644
--- a/src/plugins/platforms/cocoa/qmultitouch_mac.mm
+++ b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qmultitouch_mac_p.h"
#include "qcocoahelpers.h"
#include "qcocoascreen.h"
diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac_p.h b/src/plugins/platforms/cocoa/qmultitouch_mac_p.h
index dff289f746..f29367ccff 100644
--- a/src/plugins/platforms/cocoa/qmultitouch_mac_p.h
+++ b/src/plugins/platforms/cocoa/qmultitouch_mac_p.h
@@ -52,14 +52,16 @@
#define QMULTITOUCH_MAC_P_H
#include <QtCore/qglobal.h>
-
-#import <AppKit/AppKit.h>
-
#include <qpa/qwindowsysteminterface.h>
#include <qhash.h>
#include <QtCore>
#include <QtGui/qtouchdevice.h>
+#include <QtCore/private/qcore_mac_p.h>
+
+Q_FORWARD_DECLARE_OBJC_CLASS(NSTouch);
+QT_FORWARD_DECLARE_OBJC_ENUM(NSTouchPhase, unsigned long);
+
QT_BEGIN_NAMESPACE
class QCocoaTouch
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 0a18afe3a6..2c7bb00df2 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -40,9 +40,6 @@
#ifndef QNSVIEW_H
#define QNSVIEW_H
-#include <AppKit/AppKit.h>
-#include <MetalKit/MetalKit.h>
-
#include <QtCore/private/qcore_mac_p.h>
QT_BEGIN_NAMESPACE
@@ -51,14 +48,13 @@ class QCocoaGLContext;
class QPointF;
QT_END_NAMESPACE
-@interface QT_MANGLE_NAMESPACE(QNSView) : NSView
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QNSView, NSView
@property (nonatomic, retain) NSCursor *cursor;
- (instancetype)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint;
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView);
+)
+#if defined(__OBJC__)
@interface QNSView (MouseAPI)
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent;
- (void)resetMouseButtons;
@@ -76,5 +72,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView);
@interface QNSView (QtExtras)
@property (nonatomic, readonly) QCocoaWindow *platformWindow;
@end
+#endif // __OBJC__
+
#endif //QNSVIEW_H
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index bae839b38c..bd7e10e2c7 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -39,6 +39,9 @@
#include <QtGui/qtguiglobal.h>
+#include <AppKit/AppKit.h>
+#include <MetalKit/MetalKit.h>
+
#include "qnsview.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
diff --git a/src/plugins/platforms/cocoa/qnsview_accessibility.mm b/src/plugins/platforms/cocoa/qnsview_accessibility.mm
index 7041e14da7..cd16ca2133 100644
--- a/src/plugins/platforms/cocoa/qnsview_accessibility.mm
+++ b/src/plugins/platforms/cocoa/qnsview_accessibility.mm
@@ -45,7 +45,7 @@
#include <QtGui/qaccessible.h>
-#import <AppKit/NSAccessibility.h>
+#include <AppKit/NSAccessibility.h>
@implementation QNSView (Accessibility)
diff --git a/src/plugins/platforms/cocoa/qnswindow.h b/src/plugins/platforms/cocoa/qnswindow.h
index 3263df3862..f7dccb1ab2 100644
--- a/src/plugins/platforms/cocoa/qnswindow.h
+++ b/src/plugins/platforms/cocoa/qnswindow.h
@@ -44,10 +44,10 @@
#include <QPointer>
#include <QtCore/private/qcore_mac_p.h>
-#include <AppKit/AppKit.h>
-
QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
+#if defined(__OBJC__)
+
// @compatibility_alias doesn't work with categories or their methods
#define FullScreenProperty QT_MANGLE_NAMESPACE(FullScreenProperty)
#define qt_fullScreen QT_MANGLE_NAMESPACE(qt_fullScreen)
@@ -69,10 +69,11 @@ QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
-@interface QT_MANGLE_NAMESPACE(QNSWindow) : NSWindow<QNSWindowProtocol> @end
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindow);
+#else
+class QCocoaNSWindow;
+#endif // __OBJC__
-@interface QT_MANGLE_NAMESPACE(QNSPanel) : NSPanel<QNSWindowProtocol> @end
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSPanel);
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QNSWindow, NSWindow <QNSWindowProtocol>)
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QNSPanel, NSPanel <QNSWindowProtocol>)
#endif // QNSWINDOW_H
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm
index 311c291252..2e0a1f2277 100644
--- a/src/plugins/platforms/cocoa/qnswindow.mm
+++ b/src/plugins/platforms/cocoa/qnswindow.mm
@@ -39,6 +39,8 @@
#if !defined(QNSWINDOW_PROTOCOL_IMPLMENTATION)
+#include <AppKit/AppKit.h>
+
#include "qnswindow.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h
index be870deb3a..6d86fb76d2 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.h
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h
@@ -40,16 +40,12 @@
#ifndef QNSWINDOWDELEGATE_H
#define QNSWINDOWDELEGATE_H
-#include <AppKit/AppKit.h>
#include <QtCore/private/qcore_mac_p.h>
QT_BEGIN_NAMESPACE
class QCocoaWindow;
QT_END_NAMESPACE
-@interface QT_MANGLE_NAMESPACE(QNSWindowDelegate) : NSObject <NSWindowDelegate>
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowDelegate);
+QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QNSWindowDelegate, NSObject <NSWindowDelegate>)
#endif // QNSWINDOWDELEGATE_H
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index 3ad9085dea..8b80ba4076 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+
#include "qnswindowdelegate.h"
#include "qcocoahelpers.h"
#include "qcocoawindow.h"