From a63f1808fc468a4839e74761d25e60458feb070a Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 24 Oct 2017 15:57:16 +0100 Subject: [PATCH] Fixed a bug where a Slider popup display added to a parent component would never be dismissed --- .../juce_gui_basics/widgets/juce_Slider.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_Slider.cpp b/modules/juce_gui_basics/widgets/juce_Slider.cpp index 36ffd10da4..7a78630901 100644 --- a/modules/juce_gui_basics/widgets/juce_Slider.cpp +++ b/modules/juce_gui_basics/widgets/juce_Slider.cpp @@ -841,7 +841,9 @@ public: if (showPopupOnDrag || showPopupOnHover) { showPopupDisplay(); - popupDisplay->stopTimer(); + + if (popupDisplay != nullptr) + popupDisplay->stopTimer(); } currentDrag = new DragInProgress (*this); @@ -951,7 +953,12 @@ public: auto isTwoValue = (style == TwoValueHorizontal || style == TwoValueVertical); auto isThreeValue = (style == ThreeValueHorizontal || style == ThreeValueVertical); - if (showPopupOnHover + // this is a workaround for a bug where the popup display being dismissed triggers + // a mouse move causing it to never be hidden + auto shouldShowPopup = showPopupOnHover + && (Time::getMillisecondCounterHiRes() - lastPopupDismissal) > 250; + + if (shouldShowPopup && ! isTwoValue && ! isThreeValue) { @@ -1254,6 +1261,7 @@ public: bool snapsToMousePos = true; int popupHoverTimeout = 2000; + double lastPopupDismissal = 0.0; ScopedPointer