Browse Source

Fix for mouse-over in overlapping windows with older SDKs.

tags/2021-05-28
jules 13 years ago
parent
commit
784c1f5dae
1 changed files with 13 additions and 8 deletions
  1. +13
    -8
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 13
- 8
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -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<int> (-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];
}


Loading…
Cancel
Save