From d0b6d6c025da1df6f169fcba3a9a1e2d72b8f763 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 20 Jan 2017 16:16:43 +0000 Subject: [PATCH] Check all mouse sources when exiting modal loop --- modules/juce_gui_basics/components/juce_Component.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index c0b9afd8fd..f207733f71 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -1756,11 +1756,13 @@ void Component::exitModalState (const int returnValue) mcm.endModal (this, returnValue); mcm.bringModalComponentsToFront(); - // If the mouse is over another Component when we exit the modal state then send a mouse enter event - if (MouseInputSource* mouse = Desktop::getInstance().getMouseSource (0)) + // If any of the mouse sources are over another Component when we exit the modal state then send a mouse enter event + const Array& mouseSources = Desktop::getInstance().getMouseSources(); + + for (MouseInputSource* mi = mouseSources.begin(), * const e = mouseSources.end(); mi != e; ++mi) { - if (Component* c = mouse->getComponentUnderMouse()) - c->internalMouseEnter (*mouse, mouse->getScreenPosition(), Time::getCurrentTime()); + if (Component* c = mi->getComponentUnderMouse()) + c->internalMouseEnter (*mi, mi->getScreenPosition(), Time::getCurrentTime()); } } else