From 407c2bed63b8cfc7147128729cc5552b11c3e404 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 5 Dec 2019 22:12:49 +0100 Subject: [PATCH] VKeybd: grab and ignore some keys With default QWERTY and QWERTZ layout some keys that are easily accidentally pressed. Those triggered editor actions, (e.g. "a" (audition), or "1" (edit-tool)) and are now ignored. --- gtk2_ardour/pianokeyboard.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/pianokeyboard.cc b/gtk2_ardour/pianokeyboard.cc index 9c56ae8a0e..baf31c3005 100644 --- a/gtk2_ardour/pianokeyboard.cc +++ b/gtk2_ardour/pianokeyboard.cc @@ -356,6 +356,13 @@ APianoKeyboard::bind_keys_qwerty () bind_key ("o", 38); bind_key ("0", 39); bind_key ("p", 40); + + /* ignore */ + bind_key ("a", -2); + bind_key ("f", -3); + bind_key ("1", -4); + bind_key ("4", -5); + bind_key ("8", -6); } void @@ -547,7 +554,10 @@ APianoKeyboard::on_key_press_event (GdkEventKey* event) char* key = get_keycode (event); int note = key_binding (key); - if (note < 0) { + if (note < -1) { + return true; + } + else if (note < 0) { return false; } @@ -592,6 +602,9 @@ APianoKeyboard::on_key_release_event (GdkEventKey* event) sustain_release (); return true; } + if (note < -1) { + return true; + } std::map::const_iterator kv = _note_stack.find (key); if (kv == _note_stack.end ()) {