summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-04-26 11:08:23 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-04-26 11:08:23 +0000
commit75d4742e0481d236aba9913768f24b377603f6c6 (patch)
treef799474f9dc86fdc12ff5aea28f545e4c58d28fa /src/plugins/platforms/cocoa
parent84330007e12122bf1b690a4e68b5ef8e973c7882 (diff)
parentbb4b86618dc930e0035c5829e336f2606d140ada (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm9
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm26
2 files changed, 34 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 07a9c18471..f6a3b3943f 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -337,6 +337,15 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
[newDelegate setMenuLoader:qtMenuLoader];
}
+ // The presentation options such as whether or not the dock and/or menu bar is
+ // hidden (automatically by the system) affects the main screen's available
+ // geometry. Since we're initializing the screens synchronously at application
+ // startup we need to ensure that the presentation options have been propagated
+ // to the screen before we read out its properties. Normally OS X does this in
+ // an asynchronous callback, but that's too late for us. We force the propagation
+ // by explicitly setting the presentation option to the magic 'default value',
+ // which will resolve to an actual value and result in screen invalidation.
+ cocoaApplication.presentationOptions = NSApplicationPresentationDefault;
updateScreens();
QMacInternalPasteboardMime::initializeMimeTypes();
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index dc6e419e13..908277a1e3 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -52,6 +52,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/QTextFormat>
#include <QtCore/QDebug>
+#include <QtCore/qsysinfo.h>
#include <private/qguiapplication_p.h>
#include "qcocoabackingstore.h"
#ifndef QT_NO_OPENGL
@@ -1351,8 +1352,29 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
#ifndef QT_NO_GESTURES
+
+- (bool)handleGestureAsBeginEnd:(NSEvent *)event
+{
+ if (QSysInfo::QSysInfo::MacintoshVersion < QSysInfo::MV_10_11)
+ return false;
+
+ if ([event phase] == NSEventPhaseBegan) {
+ [self beginGestureWithEvent:event];
+ return true;
+ }
+
+ if ([event phase] == NSEventPhaseEnded) {
+ [self endGestureWithEvent:event];
+ return true;
+ }
+
+ return false;
+}
- (void)magnifyWithEvent:(NSEvent *)event
{
+ if ([self handleGestureAsBeginEnd:event])
+ return;
+
qCDebug(lcQpaGestures) << "magnifyWithEvent" << [event magnification];
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
@@ -1379,7 +1401,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)rotateWithEvent:(NSEvent *)event
{
- qCDebug(lcQpaGestures) << "rotateWithEvent" << [event rotation];
+ if ([self handleGestureAsBeginEnd:event])
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;