nitpicker: update hover state on touch events

The hover state is evaluated for the routing of input events. When
routing a touch event, the decision should be based on the most recently
observed touch position. Without this patch, however, the hover state kept
referring to the initial pointer position (screen center) in the absence
of any other motion events.

Issue #4514
This commit is contained in:
Norman Feske 2022-05-20 13:28:37 +02:00 committed by Christian Helmuth
parent c4f2ceb1ca
commit 1f3b6490f2

View File

@ -108,6 +108,10 @@ void User_state::_handle_input_event(Input::Event ev)
ev.handle_absolute_motion([&] (int x, int y) { ev.handle_absolute_motion([&] (int x, int y) {
_pointer_pos = Point(x, y); }); _pointer_pos = Point(x, y); });
/* let pointer position correspond to most recent touch position */
ev.handle_touch([&] (Input::Touch_id, float x, float y) {
_pointer_pos = Point((int)x, (int)y); });
/* count keys */ /* count keys */
if (ev.press()) _key_cnt++; if (ev.press()) _key_cnt++;
if (ev.release() && (_key_cnt > 0)) _key_cnt--; if (ev.release() && (_key_cnt > 0)) _key_cnt--;
@ -125,7 +129,7 @@ void User_state::_handle_input_event(Input::Event ev)
_key_array.pressed(key, false); _key_array.pressed(key, false);
}); });
if (ev.absolute_motion() || ev.relative_motion()) { if (ev.absolute_motion() || ev.relative_motion() || ev.touch()) {
update_hover(); update_hover();
if (_key_cnt > 0) { if (_key_cnt > 0) {