vkeybd: allow to disable keyboard input #8377

This commit is contained in:
Robin Gareus 2020-08-26 03:42:05 +02:00
parent ec6237d703
commit fb2d33c6a3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 8 additions and 1 deletions

View File

@ -35,6 +35,9 @@ void
PianoKeyBindings::set_layout (Layout layout) PianoKeyBindings::set_layout (Layout layout)
{ {
switch (layout) { switch (layout) {
case NO_KEYS:
clear_notes ();
break;
case QWERTY: case QWERTY:
bind_keys_qwerty (); bind_keys_qwerty ();
break; break;
@ -91,11 +94,13 @@ PianoKeyBindings::layout (std::string const& l)
return S_QWERTY; return S_QWERTY;
} else if (l == "QWERTZ Single") { } else if (l == "QWERTZ Single") {
return S_QWERTZ; return S_QWERTZ;
} else if (l == "None") {
return NO_KEYS;
} }
// Unrecognized keyboard layout, maybe an assert is too stringent though // Unrecognized keyboard layout, maybe an assert is too stringent though
assert(false); assert(false);
return QWERTY; return NO_KEYS;
} }
const char* const char*

View File

@ -36,6 +36,7 @@ public:
~PianoKeyBindings (); ~PianoKeyBindings ();
enum Layout { enum Layout {
NO_KEYS,
QWERTY, QWERTY,
QWERTZ, QWERTZ,
AZERTY, AZERTY,

View File

@ -3086,6 +3086,7 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_vkeybd_layout) sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_vkeybd_layout)
); );
vkeybdlayout->add ("None", _("Mouse-only (no keyboard)"));
vkeybdlayout->add ("QWERTY", _("QWERTY")); vkeybdlayout->add ("QWERTY", _("QWERTY"));
vkeybdlayout->add ("QWERTZ", _("QWERTZ")); vkeybdlayout->add ("QWERTZ", _("QWERTZ"));
vkeybdlayout->add ("AZERTY", _("AZERTY")); vkeybdlayout->add ("AZERTY", _("AZERTY"));