diff --git a/src/surge-xt/gui/SurgeGUICallbackInterfaces.h b/src/surge-xt/gui/SurgeGUICallbackInterfaces.h index 8f7f1c2aa3c..bb209dfe5db 100644 --- a/src/surge-xt/gui/SurgeGUICallbackInterfaces.h +++ b/src/surge-xt/gui/SurgeGUICallbackInterfaces.h @@ -28,25 +28,12 @@ struct IComponentTagValue virtual float getValue() const = 0; virtual void setValue(float) = 0; - int hoverCount{0}; - virtual int incrementHover() - { - hoverCount++; - return hoverCount; - } - virtual int decrementHover() - { - hoverCount--; - return hoverCount; - } - virtual void forceEndHover() - { - hoverCount = 1; - endHover(); - } + bool stuckHover{false}; + virtual void stuckHoverOn() { stuckHover = true; } + virtual void stuckHoverOff() { stuckHover = false; } - virtual void startHover(const juce::Point &) { incrementHover(); } - virtual void endHover() { decrementHover(); } + virtual void startHover(const juce::Point &) {} + virtual void endHover() {} juce::Component *asJuceComponent() { diff --git a/src/surge-xt/gui/SurgeJUCEHelpers.h b/src/surge-xt/gui/SurgeJUCEHelpers.h index bbc51d8207b..d176bce5899 100644 --- a/src/surge-xt/gui/SurgeJUCEHelpers.h +++ b/src/surge-xt/gui/SurgeJUCEHelpers.h @@ -49,7 +49,7 @@ inline std::function makeEndHoverCallback(Surge::GUI::IComponentTagVa if (!that) return [](int) {}; - that->incrementHover(); + that->stuckHoverOn(); return [safethat = juce::Component::SafePointer(that->asJuceComponent())](int x) { @@ -57,7 +57,10 @@ inline std::function makeEndHoverCallback(Surge::GUI::IComponentTagVa { auto igtv = dynamic_cast(safethat.getComponent()); if (igtv) - igtv->forceEndHover(); + { + igtv->stuckHoverOff(); + igtv->endHover(); + } } }; } diff --git a/src/surge-xt/gui/widgets/ModulatableSlider.cpp b/src/surge-xt/gui/widgets/ModulatableSlider.cpp index a5f26378d12..22aacf06773 100644 --- a/src/surge-xt/gui/widgets/ModulatableSlider.cpp +++ b/src/surge-xt/gui/widgets/ModulatableSlider.cpp @@ -378,9 +378,6 @@ void ModulatableSlider::onSkinChanged() void ModulatableSlider::mouseEnter(const juce::MouseEvent &event) { startHover(event.position); } void ModulatableSlider::startHover(const juce::Point &p) { - if (incrementHover() > 1) - return; - enqueueFutureInfowindow(SurgeGUIEditor::InfoQAction::START, p); isHovered = true; auto sge = firstListenerOfType(); @@ -394,7 +391,7 @@ void ModulatableSlider::mouseExit(const juce::MouseEvent &event) { endHover(); } void ModulatableSlider::endHover() { - if (decrementHover() != 0) + if (stuckHover) return; enqueueFutureInfowindow(SurgeGUIEditor::InfoQAction::LEAVE); diff --git a/src/surge-xt/gui/widgets/ModulationSourceButton.cpp b/src/surge-xt/gui/widgets/ModulationSourceButton.cpp index 320560b2628..bba3f79b267 100644 --- a/src/surge-xt/gui/widgets/ModulationSourceButton.cpp +++ b/src/surge-xt/gui/widgets/ModulationSourceButton.cpp @@ -470,6 +470,9 @@ void ModulationSourceButton::startHover(const juce::Point &f) void ModulationSourceButton::endHover() { + if (stuckHover) + return; + bool oh = isHovered; isHovered = false; diff --git a/src/surge-xt/gui/widgets/MultiSwitch.cpp b/src/surge-xt/gui/widgets/MultiSwitch.cpp index e230dfe1645..bdde86fb76e 100644 --- a/src/surge-xt/gui/widgets/MultiSwitch.cpp +++ b/src/surge-xt/gui/widgets/MultiSwitch.cpp @@ -246,9 +246,6 @@ void MultiSwitch::mouseEnter(const juce::MouseEvent &event) { startHover(event.p void MultiSwitch::startHover(const juce::Point &p) { - if (incrementHover() > 1) - return; - if (everDragged && isMouseDown) // don't change hover state during a drag { hoverSelection = getIntegerValue(); @@ -264,7 +261,7 @@ void MultiSwitch::mouseExit(const juce::MouseEvent &event) { endHover(); } void MultiSwitch::endHover() { - if (decrementHover() != 0) + if (stuckHover) return; isHovered = false; diff --git a/src/surge-xt/gui/widgets/Switch.h b/src/surge-xt/gui/widgets/Switch.h index d1ab5255600..3801f96fed9 100644 --- a/src/surge-xt/gui/widgets/Switch.h +++ b/src/surge-xt/gui/widgets/Switch.h @@ -72,6 +72,9 @@ struct Switch : public juce::Component, public WidgetBaseMixin, public L void mouseExit(const juce::MouseEvent &event) override; void endHover() override { + if (stuckHover) + return; + isHovered = false; repaint(); }