diff options
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 6e7fc5cdbb..dcf65e9fa8 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1727,6 +1727,20 @@ void QCocoaWindow::setWindowCursor(NSCursor *cursor) view.cursor = cursor; [m_view.window invalidateCursorRectsForView:m_view]; + + // There's a bug in AppKit where calling invalidateCursorRectsForView when + // there's an override cursor active (for example when hovering over the + // window frame), will not result in a cursorUpdate: callback. To work around + // this we synthesize a cursor update event and call the callback ourselves, + // if we detect that the mouse is currently over the view. + auto locationInWindow = m_view.window.mouseLocationOutsideOfEventStream; + auto locationInSuperview = [m_view.superview convertPoint:locationInWindow fromView:nil]; + if ([m_view hitTest:locationInSuperview] == m_view) { + [m_view cursorUpdate:[NSEvent enterExitEventWithType:NSEventTypeCursorUpdate + location:locationInWindow modifierFlags:0 timestamp:0 + windowNumber:m_view.window.windowNumber context:nil + eventNumber:0 trackingNumber:0 userData:0]]; + } } void QCocoaWindow::registerTouch(bool enable) |