summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/bindings.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-03-05 11:54:02 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-03-05 11:54:02 -0500
commit73333350cc0b237890bba626fa08e4ad924acfab (patch)
tree3e4fca6a5560d59a39633eca934096a1a5bd6e2e /libs/gtkmm2ext/bindings.cc
parent6aa7ca6d70a7c0d73dc6dd5da783834d57166224 (diff)
don't downcase Home, End and other non-single-key keycode names
Diffstat (limited to 'libs/gtkmm2ext/bindings.cc')
-rw-r--r--libs/gtkmm2ext/bindings.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/libs/gtkmm2ext/bindings.cc b/libs/gtkmm2ext/bindings.cc
index 802e32dd1a..637cd633a0 100644
--- a/libs/gtkmm2ext/bindings.cc
+++ b/libs/gtkmm2ext/bindings.cc
@@ -258,25 +258,29 @@ KeyboardKey::make_key (const string& str, KeyboardKey& k)
s |= Keyboard::Level4Modifier;
}
- string::size_type lastmod = str.find_last_of ('-');
- guint keyval;
-
- /* since all key events keycodes are changed to lower case before
- * looking them up, make sure we only store lower case here. The Shift
- * part will be stored in the modifier part of the KeyboardKey.
+ /* since all SINGLE key events keycodes are changed to lower case
+ * before looking them up, make sure we only store lower case here. The
+ * Shift part will be stored in the modifier part of the KeyboardKey.
*
* And yes Mildred, this doesn't cover CapsLock cases. Oh well.
*/
- string lower;
+ string actual;
- if (lastmod == string::npos) {
- lower = PBD::downcase (str);
+ if (str.size() == 1) {
+ actual = PBD::downcase (str);
} else {
- lower = PBD::downcase (str.substr (lastmod+1));
+ actual = str;
}
- keyval = gdk_keyval_from_name (lower.c_str());
+ string::size_type lastmod = actual.find_last_of ('-');
+ guint keyval;
+
+ if (lastmod != string::npos) {
+ actual = PBD::downcase (str.substr (lastmod+1));
+ }
+
+ keyval = gdk_keyval_from_name (actual.c_str());
if (keyval == GDK_VoidSymbol || keyval == 0) {
return false;
@@ -394,7 +398,6 @@ Bindings::activate (KeyboardKey kb, Operation op)
{
KeybindingMap& kbm = get_keymap (op);
-
/* if shift was pressed, GDK will send us (e.g) 'E' rather than 'e'.
Our bindings all use the lower case character/keyname, so switch
to the lower case before doing the lookup.
@@ -815,7 +818,7 @@ Bindings::is_registered (Operation op, std::string const& action_name) const
return std::find_if(km.begin(), km.end(), ActionNameRegistered<KeybindingMap::const_iterator::value_type>(action_name)) != km.end();
}
-Bindings::KeybindingMap&
+Bindings::KeybindingMap&
Bindings::get_keymap (Operation op)
{
switch (op) {
@@ -827,7 +830,7 @@ Bindings::get_keymap (Operation op)
}
}
-const Bindings::KeybindingMap&
+const Bindings::KeybindingMap&
Bindings::get_keymap (Operation op) const
{
switch (op) {
@@ -839,7 +842,7 @@ Bindings::get_keymap (Operation op) const
}
}
-Bindings::MouseButtonBindingMap&
+Bindings::MouseButtonBindingMap&
Bindings::get_mousemap (Operation op)
{
switch (op) {