From ce14b667630fe84b4554ea0c44a5684037a423fa Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 20 Jan 2017 14:01:11 +0000 Subject: [PATCH] Fixed a bug where a mouse enter event wouldn't be sent to the Component under the mouse when exiting a modal loop and where mouse exit events were being sent when a modal loop was active --- .../juce_gui_basics/components/juce_Component.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index f544e77533..c0b9afd8fd 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -1755,6 +1755,13 @@ void Component::exitModalState (const int returnValue) ModalComponentManager& mcm = *ModalComponentManager::getInstance(); 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 (Component* c = mouse->getComponentUnderMouse()) + c->internalMouseEnter (*mouse, mouse->getScreenPosition(), Time::getCurrentTime()); + } } else { @@ -2406,6 +2413,13 @@ void Component::internalMouseEnter (MouseInputSource source, Point relati void Component::internalMouseExit (MouseInputSource source, Point relativePos, Time time) { + if (isCurrentlyBlockedByAnotherModalComponent()) + { + // if something else is modal, always just show a normal mouse cursor + source.showMouseCursor (MouseCursor::NormalCursor); + return; + } + if (flags.repaintOnMouseActivityFlag) repaint();