summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-12-02 17:40:58 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2015-12-02 17:40:58 -0500
commit90275ded6a56cc39bd3ffbed292e7bfa7ff7345e (patch)
tree2050f97a8a1eb344df0ead7618de736b3009ae9e /libs
parenteb1d1acab86fd23fa53bc87dd3b6e477f8318f6c (diff)
faderport: a clever hack to make the Shift modifier "sticky"
The user can now press+release Shift, then another key OR press Shift, then another key before releasing Shift. Both event sequences will have the same result
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/faderport/faderport.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc
index 883b520c3a..be9186501e 100644
--- a/libs/surfaces/faderport/faderport.cc
+++ b/libs/surfaces/faderport/faderport.cc
@@ -313,7 +313,10 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb)
switch (id) {
case Shift:
- bs = ShiftDown;
+ /* set this bit on press, do NOT clear it on release */
+ if (tb->value) {
+ bs = ShiftDown;
+ }
break;
case Stop:
bs = StopDown;
@@ -347,6 +350,7 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb)
if (bs) {
button_state = (tb->value ? ButtonState (button_state|bs) : ButtonState (button_state&~bs));
+ DEBUG_TRACE (DEBUG::FaderPort, string_compose ("reset button state to %1%2 using %3%4\n", hex, button_state, bs, dec));
}
if (button.uses_flash()) {
@@ -354,6 +358,12 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb)
}
button.invoke (button_state, tb->value ? true : false);
+
+ if (!tb->value && (id != Shift)) {
+ /* non-shift key was released, clear shift modifier */
+ button_state = ButtonState (button_state&~ShiftDown);
+ DEBUG_TRACE (DEBUG::FaderPort, "clear shift modifier\n");
+ }
}
void