-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle out-of-order add/remove pointer events #55740
Handle out-of-order add/remove pointer events #55740
Conversation
Triage: @loic-sharma, do you how to direct this to reviewers? |
UpdatePointerIdentifier(synthesized_cancel_event, state, false); | ||
|
||
state.is_down = false; | ||
converted_pointers.push_back(synthesized_cancel_event); |
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.
I'm not very familiar with this code. Could you explain why the cancel event is synthesized only if the view exists? That's not immediately obvious to me
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.
I replicated the behavior of the non-synthesized/original remove event. When a non-synthesized "remove" is handled, a "cancel" is synthesized if the pointer is down, and a "hover" is synthesized if the pointer location has changed. Here, I replicate the synthesized "cancel" event, but not the "hover" event, since the pointer location is unchanged.
My reasoning for synthesizing the "cancel" event only for valid views is that the framework will ignore events for non-existing views.
Thanks for the excellent contribution! This patch looks good to me, but I'm not very familiar with this area. @dkwingsmt or @moffatman could you give this a review? |
FYI, your PR failed the following checks: Errors...
These failures don't look related to your change. I've retried these failing checks. If the re-runs fail, I would try rebasing your changes off the latest |
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.
Awesome change with awesome doc, thank you so much!
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 the wonderful contribution!
…ions) (#157066) Manual roll requested by [email protected] Cannot build log URL because revision "f12e0d385f4d" is invalid: Luci builds of "Linux Web Framework tests" for f12e0d385f4d64765ed46c7c3ac8fa7fa8bc3c43 was FAILURE 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "update the repo references for package:file (#55906)" (flutter/engine#55916) 2024-10-16 [email protected] Roll Skia from 09917e06158b to 3a081993e2a7 (3 revisions) (flutter/engine#55911) 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Manual roll Dart SDK from d916a5f69a48 to 2bf0f2b8d391 (24 revisions) (#55884)" (flutter/engine#55915) 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Manual roll Dart SDK from 2bf0f2b8d391 to 7fce3544047c (4 revisions) (#55896)" (flutter/engine#55914) 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Dart SDK from 7fce3544047c to 148b7c530657 (3 revisions) (#55903)" (flutter/engine#55913) 2024-10-16 [email protected] update the repo references for package:file (flutter/engine#55906) 2024-10-16 [email protected] Handle out-of-order add/remove pointer events (flutter/engine#55740) 2024-10-16 [email protected] Starts looking for the bdf fast path in relation to the snapshot_entity's transform (flutter/engine#55890) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ions) (flutter#157066) Manual roll requested by [email protected] Cannot build log URL because revision "f12e0d385f4d" is invalid: Luci builds of "Linux Web Framework tests" for f12e0d385f4d64765ed46c7c3ac8fa7fa8bc3c43 was FAILURE 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "update the repo references for package:file (flutter#55906)" (flutter/engine#55916) 2024-10-16 [email protected] Roll Skia from 09917e06158b to 3a081993e2a7 (3 revisions) (flutter/engine#55911) 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Manual roll Dart SDK from d916a5f69a48 to 2bf0f2b8d391 (24 revisions) (flutter#55884)" (flutter/engine#55915) 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Manual roll Dart SDK from 2bf0f2b8d391 to 7fce3544047c (4 revisions) (flutter#55896)" (flutter/engine#55914) 2024-10-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Dart SDK from 7fce3544047c to 148b7c530657 (3 revisions) (flutter#55903)" (flutter/engine#55913) 2024-10-16 [email protected] update the repo references for package:file (flutter/engine#55906) 2024-10-16 [email protected] Handle out-of-order add/remove pointer events (flutter/engine#55740) 2024-10-16 [email protected] Starts looking for the bdf fast path in relation to the snapshot_entity's transform (flutter/engine#55890) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes #146251.
On Windows, a "pointer add" event to a new view is sometimes sent before the "pointer remove" event from the old view. When
PointerDataPacketConverter
handles the add event, it asserts that the device's pointer state has been cleared. Since the pointer state is cleared only when the remove event is processed, the assertion fails if the events arrive out of order.The solution proposed here is to synthesize a remove event if an add event is received while the pointer state hasn't been cleared (i.e., if the pointer is added without being removed from the previous view).
To avoid duplicate remove events, the view ID is now tracked in
PointerState
. If the original "remove" arrives after the synthesized one, the state's view ID will differ from the pointer data's view ID, allowing it to be safely ignored.When synthesizing the remove event, it's possible that the old view has already been destroyed, meaning no remove event will be received later. For example, this occurs when a window is destroyed while the pointer is inside it. However, the framework expects an "add" event to always follow a "remove" event, and "remove" events with invalid views are ignored. To meet the framework's expectations, the view ID of the "add" event will be used for the "remove" event if the old view has been destroyed.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.