summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaintegration.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-26 15:27:19 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-28 08:04:18 +0000
commite39a436d0ca00fbcbef1428e32f74266c7a8d34d (patch)
treeb970fea44e2bfd752bbbe98d4cc253cc9c5427e7 /src/plugins/platforms/cocoa/qcocoaintegration.h
parent73e68a9c0f8b6eb2873822efdae3dbb7c98a86d6 (diff)
macOS: Report correct available geometry for non-primary screens
The assumption that the primary screen is the only one whose available geometry differs from its full geometry no longer holds, so we need to compute the available geometry for all screens. Helpers methods for flipping between coordinates have been introduced in QCocoaScreen, to make flipping possible relative to a specific screen, and for exposing similar functionality in the future for QScreen. The corresponding functions in qcocoahelpers.mm should possibly be deprecated in favor of being explicit about which screen is doing the mapping. Change-Id: Iede658fabb4c3e4ef1f1b715db84fb927a661fa9 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 892ff6e00f..d0d88994d5 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -87,6 +87,15 @@ public:
NSScreen *nsScreen() const;
void updateGeometry();
+ QPointF mapToNative(const QPointF &pos) const { return flipCoordinate(pos); }
+ QRectF mapToNative(const QRectF &rect) const { return flipCoordinate(rect); }
+ QPointF mapFromNative(const QPointF &pos) const { return flipCoordinate(pos); }
+ QRectF mapFromNative(const QRectF &rect) const { return flipCoordinate(rect); }
+
+private:
+ QPointF flipCoordinate(const QPointF &pos) const;
+ QRectF flipCoordinate(const QRectF &rect) const;
+
public:
NSScreen *m_nsScreen;
QRect m_geometry;