From 5f8a897333e315f5f0cbb4e0605c216c24417c8e Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Mon, 11 Oct 2021 20:00:04 -0400 Subject: [PATCH] ESC closes overlays in zorder if non torn out Closes #5221 --- src/surge-xt/gui/SurgeGUIEditor.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/surge-xt/gui/SurgeGUIEditor.cpp b/src/surge-xt/gui/SurgeGUIEditor.cpp index dc38c569f3f..feabb5dfb00 100644 --- a/src/surge-xt/gui/SurgeGUIEditor.cpp +++ b/src/surge-xt/gui/SurgeGUIEditor.cpp @@ -5525,6 +5525,25 @@ bool SurgeGUIEditor::keyPressed(const juce::KeyPress &key, juce::Component *orig return true; } + if (key.getKeyCode() == juce::KeyPress::escapeKey) + { + Surge::Overlays::OverlayWrapper *topOverlay{nullptr}; + + for (auto c : frame->getChildren()) + { + auto q = dynamic_cast(c); + if (q) + { + topOverlay = q; + } + } + if (topOverlay) + { + topOverlay->onClose(); + return true; + } + } + if (getUseKeyboardShortcuts()) { // zoom actions