-
Notifications
You must be signed in to change notification settings - Fork 6k
Correct button state on synthetic pointer events #23111
Correct button state on synthetic pointer events #23111
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this. This change looks good, just need a test
We may have same issue in web pointer converter https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/pointer_converter.dart Not sure if this will affect web |
The web side was already landed in #22813. Test WIP but should be momentarily :) |
This corrects the button state emitted on synthetic pointer move and hover events generated by the engine. When an embedder notifies the engine of a pointer up or down event, and the pointer's position has changed since the last move or hover event, `PointerDataPacketConverter` generates a synthetic move or hover to notify the framework of the change in position. In these cases, the current event from the embedder contains the new button state *after* the pointer up/down event, but the move/over needs to be synthesized such that it occurs *before* the pointer up/down, with the previous button state. This patch stores the button state after each pointer down, up, move, or hover event such that it can be used by the next event if a synthetic event must be issued. The bug in the previous logic was revealed by the release of macOS 11 (Big Sur), which appears to issue move events between mouse down and mouse up, which did not use to be the case. This fixes flutter/flutter#64961, which is the desktop-specific tracking bug for the more general Big Sur mouse click umbrella issue flutter/flutter#71190.
Tests added -- caught an issue with synthesised events emitted when scrolling. |
5f17818
to
cd9740b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This corrects the button state emitted on synthetic pointer move and hover events generated by the engine. When an embedder notifies the engine of a pointer up or down event, and the pointer's position has changed since the last move or hover event, `PointerDataPacketConverter` generates a synthetic move or hover to notify the framework of the change in position. In these cases, the current event from the embedder contains the new button state *after* the pointer up/down event, but the move/hover needs to be synthesized such that it occurs *before* the pointer up/down, with the previous button state. This patch stores the button state after each pointer down, up, move, or hover event such that it can be used by the next event if a synthetic event must be issued. The bug in the previous logic was revealed by the release of macOS 11 (Big Sur), which appears to issue move events between mouse down and mouse up, which did not use to be the case. This fixes flutter/flutter#64961, which is the desktop-specific tracking bug for the more general Big Sur mouse click umbrella issue flutter/flutter#71190.
Description
This corrects the button state emitted on synthetic pointer move and
hover events generated by the engine.
When an embedder notifies the engine of a pointer up or down event, and
the pointer's position has changed since the last move or hover event,
PointerDataPacketConverter
generates a synthetic move or hover tonotify the framework of the change in position. In these cases, the
current event from the embedder contains the new button state after
the pointer up/down event, but the move/hover needs to be synthesized
such that it occurs before the pointer up/down, with the previous
button state.
This patch stores the button state after each pointer down, up, move, or
hover event such that it can be used by the next event if a synthetic
event must be issued.
The bug in the previous logic was revealed by the release of macOS 11
(Big Sur), which appears to issue move events between mouse down and
mouse up, which did not use to be the case.
Related Issues
This fixes flutter/flutter#64961, which is the
desktop-specific tracking bug for the more general Big Sur mouse click
umbrella issue flutter/flutter#71190.
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.