mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
parent
759ed40d98
commit
c0fddd0a14
@ -112,23 +112,34 @@ void User_state::_handle_input_event(Input::Event ev)
|
||||
ev.handle_touch([&] (Input::Touch_id, float x, float y) {
|
||||
_pointer_pos = Point((int)x, (int)y); });
|
||||
|
||||
/* track key states, drop double press/release events */
|
||||
{
|
||||
bool drop = false;
|
||||
|
||||
ev.handle_press([&] (Keycode key, Codepoint) {
|
||||
if (_key_array.pressed(key)) {
|
||||
warning("suspicious double press of ", Input::key_name(key));
|
||||
drop = true;
|
||||
}
|
||||
_key_array.pressed(key, true);
|
||||
});
|
||||
|
||||
ev.handle_release([&] (Keycode key) {
|
||||
if (!_key_array.pressed(key)) {
|
||||
warning("suspicious double release of ", Input::key_name(key));
|
||||
drop = true;
|
||||
}
|
||||
_key_array.pressed(key, false);
|
||||
});
|
||||
|
||||
if (drop)
|
||||
return;
|
||||
}
|
||||
|
||||
/* count keys */
|
||||
if (ev.press()) _key_cnt++;
|
||||
if (ev.release() && (_key_cnt > 0)) _key_cnt--;
|
||||
|
||||
/* track key states */
|
||||
ev.handle_press([&] (Keycode key, Codepoint) {
|
||||
if (_key_array.pressed(key))
|
||||
Genode::warning("suspicious double press of ", Input::key_name(key));
|
||||
_key_array.pressed(key, true);
|
||||
});
|
||||
|
||||
ev.handle_release([&] (Keycode key) {
|
||||
if (!_key_array.pressed(key))
|
||||
Genode::warning("suspicious double release of ", Input::key_name(key));
|
||||
_key_array.pressed(key, false);
|
||||
});
|
||||
|
||||
if (ev.absolute_motion() || ev.relative_motion() || ev.touch()) {
|
||||
update_hover();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user