summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm16
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm12
2 files changed, 22 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 17f5f4888d..8becfb1cc2 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1314,12 +1314,18 @@ void QCocoaWindow::setWindowCursor(NSCursor *cursor)
// it should be accociated with the window until a different
// cursor is set.
- // Cocoa has different abstractions. We can set the cursor *now*:
- if (m_windowUnderMouse)
- [cursor set];
- // or we can set the cursor on mouse enter/leave using tracking
- // areas. This is done in QNSView, save the cursor:
m_windowCursor = cursor;
+
+ // Use the built in cursor rect API if the QCocoaWindow has a NSWindow.
+ // Othervise, set the cursor if this window is under the mouse. In
+ // this case QNSView::cursorUpdate will set the cursor as the pointer
+ // moves.
+ if (m_nsWindow && m_qtView) {
+ [m_nsWindow invalidateCursorRectsForView : m_qtView];
+ } else {
+ if (m_windowUnderMouse)
+ [cursor set];
+ }
}
void QCocoaWindow::registerTouch(bool enable)
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 7cd74c6725..b272b4920b 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -706,8 +706,18 @@ static QTouchDevice *touchDevice = 0;
-(void)cursorUpdate:(NSEvent *)theEvent
{
Q_UNUSED(theEvent)
- if (m_platformWindow->m_windowCursor)
+ // Set the cursor manually if there is no NSWindow.
+ if (!m_platformWindow->m_nsWindow && m_platformWindow->m_windowCursor)
[m_platformWindow->m_windowCursor set];
+ else
+ [super cursorUpdate:theEvent];
+}
+
+-(void)resetCursorRects
+{
+ // Use the cursor rect API if there is a NSWindow
+ if (m_platformWindow->m_nsWindow && m_platformWindow->m_windowCursor)
+ [self addCursorRect:[self visibleRect] cursor:m_platformWindow->m_windowCursor];
}
- (void)mouseMoved:(NSEvent *)theEvent