13
0

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.
This commit is contained in:
Robin Gareus 2019-12-05 22:12:49 +01:00
parent 9eac4936dc
commit 407c2bed63
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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<std::string, int>::const_iterator kv = _note_stack.find (key);
if (kv == _note_stack.end ()) {