diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-02-18 14:32:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-26 12:58:00 +0100 |
commit | 9d2d4ad4833ac815eda9c99eb97d421234a0c4cd (patch) | |
tree | dee975784115d0b09feccb3faea555c0b679b290 /src/plugins/platforms/cocoa/qcocoahelpers.h | |
parent | 66e5f8e9dcd11d136b707d13c7597019c99c54b8 (diff) |
Cocoa: Fix popup window positioning.
Popup window positions where offset on retina MacBooks
with an connected external monitor.
Fix this by cleaning up the coordinate conversion
functions:
Remove the qt_mac_flipRect overload which tries
to position the window according screen size. This
functionality does not belong inside a coordinate/
type conversion function. Also, it was using the windows's
screen instead of the main screen which is incorrect.
"Y flipping": Use the height of the first screen in
[NSScreen screens], which is documented to always
be the screen that contains the coordinate system
origin. Remove the usages of QApplication::primaryScreen()
("Don't use Qt to implement Qt").
Task-number: QTBUG-36672
Change-Id: I2354d31361f5a4c2c80035cf4c7def939218406f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.h | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 893aa4408a..3b72184d83 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -103,23 +103,13 @@ CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget); CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice); QString qt_mac_applicationName(); -inline int qt_mac_flipYCoordinate(int y) -{ return QGuiApplication::primaryScreen()->geometry().height() - y; } - -inline qreal qt_mac_flipYCoordinate(qreal y) -{ return QGuiApplication::primaryScreen()->geometry().height() - y; } - -inline QPointF qt_mac_flipPoint(const NSPoint &p) -{ return QPointF(p.x, qt_mac_flipYCoordinate(p.y)); } - -inline NSPoint qt_mac_flipPoint(const QPoint &p) -{ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); } - -inline NSPoint qt_mac_flipPoint(const QPointF &p) -{ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); } +int qt_mac_flipYCoordinate(int y); +qreal qt_mac_flipYCoordinate(qreal y); +QPointF qt_mac_flipPoint(const NSPoint &p); +NSPoint qt_mac_flipPoint(const QPoint &p); +NSPoint qt_mac_flipPoint(const QPointF &p); NSRect qt_mac_flipRect(const QRect &rect); -NSRect qt_mac_flipRect(const QRect &rect, QWindow *window); Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); |