nitpicker: no absolute motion without hover

This patch enforces the invariant that absolute motion events are
delivered to the hovered client only. If no client is hovered, the event
is discarded.

Otherwise, in a situation where no client is hovered (i.e., due to a
background that does not cover the entire screen) but a focus is
defined, absolute motion events would be delivered to the focused
session. From a client's perspective, when moving the pointer from the
client to emptiness, the client would observe a leave event followed by
absolute motion. This, in turn, confuses the window manager, which
expects that the receiver of an absolute motion event is hovered.

Fixes #5375
This commit is contained in:
Norman Feske
2024-12-18 18:17:55 +01:00
parent 5d2b57118d
commit 38d99c6dd1

View File

@@ -256,16 +256,20 @@ void User_state::_handle_input_event(Input::Event ev)
View_owner *receiver = _input_receiver;
if (_key_cnt == 0 && _hovered) {
if (_key_cnt == 0) {
auto abs_motion_receiver = [&] () -> View_owner *
{
if (!_hovered)
return nullptr;
bool const permitted = _hovered->hover_always()
|| _hovered->has_same_domain(_focused);
return permitted ? _hovered : nullptr;
};
if (ev.absolute_motion())
receiver = nullptr;
/*
* Unless the domain of the pointed session is configured to
* always receive hover events, we deliver motion events only
* to the focused domain.
*/
if (_hovered->hover_always() || _hovered->has_same_domain(_focused))
receiver = _hovered;
receiver = abs_motion_receiver();
}
/*