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:
June Tate-Gans 2021-04-25 14:32:24 -05:00
parent bbb3104eaf
commit 65ab987a87

View File

@ -405,16 +405,9 @@ G13_Action_Keys::G13_Action_Keys(G13_Device &keypad,
G13_Action_Keys::~G13_Action_Keys() {} G13_Action_Keys::~G13_Action_Keys() {}
void G13_Action_Keys::act(G13_Device &g13, bool is_down) { void G13_Action_Keys::act(G13_Device &g13, bool is_down) {
if (is_down) { for (auto key : _keys) {
for (int i = 0; i < _keys.size(); i++) { g13.send_event(EV_KEY, key, is_down);
g13.send_event(EV_KEY, _keys[i], is_down); G13_LOG(trace, "sending KEY " << (is_down ? "DOWN " : "UP ") << key);
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]);
}
} }
} }