mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 08:23:50 -04:00
g13d: Simplify G13_Action_Keys::act
Migrate to C++11 iteration and clean up the mess of code that this was originally with a single call to send_event and a proper use of a ternary for logging.
This commit is contained in:
parent
bbb3104eaf
commit
65ab987a87
13
g13d/g13.cc
13
g13d/g13.cc
@ -405,16 +405,9 @@ G13_Action_Keys::G13_Action_Keys(G13_Device &keypad,
|
||||
G13_Action_Keys::~G13_Action_Keys() {}
|
||||
|
||||
void G13_Action_Keys::act(G13_Device &g13, bool is_down) {
|
||||
if (is_down) {
|
||||
for (int i = 0; i < _keys.size(); i++) {
|
||||
g13.send_event(EV_KEY, _keys[i], is_down);
|
||||
G13_LOG(trace, "sending KEY DOWN " << _keys[i]);
|
||||
}
|
||||
} else {
|
||||
for (int i = _keys.size() - 1; i >= 0; i--) {
|
||||
g13.send_event(EV_KEY, _keys[i], is_down);
|
||||
G13_LOG(trace, "sending KEY UP " << _keys[i]);
|
||||
}
|
||||
for (auto key : _keys) {
|
||||
g13.send_event(EV_KEY, key, is_down);
|
||||
G13_LOG(trace, "sending KEY " << (is_down ? "DOWN " : "UP ") << key);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user