wm: reset pointer position on leave event

The wm used to remember the last pointer position when observing a leave
event. With such a stale pointer position, the wm would eventually
wrongly create an artifical motion event when a supposedly hovered
window changes its position (during an animated move). This can lead to
the propagation of the stale pointer position to the wm client, which,
in turn, may interpret the outdated position (e.g., the menu view would
report a wrong hover state).

This patch removes the stale state by resetting the '_pointer_pos' when
observing a leave event.

Fixes #3632
This commit is contained in:
Norman Feske 2020-01-28 14:23:39 +01:00 committed by Christian Helmuth
parent 0bffac6c98
commit 3a2895af19
1 changed files with 6 additions and 1 deletions

View File

@ -612,8 +612,10 @@ class Wm::Nitpicker::Session_component : public Rpc_object<Nitpicker::Session>,
if (ev.release() && _key_cnt == 0)
_click_handler.handle_enter(_pointer_pos);
if (ev.hover_leave())
if (ev.hover_leave()) {
_pointer_pos = _initial_pointer_pos;
_first_motion = true;
}
/* submit event to the client */
_input_session.submit(_translate_event(ev, input_origin));
@ -626,6 +628,9 @@ class Wm::Nitpicker::Session_component : public Rpc_object<Nitpicker::Session>,
*/
void input_origin_changed() override
{
if (_pointer_pos == _initial_pointer_pos)
return;
Point const pos = _pointer_pos + _input_origin();
_input_session.submit(Input::Absolute_motion { pos.x(), pos.y() });