diff --git a/src/gui/overlays/MiniEdit.cpp b/src/gui/overlays/MiniEdit.cpp index 9953d0b23e8..26a3642858f 100644 --- a/src/gui/overlays/MiniEdit.cpp +++ b/src/gui/overlays/MiniEdit.cpp @@ -29,6 +29,7 @@ MiniEdit::MiniEdit() typein->setJustification(juce::Justification::centred); typein->setFont(Surge::GUI::getFontManager()->getLatoAtSize(10, juce::Font::bold)); typein->setSelectAllWhenFocused(true); + typein->setWantsKeyboardFocus(true); typein->addListener(this); addAndMakeVisible(*typein); diff --git a/src/surge_synth_juce/SurgeSynthEditor.cpp b/src/surge_synth_juce/SurgeSynthEditor.cpp index 749e87b1a87..806d9728047 100644 --- a/src/surge_synth_juce/SurgeSynthEditor.cpp +++ b/src/surge_synth_juce/SurgeSynthEditor.cpp @@ -23,6 +23,9 @@ SurgeSynthEditor::SurgeSynthEditor(SurgeSynthProcessor &p) : AudioProcessorEdito { surgeLF = std::make_unique(); juce::LookAndFeel::setDefaultLookAndFeel(surgeLF.get()); + + addKeyListener(this); + adapter = std::make_unique(this, processor.surge.get()); int yExtra = 0; @@ -227,3 +230,23 @@ juce::PopupMenu SurgeSynthEditor::hostMenuForMacro(int macro) return juce::PopupMenu(); } + +bool SurgeSynthEditor::keyPressed(const juce::KeyPress &key, juce::Component *orig) +{ + if (adapter->getShowVirtualKeyboard() && orig != keyboard.get()) + { + return keyboard->keyPressed(key); + } + + return false; +} + +bool SurgeSynthEditor::keyStateChanged(bool isKeyDown, juce::Component *originatingComponent) +{ + if (adapter->getShowVirtualKeyboard() && originatingComponent != keyboard.get()) + { + return keyboard->keyStateChanged(isKeyDown); + } + + return false; +} \ No newline at end of file diff --git a/src/surge_synth_juce/SurgeSynthEditor.h b/src/surge_synth_juce/SurgeSynthEditor.h index 1f4e4fa0dc1..6f7127aeb5c 100644 --- a/src/surge_synth_juce/SurgeSynthEditor.h +++ b/src/surge_synth_juce/SurgeSynthEditor.h @@ -22,7 +22,8 @@ class SurgeJUCELookAndFeel; */ class SurgeSynthEditor : public juce::AudioProcessorEditor, public juce::AsyncUpdater, - public juce::FileDragAndDropTarget + public juce::FileDragAndDropTarget, + public juce::KeyListener { public: SurgeSynthEditor(SurgeSynthProcessor &); @@ -49,6 +50,9 @@ class SurgeSynthEditor : public juce::AudioProcessorEditor, void beginMacroEdit(long macroNum); void endMacroEdit(long macroNum); + bool keyPressed(const juce::KeyPress &key, juce::Component *originatingComponent) override; + bool keyStateChanged(bool isKeyDown, juce::Component *originatingComponent) override; + struct IdleTimer : juce::Timer { IdleTimer(SurgeSynthEditor *ed) : ed(ed) {}