diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 3b805fefc0..fb740d628d 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -520,19 +520,23 @@ public: void redirectMouseMove (NSEvent* ev) { - #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 - if ([NSWindow windowNumberAtPoint: [[ev window] convertBaseToScreen: [ev locationInWindow]] - belowWindowWithWindowNumber: 0] != [window windowNumber]) + currentModifiers = currentModifiers.withoutMouseButtons(); + + #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + if ([NSWindow respondsToSelector: @selector (windowNumberAtPoint:belowWindowWithWindowNumber:)] + && [NSWindow windowNumberAtPoint: [[ev window] convertBaseToScreen: [ev locationInWindow]] + belowWindowWithWindowNumber: 0] != [window windowNumber]) { - [[NSCursor arrowCursor] set]; + // moved into another window which overlaps this one, so trigger an exit + handleMouseEvent (0, Point (-1, -1), currentModifiers, getMouseTime (ev)); } else #endif { - currentModifiers = currentModifiers.withoutMouseButtons(); sendMouseEvent (ev); - showArrowCursorIfNeeded(); } + + showArrowCursorIfNeeded(); } void redirectMouseEnter (NSEvent* ev) @@ -884,10 +888,11 @@ public: static void showArrowCursorIfNeeded() { - MouseInputSource& mouse = Desktop::getInstance().getMainMouseSource(); + Desktop& desktop = Desktop::getInstance(); + MouseInputSource& mouse = desktop.getMainMouseSource(); if (mouse.getComponentUnderMouse() == nullptr - && Desktop::getInstance().findComponentAt (mouse.getScreenPosition()) == nullptr) + && desktop.findComponentAt (mouse.getScreenPosition()) == nullptr) { [[NSCursor arrowCursor] set]; }