summaryrefslogtreecommitdiff
path: root/gtk2_ardour/keyeditor.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-12-18 11:14:41 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-12-18 11:14:41 -0500
commit4453803c0c4bce4e4bfe5549f8e93453fa864506 (patch)
treea69bd552a7e0eade5fba6a667f06447633e28d8d /gtk2_ardour/keyeditor.cc
parent0d771999ac9c1de2987b3d549ecc060e818bd69c (diff)
This fixes a bug where an impossible keybinding assignment is possible.
It also makes it behave similar to the gtk keybinder. See Bug 5888 for more details. From pull request #82 @ github, from Domohawk
Diffstat (limited to 'gtk2_ardour/keyeditor.cc')
-rw-r--r--gtk2_ardour/keyeditor.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc
index d39abf5057..e24eae5e97 100644
--- a/gtk2_ardour/keyeditor.cc
+++ b/gtk2_ardour/keyeditor.cc
@@ -55,8 +55,7 @@ KeyEditor::KeyEditor ()
, unbind_box (BUTTONBOX_END)
{
- can_bind = false;
- last_state = 0;
+ last_keyval = 0;
model = TreeStore::create(columns);
@@ -182,15 +181,16 @@ KeyEditor::action_selected ()
bool
KeyEditor::on_key_press_event (GdkEventKey* ev)
{
- can_bind = true;
- last_state = ev->state;
+ if (!ev->is_modifier) {
+ last_keyval = ev->keyval;
+ }
return false;
}
bool
KeyEditor::on_key_release_event (GdkEventKey* ev)
{
- if (ARDOUR::Profile->get_sae() || !can_bind || ev->state != last_state) {
+ if (ARDOUR::Profile->get_sae() || last_keyval == 0) {
return false;
}
@@ -203,22 +203,22 @@ KeyEditor::on_key_release_event (GdkEventKey* ev)
goto out;
}
- Gtkmm2ext::possibly_translate_keyval_to_make_legal_accelerator (ev->keyval);
-
+ Gtkmm2ext::possibly_translate_keyval_to_make_legal_accelerator (ev->keyval);
bool result = AccelMap::change_entry (path,
- ev->keyval,
+ last_keyval,
ModifierType (Keyboard::RelevantModifierKeyMask & ev->state),
true);
if (result) {
AccelKey key;
(*i)[columns.binding] = ActionManager::get_key_representation (path, key);
+ unbind_button.set_sensitive (true);
}
}
out:
- can_bind = false;
+ last_keyval = 0;
return true;
}