diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index e86cc2d955..c000c90a85 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -287,7 +287,7 @@ QRect QCocoaWindow::geometry() const NSPoint windowPoint = [m_view convertPoint:NSMakePoint(0, 0) toView:nil]; NSRect screenRect = [[m_view window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)]; NSPoint screenPoint = screenRect.origin; - QPoint position = qt_mac_flipPoint(screenPoint).toPoint(); + QPoint position = QCocoaScreen::mapFromNative(screenPoint).toPoint(); QSize size = QRectF::fromCGRect(NSRectToCGRect([m_view bounds])).toRect().size(); return QRect(position, size); } @@ -310,7 +310,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) } if (isContentView()) { - NSRect bounds = qt_mac_flipRect(rect); + NSRect bounds = QCocoaScreen::mapToNative(rect); [m_view.window setFrame:[m_view.window frameRectForContentRect:bounds] display:YES animate:NO]; } else { [m_view setFrame:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; @@ -403,7 +403,7 @@ void QCocoaWindow::setVisible(bool visible) if (!(parentCocoaWindow && window()->transientParent()->isActive()) && window()->type() == Qt::Popup) { removeMonitor(); monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) { - QPointF localPoint = qt_mac_flipPoint([NSEvent mouseLocation]); + QPointF localPoint = QCocoaScreen::mapFromNative([NSEvent mouseLocation]); QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint, cocoaButton2QtButton([e buttonNumber])); }]; @@ -1116,7 +1116,7 @@ void QCocoaWindow::handleGeometryChange() CGRect contentRect = [m_view.window contentRectForFrameRect:m_view.window.frame]; // The result above is in native screen coordinates, so remap to the Qt coordinate system - newGeometry = QCocoaScreen::primaryScreen()->mapFromNative(QRectF::fromCGRect(contentRect)).toRect(); + newGeometry = QCocoaScreen::mapFromNative(contentRect).toRect(); } else { // QNSView has isFlipped set, so no need to remap the geometry newGeometry = QRectF::fromCGRect(m_view.frame).toRect(); @@ -1378,7 +1378,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) rect.translate(-targetScreen->geometry().topLeft()); QCocoaScreen *cocoaScreen = static_cast<QCocoaScreen *>(targetScreen->handle()); - NSRect frame = NSRectFromCGRect(cocoaScreen->mapToNative(rect).toCGRect()); + NSRect frame = QCocoaScreen::mapToNative(rect, cocoaScreen); // Note: The macOS window manager has a bug, where if a screen is rotated, it will not allow // a window to be created within the area of the screen that has a Y coordinate (I quadrant) @@ -1474,19 +1474,6 @@ void QCocoaWindow::removeMonitor() monitor = nil; } -// Returns the current global screen geometry for the nswindow associated with this window. -QRect QCocoaWindow::nativeWindowGeometry() const -{ - if (!isContentView()) - return geometry(); - - NSRect rect = m_view.window.frame; - QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window()); - int flippedY = onScreen->geometry().height() - rect.origin.y - rect.size.height; // account for nswindow inverted y. - QRect qRect = QRect(rect.origin.x, flippedY, rect.size.width, rect.size.height); - return qRect; -} - /*! Applies the given state to the NSWindow, going in/out of minimize/zoomed/fullscreen |