From 7373bfd3befd066b7e801e03de934e0809d039d2 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 19 Jul 2012 14:07:47 +0100 Subject: [PATCH] OSX: prevent mouse-moves when behind an inactive window. --- .../native/juce_mac_NSViewComponentPeer.mm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index a5826f034e..eba34376e0 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -502,9 +502,17 @@ public: void redirectMouseMove (NSEvent* ev) { - currentModifiers = currentModifiers.withoutMouseButtons(); - sendMouseEvent (ev); - showArrowCursorIfNeeded(); + if ([NSWindow windowNumberAtPoint: [[ev window] convertBaseToScreen: [ev locationInWindow]] + belowWindowWithWindowNumber: 0] == [window windowNumber]) + { + currentModifiers = currentModifiers.withoutMouseButtons(); + sendMouseEvent (ev); + showArrowCursorIfNeeded(); + } + else + { + [[NSCursor arrowCursor] set]; + } } void redirectMouseEnter (NSEvent* ev)