From 0d06d7cf0ca879da48d2f73bccdcaad8984d1dec Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sat, 28 Aug 2021 19:26:41 -0400 Subject: [PATCH] LastChance forwarding for Middle Button Closes #4708 --- src/gui/widgets/ModulatableSlider.cpp | 5 +++++ src/gui/widgets/WidgetBaseMixin.h | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/gui/widgets/ModulatableSlider.cpp b/src/gui/widgets/ModulatableSlider.cpp index 56703ed7db3..a432882a541 100644 --- a/src/gui/widgets/ModulatableSlider.cpp +++ b/src/gui/widgets/ModulatableSlider.cpp @@ -367,6 +367,11 @@ void ModulatableSlider::mouseDrag(const juce::MouseEvent &event) void ModulatableSlider::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + if (event.mods.isPopupMenu()) { editTypeWas = NOEDIT; diff --git a/src/gui/widgets/WidgetBaseMixin.h b/src/gui/widgets/WidgetBaseMixin.h index 923e9153ac1..bfc748e251c 100644 --- a/src/gui/widgets/WidgetBaseMixin.h +++ b/src/gui/widgets/WidgetBaseMixin.h @@ -22,6 +22,7 @@ #include "juce_gui_basics/juce_gui_basics.h" #include +#include "MainFrame.h" class SurgeGUIEditor; @@ -124,6 +125,18 @@ struct WidgetBaseMixin : public Surge::GUI::SkinConsumingComponent, } return nullptr; } + + bool forwardedMainFrameMouseDowns(const juce::MouseEvent &e) + { + if (e.mods.isMiddleButtonDown()) + { + auto sge = firstListenerOfType(); + if (sge && sge->frame) + sge->frame->mouseDown(e); + return true; + } + return false; + } }; } // namespace Widgets } // namespace Surge