diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2023-12-20 10:13:06 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2024-01-24 17:12:57 +0100 |
commit | 571c407ea67d120c6735f728c59a464cce43ec8d (patch) | |
tree | d48ac8c2b64d741b38039fe99acfcd191aa479c9 /tests/manual | |
parent | f932f8c86d35cb5ab52f21ec810893a429a3622c (diff) |
DA: align delivery of mouse, touch, and synthesized mouse events to childMouseEventFilter
Currently the delivery of pointer events to childMouseEventFilters
differs depending on if the event is a mouse, touch, or synthesized
mouse event. If case of a mouse event, it will be sent to all the
filters up the parent chain, even if one of the filters along the
way returns true. If it's a touch event, propagation will stop as
soon as a filter returns true.
What does it mean that childMouseEventFilter returns true?
According to tst_QQuickWindow::testChildMouseEventFilter(), if
a childMouseEventFilter returns true, the event should be stopped
from being sent to the receiver, and only the receiver. It should
not be stopped from propagating to other childMouseEventFilters
up the parent chain. This is explicitly tested with data
row "r1 rejects and filters".
Therefore, in order to make testChildMouseEventFilter() pass, not
only for mouse events, but also for touch and synthesized mouse
events, this patch will make the following changes:
1) Remove the early 'return' statement after a touch event was
filtered by a childMouseEventFilter. This will make sure that the
touch event will continue to propagate to parent
childMouseEventFilters, equal to how it works for mouse and
synthesized mouse events.
2) For both touch-, and synthesized mouse events, we deliver a
(localized) copy of the original touch event to
childMouseEventFilter(). The filter can then choose to accept
or ignore this copy. But as it stood, we would never sync back
the accept state from the copy to the original event. The result
was that the original event would continue to propagate, regardless
of accepted state set by the filter. This patch will therefore
sync the accepted state from the copy back to the original event,
when the event is filtered. This will make sure that if a filter
e.g ignores the event, the receiver will not receive the event
(since it was filtered), and the event will propagate to the
parent (since it was ignored). Which is equal to how it works
for mouse events.
3) For both touch and synthesized mouse events, we used to always
set an exclusive grab on the affected event points if a
childMouseEventFilter filtered an event. This is different from
mouse event delivery, where we only set a grab when the event is
also accepted. And the latter is also (most likely) the correct thing
to do; If the event is ignored, it means that the filter says (on
behalf of the receiver) that it doesn't want the event. And it
doesn't make sense then (AFAICS) to still grab the event points.
This patch will therefore, equal to mouse event delivery, ensure
that we only give a filter an exclusive grab on the touch points
when the event was actually accepted.
With these changes applied, we then also change the
tst_qquickwindow::testChildMouseEventFilter() to run three times,
once for mouse event, touch events, and synthesized mouse events,
to verify that they're all aligned.
Fixes: QTBUG-115953
Pick-to: 6.7 6.6 6.5
Change-Id: I8b5b1faadc907e804b7e21c667888db7cfe28872
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/manual')
0 files changed, 0 insertions, 0 deletions