Compile on 10.6
authorMorten Sorvig <morten.sorvig@nokia.com>
Tue, 4 Oct 2011 12:36:26 +0000 (14:36 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 6 Oct 2011 09:24:20 +0000 (11:24 +0200)
Change-Id: Ifce1ab6ced179f68a3d08162940e9092b90beb11
Reviewed-on: http://codereview.qt-project.org/6124
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/plugins/platforms/cocoa/qnsview.mm

index 243cdb8..67bc61c 100644 (file)
     NSPoint nsViewPoint = [self convertPoint: nsWindowPoint fromView: nil]; // NSView/QWindow coordinates
     QPoint qtWindowPoint(nsViewPoint.x, nsViewPoint.y);                     // NSView/QWindow coordinates
 
-    NSRect screenRect = [[self window] convertRectToScreen : NSMakeRect(nsWindowPoint.x, nsWindowPoint.y, 0, 0)];  // OS X screen coordinates
-    QPoint qtScreenPoint(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y));                        // Qt screen coordinates
+    QPoint qtScreenPoint;
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6
+    NSRect screenRect = [[self window] convertRectToScreen : NSMakeRect(nsWindowPoint.x, nsWindowPoint.y, 0, 0)]; // OS X screen coordinates
+    qtScreenPoint = QPoint(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y));                     // Qt screen coordinates
+#else
+    NSPoint screenPoint = [[self window] convertBaseToScreen : NSMakePoint(nsWindowPoint.x, nsWindowPoint.y)];
+    qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
+#endif
 
     ulong timestamp = [theEvent timestamp] * 1000;