1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

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

This commit is contained in:
jules 2012-12-27 16:36:51 +00:00
parent 70964f3f87
commit 784c1f5dae

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];
}