diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-08-19 08:32:28 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-08-19 08:32:44 -0400 |
commit | 45cd3482a2bfce98b7a4fff79c148ef2d2dbd847 (patch) | |
tree | d04d3a9d0c1568d33452d447f33b018126fed319 /libs/gtkmm2ext | |
parent | 26f1578568f8b81c9c6e9abf5d0a1f4c478f6118 (diff) |
fix failure to remove keyvalue from Keyboard::state on key release
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/keyboard.cc | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc index fe7303b290..a68418b7bd 100644 --- a/libs/gtkmm2ext/keyboard.cc +++ b/libs/gtkmm2ext/keyboard.cc @@ -309,17 +309,44 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) } } - /* Special keys that we want to handle in - any dialog, no matter whether it uses - the regular set of accelerators or not - */ - - if (event->type == GDK_KEY_RELEASE && modifier_state_equals (event->state, PrimaryModifier)) { - switch (event->keyval) { - case GDK_w: - close_current_dialog (); - ret = true; - break; + if (event->type == GDK_KEY_RELEASE) { + + State::iterator k = find (state.begin(), state.end(), keyval); + + if (k != state.end()) { + /* this cannot change the ordering, so need to sort */ + state.erase (k); + if (state.empty()) { + DEBUG_TRACE (DEBUG::Keyboard, "no keys down\n"); + } else { +#ifndef NDEBUG + if (DEBUG_ENABLED(DEBUG::Keyboard)) { + DEBUG_STR_DECL(a); + DEBUG_STR_APPEND(a, "keyboard, keys still down: "); + for (State::iterator i = state.begin(); i != state.end(); ++i) { + DEBUG_STR_APPEND(a, gdk_keyval_name (*i)); + DEBUG_STR_APPEND(a, ','); + } + DEBUG_STR_APPEND(a, '\n'); + DEBUG_TRACE (DEBUG::Keyboard, DEBUG_STR(a).str()); + } + } +#endif /* NDEBUG */ + } + + if (modifier_state_equals (event->state, PrimaryModifier)) { + + /* Special keys that we want to handle in + any dialog, no matter whether it uses + the regular set of accelerators or not + */ + + switch (event->keyval) { + case GDK_w: + close_current_dialog (); + ret = true; + break; + } } } |