From 1f3b6490f289536ac83eaf674a3a26da83927b4c Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 20 May 2022 13:28:37 +0200 Subject: [PATCH] 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 --- repos/os/src/server/nitpicker/user_state.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/repos/os/src/server/nitpicker/user_state.cc b/repos/os/src/server/nitpicker/user_state.cc index b1088afa11..d26b5ba7b2 100644 --- a/repos/os/src/server/nitpicker/user_state.cc +++ b/repos/os/src/server/nitpicker/user_state.cc @@ -108,6 +108,10 @@ void User_state::_handle_input_event(Input::Event ev) ev.handle_absolute_motion([&] (int x, int 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 */ if (ev.press()) _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); }); - if (ev.absolute_motion() || ev.relative_motion()) { + if (ev.absolute_motion() || ev.relative_motion() || ev.touch()) { update_hover(); if (_key_cnt > 0) {