summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-01-16 11:44:20 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-01-16 11:48:55 +0100
commite2a546a18be88f380b3d9d3efbed390fe1a9e93f (patch)
treef7a6a0c7a60ee7b771ee9d6256c385f761113135 /src/plugins
parent0be8f59d725d4a5e79709487e3aac1d351a6c04c (diff)
parent99b89d30fa5484c5d1f3cbda828648c28af4fb7d (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.h12
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.mm30
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm3
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.h7
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp2
10 files changed, 23 insertions, 48 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.h b/src/plugins/platforms/cocoa/qcocoaapplication.h
index 7bd3c8c76c..66a92686bc 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.h
@@ -83,23 +83,11 @@
// We mean it.
//
-/*
- Cocoa Application Categories
-*/
#include "qglobal.h"
#include "private/qcore_mac_p.h"
#import <AppKit/AppKit.h>
-@class QT_MANGLE_NAMESPACE(QCocoaMenuLoader);
-
-@interface NSApplication (QT_MANGLE_NAMESPACE(QApplicationIntegration))
-- (void)QT_MANGLE_NAMESPACE(qt_setDockMenu):(NSMenu *)newMenu;
-- (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel;
-
-- (void)QT_MANGLE_NAMESPACE(qt_sendPostedMessage):(NSEvent *)event;
-- (BOOL)QT_MANGLE_NAMESPACE(qt_filterEvent):(NSEvent *)event;
-@end
@interface QT_MANGLE_NAMESPACE(QNSApplication) : NSApplication {
}
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm
index 3b950efa55..d0f27795b6 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm
@@ -82,25 +82,7 @@
QT_USE_NAMESPACE
-@implementation NSApplication (QT_MANGLE_NAMESPACE(QApplicationIntegration))
-
-- (void)QT_MANGLE_NAMESPACE(qt_setDockMenu):(NSMenu *)newMenu
-{
- [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] setDockMenu:newMenu];
-}
-
-- (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel
-{
- Q_UNUSED(fontPanel);
- // only display those things that QFont can handle
- return NSFontPanelFaceModeMask
- | NSFontPanelSizeModeMask
- | NSFontPanelCollectionModeMask
- | NSFontPanelUnderlineEffectModeMask
- | NSFontPanelStrikethroughEffectModeMask;
-}
-
-- (void)QT_MANGLE_NAMESPACE(qt_sendPostedMessage):(NSEvent *)event
+static void qt_sendPostedMessage(NSEvent *event)
{
// WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5!
// That is why we need to split the address in two parts:
@@ -128,7 +110,7 @@ QT_USE_NAMESPACE
static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSEvent");
-- (BOOL)QT_MANGLE_NAMESPACE(qt_filterEvent):(NSEvent *)event
+static bool qt_filterEvent(NSEvent *event)
{
if (qApp && qApp->eventDispatcher()->
filterNativeEvent(q_macLocalEventType, static_cast<void*>(event), 0))
@@ -137,7 +119,7 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
if ([event type] == NSApplicationDefined) {
switch (static_cast<short>([event subtype])) {
case QtCocoaEventSubTypePostMessage:
- [NSApp QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
+ qt_sendPostedMessage(event);
return true;
default:
break;
@@ -147,8 +129,6 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
return false;
}
-@end
-
static void qt_maybeSendKeyEquivalentUpEvent(NSEvent *event)
{
// Cocoa is known for not sending key up events for key
@@ -180,7 +160,7 @@ static void qt_maybeSendKeyEquivalentUpEvent(NSEvent *event)
// be called instead of sendEvent if redirection occurs.
// 'self' will then be an instance of NSApplication
// (and not QNSApplication)
- if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event]) {
+ if (!qt_filterEvent(event)) {
[self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event];
qt_maybeSendKeyEquivalentUpEvent(event);
}
@@ -190,7 +170,7 @@ static void qt_maybeSendKeyEquivalentUpEvent(NSEvent *event)
{
// This method will be called if
// no redirection occurs
- if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event]) {
+ if (!qt_filterEvent(event)) {
[super sendEvent:event];
qt_maybeSendKeyEquivalentUpEvent(event);
}
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 5d331c0e96..aa6124507d 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -49,7 +49,7 @@
QT_USE_NAMESPACE
-@interface QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) : NSObject<NSWindowDelegate, QT_MANGLE_NAMESPACE(QNSPanelDelegate)>
+@interface QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) : NSObject<NSWindowDelegate, QNSPanelDelegate>
{
@public
NSColorPanel *mColorPanel;
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index dbd7e90dba..9a96895d07 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -75,7 +75,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
@class QT_MANGLE_NAMESPACE(QNSFontPanelDelegate);
-@interface QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) : NSObject<NSWindowDelegate, QT_MANGLE_NAMESPACE(QNSPanelDelegate)>
+@interface QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) : NSObject<NSWindowDelegate, QNSPanelDelegate>
{
@public
NSFontPanel *mFontPanel;
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 7810733255..7ce247f861 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -164,7 +164,10 @@ T qt_mac_resolveOption(const T &fallback, QWindow *window, const QByteArray &pro
QT_END_NAMESPACE
-@protocol QT_MANGLE_NAMESPACE(QNSPanelDelegate)
+// @compatibility_alias doesn't work with protocols
+#define QNSPanelDelegate QT_MANGLE_NAMESPACE(QNSPanelDelegate)
+
+@protocol QNSPanelDelegate
@required
- (void)onOkClicked;
- (void)onCancelClicked;
@@ -182,7 +185,7 @@ QT_END_NAMESPACE
@property (nonatomic, readonly) NSView *panelContents; // ARC: unretained, make it weak
@property (nonatomic, assign) NSEdgeInsets panelContentsMargins;
-- (instancetype)initWithPanelDelegate:(id<QT_MANGLE_NAMESPACE(QNSPanelDelegate)>)panelDelegate;
+- (instancetype)initWithPanelDelegate:(id<QNSPanelDelegate>)panelDelegate;
- (void)dealloc;
- (NSButton *)createButtonWithTitle:(const char *)title;
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 9f9618177d..0380e0e79d 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -306,7 +306,7 @@ QT_END_NAMESPACE
@synthesize panelContents = _panelContents;
@synthesize panelContentsMargins = _panelContentsMargins;
-- (instancetype)initWithPanelDelegate:(id<QT_MANGLE_NAMESPACE(QNSPanelDelegate)>)panelDelegate
+- (instancetype)initWithPanelDelegate:(id<QNSPanelDelegate>)panelDelegate
{
if ((self = [super initWithFrame:NSZeroRect])) {
// create OK and Cancel buttons and add these as subviews
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 8943cb6cd5..58cfcd3c42 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -42,7 +42,7 @@
#include "qcocoamenu.h"
#include "qcocoamenubar.h"
#include "qcocoahelpers.h"
-#include "qcocoaapplication.h"
+#include "qcocoaapplicationdelegate.h"
#include "qcocoaintegration.h"
#include "qcocoaeventdispatcher.h"
@@ -256,7 +256,7 @@ void QCocoaNativeInterface::setDockMenu(QPlatformMenu *platformMenu)
QMacAutoReleasePool pool;
QCocoaMenu *cocoaPlatformMenu = static_cast<QCocoaMenu *>(platformMenu);
NSMenu *menu = cocoaPlatformMenu->nsMenu();
- [NSApp QT_MANGLE_NAMESPACE(qt_setDockMenu): menu];
+ [[QCocoaApplicationDelegate sharedDelegate] setDockMenu:menu];
}
void *QCocoaNativeInterface::qMenuToNSMenu(QPlatformMenu *platformMenu)
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 13e9d8809e..e756f0aeb0 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -289,9 +289,6 @@ void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &mess
}
QT_END_NAMESPACE
-@implementation NSStatusItem (Qt)
-@end
-
@implementation QNSImageView
-(id)initWithParent:(QNSStatusItem*)myParent {
self = [super init];
diff --git a/src/plugins/platforms/cocoa/qnswindow.h b/src/plugins/platforms/cocoa/qnswindow.h
index 1258fddb31..ea690b69e3 100644
--- a/src/plugins/platforms/cocoa/qnswindow.h
+++ b/src/plugins/platforms/cocoa/qnswindow.h
@@ -48,10 +48,17 @@
QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
+// @compatibility_alias doesn't work with categories or their methods
+#define FullScreenProperty QT_MANGLE_NAMESPACE(FullScreenProperty)
+#define qt_fullScreen QT_MANGLE_NAMESPACE(qt_fullScreen)
+
@interface NSWindow (FullScreenProperty)
@property(readonly) BOOL qt_fullScreen;
@end
+// @compatibility_alias doesn't work with protocols
+#define QNSWindowProtocol QT_MANGLE_NAMESPACE(QNSWindowProtocol)
+
@protocol QNSWindowProtocol
@optional
- (BOOL)canBecomeKeyWindow;
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index d9aebff700..365f89957a 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -1161,7 +1161,7 @@ static void qLibraryInit()
#endif // Q_NO_MYSQL_EMBEDDED
#ifdef MARIADB_BASE_VERSION
- qAddPostRoutine(mysql_server_end);
+ qAddPostRoutine([]() { mysql_server_end(); });
#endif
}