The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Fix key binding

These changes was commited to the Birdfont repository Sat, 02 May 2015 20:54:11 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sat, 02 May 2015 20:54:11 +0000]

Updated Files

libbirdfont/SettingsDisplay.vala
--- a/libbirdfont/SettingsDisplay.vala +++ b/libbirdfont/SettingsDisplay.vala @@ -102,28 +102,30 @@ public override void key_release (uint keyval) { SettingsItem old_key_binding; - if (update_key_bindings) { - if (keyval == Key.BACK_SPACE) { - update_key_bindings = false; - new_key_bindings.active = false; - new_key_bindings.menu_item.modifiers = NONE; - new_key_bindings.menu_item.key = '\0'; - } else if (KeyBindings.get_mod_from_key (keyval) == NONE) { - - if (has_key_binding (KeyBindings.modifier, (unichar) keyval)) { - old_key_binding = (!) get_key_binding (KeyBindings.modifier, (unichar) keyval); - old_key_binding.menu_item.modifiers = NONE; - old_key_binding.menu_item.key = '\0'; + if (!KeyBindings.is_modifier_key (keyval)) { + if (update_key_bindings) { + if (keyval == Key.BACK_SPACE) { + update_key_bindings = false; + new_key_bindings.active = false; + new_key_bindings.menu_item.modifiers = NONE; + new_key_bindings.menu_item.key = '\0'; + } else if (KeyBindings.get_mod_from_key (keyval) == NONE) { + + if (has_key_binding (KeyBindings.modifier, (unichar) keyval)) { + old_key_binding = (!) get_key_binding (KeyBindings.modifier, (unichar) keyval); + old_key_binding.menu_item.modifiers = NONE; + old_key_binding.menu_item.key = '\0'; + } + + new_key_bindings.menu_item.modifiers = KeyBindings.modifier; + new_key_bindings.menu_item.key = (unichar) keyval; + update_key_bindings = false; + new_key_bindings.active = false; } - new_key_bindings.menu_item.modifiers = KeyBindings.modifier; - new_key_bindings.menu_item.key = (unichar) keyval; - update_key_bindings = false; - new_key_bindings.active = false; + MainWindow.get_menu ().write_key_bindings (); + GlyphCanvas.redraw (); } - - MainWindow.get_menu ().write_key_bindings (); - GlyphCanvas.redraw (); } }