Add support for stylus buttons#183369
Conversation
|
@flutter/windows-reviewers can someone take a look? |
85c78f0 to
a356acd
Compare
There was a problem hiding this comment.
Code Review
This pull request adds support for inverted stylus devices and specific stylus buttons to the Windows embedder by refactoring pointer event handling to track button states per pointer ID. This allows for the detection of button transitions during pointer updates. The changes include new enums in the embedder API, helper functions for Win32 flag translation, and expanded unit tests. Feedback identifies a misleading comment in the flag translation logic, a redundant code block in the pointer info processing, and suggests simplifying the logic for identifying released buttons during pointer-up events.
|
cc @mattkae |
|
Addressed the reviews, ran the tests and tested it also in my flutter input demo. Theoretically I can also add button detection on pointer hover but I'm not sure if this is also implemented on other platforms. In this case, the first bit in the button mask is 0. |
|
I didn't touched any mac cis, so i think these fails can be ignored? |
|
@CodeDoctorDE I restarted those tests. If they fail again, please rebase your changes off the latest master commit. |
mattkae
left a comment
There was a problem hiding this comment.
I have no hardware with which to test this, but the code looks sensible to me!
loic-sharma
left a comment
There was a problem hiding this comment.
Thanks for the excellent patch, LGTM!
…ols, improve move pointer event, remove pointer_buttons_ variable and rename button to buttons
ac91962 to
df4c9d5
Compare
|
i saw it was downgraded yesterday, i rebased based on the latest master |
|
I'm confused right now, last time i checked this page the linux ci failed? But if everything is green then i don't need to do something :) |
|
Reason for revert: This PR causes the Example failures: https://ci.chromium.org/ui/p/flutter/builders/prod/Windows%20windows_host_engine_test/7765/overview Example failures: |
|
Successfully created revert PR: #187581 |
|
Oh strange, I ran the tests before commiting. I will investigate it |
|
@CodeDoctorDE No worries! Normally our presubmit checks would've caught this, but the Windows embedder unit tests are currently suppressed due to capacity issues: #186597 This is what the test looks like currently if it fails, it's very easy to miss a failure:
|
|
I looked at it again and these problems seems like to be because of wrong test code (I added) where I don't have POINTER_FLAG_FIRSTBUTTON added to the pointer flags: - pointer_info->pointerFlags = POINTER_FLAG_INCONTACT;
+ pointer_info->pointerFlags = POINTER_FLAG_INCONTACT |
+ POINTER_FLAG_FIRSTBUTTON |
+ POINTER_FLAG_DOWN;This should be the correct pointer flags since down and first button should be always there With these changes the tests succeed again |


Continuation of #165323.
Now we have stylus support on windows with the last pull request.
This pull request now adds support for
invertedStylusand stylus buttons (primary + secondary).The pull request shouldn't have any breaking changes other than the pointer event shows the correct button bitmap instead of
1always on a stylus input.Should completly fix: #102836.
Tested on my notebook:

repo for the demo code: https://github.com/CodeDoctorDE/flutter-input-demo
This pull request is currently a draft and my next steps is to add tests
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.