Skip to content

Allow stylus support on windows - #165323

Merged
auto-submit[bot] merged 15 commits into
flutter:masterfrom
CodeDoctorDE:windows/pointer
Mar 4, 2026
Merged

auto-submit[bot] merged 15 commits into
flutter:masterfrom
CodeDoctorDE:windows/pointer

Conversation

@CodeDoctorDE

@CodeDoctorDE CodeDoctorDE commented Mar 17, 2025 •

Copy link
Copy Markdown
Contributor

This is my attempt for adding support for stylus on windows.
It's work in progress! I post it here to indicate that I'm working on it and that the same work is not done twice

I'm working on the flutter_window.cpp file. Maybe I need to touch some other code to allow additional information like pressure, rotation and more.

Would fix #102836 and #65248

There should be no breaking change other than stylus would be reported as stylus instead of touch.

Tested with flutter master on my test project:
image

https://github.com/CodeDoctorDE/flutter-input-demo

Tests are currently not there, I will add them next. (Added).

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically a: desktop Running on desktop labels Mar 17, 2025
@CodeDoctorDE

Copy link
Copy Markdown
Contributor Author

Looks like we can also identify hovering, I will work on this next

@CodeDoctorDE

Copy link
Copy Markdown
Contributor Author

Dont know why mac and linux ci fails, but my changes doesnt break any windows test so it looks good. Now i need to add my own tests

@Piinks

Piinks commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Hey @CodeDoctorDE welcome! Thanks for contributing! It looks like this never entered the review queue since it was marked a draft. Is this still something you would like to work on?

@CodeDoctorDE

Copy link
Copy Markdown
Contributor Author

Hello, oh yeah, but it currently has some problems I need to fix

@Piinks

Piinks commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

Hello again @CodeDoctorDE, this came back around to stale PR triage. :)
Still have plans to work on this?

@CodeDoctorDE

Copy link
Copy Markdown
Contributor Author

Hello,
Yeah, Im happy to work again here, but in the current time, I hadn't enough time because of studying. I will continue here in a month

@Piinks

Piinks commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

Quite alright! Thanks for letting us know. I am going to close this for now to remove it from our review queue and CI tasks. Feel free to reopen when you are ready to return to it. Thanks!

@Piinks Piinks closed this Aug 6, 2025
@CodeDoctorDE

Copy link
Copy Markdown
Contributor Author

Hello, I finished my changes but I don't have the option to reopen it.
Can you reopen it or should I make a new one?

@fluttergithubbot

Copy link
Copy Markdown
Contributor

An existing Git SHA, 7446780b1c60f45e90729911b67d6ad0f7d1ea28, was detected, and no actions were taken.

To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with --force) that already was pushed before, push a blank commit (git commit --allow-empty -m "Trigger Build") or rebase to continue.

@CodeDoctorDE
CodeDoctorDE marked this pull request as ready for review August 11, 2025 07:47
@CodeDoctorDE

Copy link
Copy Markdown
Contributor Author

PR can be reviewed, not sure why mac fais

@tirth-patel-nc

Copy link
Copy Markdown
Member

PR can be reviewed, not sure why mac fais

It is passing. Tree status would be green on its own

auto that = static_cast<FlutterWindow*>(cs->lpCreateParams);
that->window_handle_ = window;
that->text_input_manager_->SetWindowHandle(window);
RegisterTouchWindow(window, 0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you confirm that multi-touch gestures like pinching on a trackpad still works after this change?

(This line was added by flutter-team-archive/engine#27863 for multi-touch support, I'd like to double-check we're not regressing that behavior with this new implementation!)

@Demohstens Demohstens Aug 19, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this line disables WM_GESTURE & WM_TOUCH messages. The first is not handled and the latter is replaced by the new implementation so this should not impact the trackpad at all. Local tests seem to confirm this but i'm not entirely confident they cover all cases. This might have been necessary for supporting windows 7 and older as WM_POINTER* were not supported before that.

@loic-sharma loic-sharma Aug 20, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha, thanks for the details!

cc @jnschulze in case you have any concerns since you added this back in: flutter-team-archive/engine#27863

} else if (message == WM_POINTERUPDATE) {
// POINTER_FLAG_INCONTACT indicates the stylus is touching the screen
// When not set, it means the stylus is hovering
OnPointerMove(x, y, device_kind, touch_id, rotation, pressure, 0);

@loic-sharma loic-sharma Aug 18, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these non-obvious default values, could you add a comment like /*argument_name=*/ to make these a little more obvious? For example:

Suggested change
OnPointerMove(x, y, device_kind, touch_id, rotation, pressure, 0);
OnPointerMove(x, y, device_kind, touch_id, rotation, pressure, /* modifiers_state=*/0);

yPos = GET_Y_LPARAM(lparam);
OnPointerDown(static_cast<double>(xPos), static_cast<double>(yPos),
device_kind, kDefaultPointerDeviceId, button_pressed);
device_kind, kDefaultPointerDeviceId, button_pressed, 0, 0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here for adding param name doc hints :)

@loic-sharma

loic-sharma commented Aug 18, 2025 •

Copy link
Copy Markdown
Member

Thanks for the wonderful contribution - this is looking really good! I left a question and a nitpick. Please feel free to ping me directly when ready.

@loic-sharma

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces stylus support on Windows by migrating from WM_TOUCH to the more modern WM_POINTER* APIs. This is a significant improvement, allowing for the capture of additional input data like pressure and rotation. The changes are well-structured, touching the embedder API, the Windows-specific implementation, and adding a comprehensive suite of unit tests for the new functionality. The overall approach is solid. I have a few suggestions to enhance code clarity and maintainability.

Comment on lines +531 to 581
case WM_POINTERDOWN:
case WM_POINTERUPDATE:
case WM_POINTERUP:
case WM_POINTERLEAVE: {
xPos = GET_X_LPARAM(lparam);
yPos = GET_Y_LPARAM(lparam);
auto x = static_cast<double>(xPos);
auto y = static_cast<double>(yPos);
auto pointerId = GET_POINTERID_WPARAM(wparam);
POINTER_INFO pointerInfo;
if (windows_proc_table_->GetPointerInfo(pointerId, &pointerInfo)) {
UINT32 pressure = 0;
UINT32 rotation = 0;
if (pointerInfo.pointerType == PT_PEN) {
POINTER_PEN_INFO penInfo;
if (windows_proc_table_->GetPointerPenInfo(pointerId, &penInfo)) {
pressure = penInfo.pressure;
rotation = penInfo.rotation;
}
}
CloseTouchInputHandle(touch_input_handle);
auto touch_id = touch_id_generator_.GetGeneratedId(pointerId);
FlutterPointerDeviceKind device_kind = kFlutterPointerDeviceKindMouse;
switch (pointerInfo.pointerType) {
case PT_TOUCH:
device_kind = kFlutterPointerDeviceKindTouch;
break;
case PT_PEN:
device_kind = kFlutterPointerDeviceKindStylus;
break;
case PT_MOUSE:
device_kind = kFlutterPointerDeviceKindMouse;
break;
}
if (message == WM_POINTERDOWN) {
OnPointerDown(x, y, device_kind, touch_id, WM_LBUTTONDOWN, rotation,
pressure);
} else if (message == WM_POINTERUPDATE) {
// POINTER_FLAG_INCONTACT indicates the stylus is touching the screen
// When not set, it means the stylus is hovering
OnPointerMove(x, y, device_kind, touch_id, rotation, pressure, 0);
} else if (message == WM_POINTERUP) {
OnPointerUp(x, y, device_kind, touch_id, WM_LBUTTONUP);
// keep tracking the pointer (especially important for stylus)
// This allows a stylus to "hover" over the window
} else if (message == WM_POINTERLEAVE) {
OnPointerLeave(x, y, device_kind, touch_id);
touch_id_generator_.ReleaseNumber(pointerId);
}
}
return 0;
break;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block for handling pointer messages is quite large and adds significant complexity to the HandleMessage method. To improve readability and maintainability, consider extracting this logic into a new private helper method, for example HandlePointerMessage(UINT const message, WPARAM const wparam, LPARAM const lparam).

@loic-sharma loic-sharma Aug 18, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I think this is fine as-is. If you want to split this up, I'd consider adding a ToPointerDataKind helper function for mapping from win32 pointer input types to Flutter's pointer device kinds.

Comment thread engine/src/flutter/shell/platform/windows/flutter_window.cc
Comment on lines +276 to +278
// Test that the mock is working by calling it directly
POINTER_INFO test_pointer_info = {};
BOOL result = mock_proc_table->GetPointerInfo(1, &test_pointer_info);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These lines appear to be for debugging and are not used in the test's assertions. They can be removed.

Comment on lines +297 to +298
LRESULT message_result =
win32window.InjectWindowMessage(WM_POINTERDOWN, wparam, lparam);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The message_result variable is unused. The call to InjectWindowMessage can be made without assigning its return value.

Suggested change
LRESULT message_result =
win32window.InjectWindowMessage(WM_POINTERDOWN, wparam, lparam);
win32window.InjectWindowMessage(WM_POINTERDOWN, wparam, lparam);

Comment thread engine/src/flutter/shell/platform/windows/flutter_windows_view.cc Outdated
Comment thread engine/src/flutter/shell/platform/windows/flutter_window.cc
Comment thread engine/src/flutter/shell/platform/windows/flutter_windows_view.cc Outdated
@loic-sharma

Copy link
Copy Markdown
Member

I'll be on vacation for the next 10 days and won't be able to review. Apologies for the delay!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 6, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Mar 6, 2026
Roll Flutter from d3dd7744e81f to d18214307703 (33 revisions)

flutter/flutter@d3dd774...d182143

2026-03-06 [email protected] Roll Packages from 8d5c5cd to fe3de64 (2 revisions) (flutter/flutter#183308)
2026-03-06 [email protected] Roll Dart SDK from 1b51451cdb99 to 7c7c1e3d024d (2 revisions) (flutter/flutter#183294)
2026-03-06 [email protected] Roll Dart SDK from 9ac06cdd1801 to 1b51451cdb99 (9 revisions) (flutter/flutter#183289)
2026-03-06 [email protected] Add GitHub workflows to assist with release tasks (flutter/flutter#181978)
2026-03-06 [email protected] [Impeller] Fix new convex path shadow generation in perspective (flutter/flutter#183187)
2026-03-06 [email protected] Roll pub packages (flutter/flutter#183178)
2026-03-05 [email protected] fix: use double quotes in settings.gradle.kts template (flutter/flutter#183081)
2026-03-05 [email protected] Add fallbackColor for PredictiveBackPageTransitionBuilder and PredictiveBackFullscreenPageTransitionBuilder (flutter/flutter#182690)
2026-03-05 [email protected] Simplify TesterContextGLES (multithreading logic not needed), and enable some tests that now pass (flutter/flutter#183250)
2026-03-05 [email protected] Roll Skia from a94df1cdabb0 to a69ef43650ee (14 revisions) (flutter/flutter#183280)
2026-03-05 [email protected] Windowing implementation of `showDialog` that uses a native desktop window to display the content  (flutter/flutter#181861)
2026-03-05 [email protected] Build CocoaPod plugin frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183239)
2026-03-05 [email protected] Extend the Linux web_skwasm_tests_1 timeout to 45 minutes (flutter/flutter#183247)
2026-03-05 [email protected] Update Dart to 3.12 beta 2 (flutter/flutter#183251)
2026-03-05 [email protected] Replace the rest of the references to `flutter/engine` with `flutter/flutter` (flutter/flutter#182938)
2026-03-05 [email protected] chore: convert android_verified_input to pub-workspace (flutter/flutter#183175)
2026-03-05 [email protected] Add await to flutter_test callsites (flutter/flutter#182983)
2026-03-05 [email protected] [iOS] Skip gesture recognizer reset workaround on iOS 26+  (flutter/flutter#183186)
2026-03-05 [email protected] Add warning for plugins not migrated to UIScene (flutter/flutter#182826)
2026-03-05 [email protected] Roll Fuchsia Linux SDK from JJw5EJ87vLGqFVl4h... to 8ay15_eQOEgPHCypm... (flutter/flutter#183255)
2026-03-05 [email protected] Roll Skia from ada0b7628c79 to a94df1cdabb0 (2 revisions) (flutter/flutter#183249)
2026-03-05 [email protected] Roll Packages from 82baf93 to 8d5c5cd (2 revisions) (flutter/flutter#183269)
2026-03-05 [email protected] Add `UnlabaledLeafNodeEvaluation` (flutter/flutter#182872)
2026-03-04 [email protected] Re-specify the ndk version in various test apps, to prevent ndk download (flutter/flutter#183134)
2026-03-04 [email protected] Eliminate rebuilds for Scaffold FAB animation (flutter/flutter#182331)
2026-03-04 [email protected] Add Michal Kucharski to AUTHORS (flutter/flutter#182366)
2026-03-04 [email protected] Merge changelog from 3.41.4 stable. (flutter/flutter#183243)
2026-03-04 [email protected] Allow stylus support on windows (flutter/flutter#165323)
2026-03-04 [email protected] Fix docs on SingletonFlutterWindow.supportsShowingSystemContextMenu (flutter/flutter#183142)
2026-03-04 [email protected] Roll Packages from 9083bc9 to 82baf93 (5 revisions) (flutter/flutter#183240)
2026-03-04 [email protected] Fixes FocusHighlightMode on Android when typing in software keyboard (flutter/flutter#180753)
2026-03-04 [email protected] Make compileShader() retry without sksl if it fails with sksl. (flutter/flutter#183146)
2026-03-04 [email protected] [web] Use pointer-events: auto for non-interactive leaf semantics nodes (flutter/flutter#183077)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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:
...
@CodeDoctorDE CodeDoctorDE mentioned this pull request Mar 8, 2026
10 tasks done
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

This is my attempt for adding support for stylus on windows.
~~**It's work in progress! I post it here to indicate that I'm working
on it and that the same work is not done twice**~~

I'm working on the `flutter_window.cpp` file. Maybe I need to touch some
other code to allow additional information like pressure, rotation and
more.

Would fix flutter#102836 and
flutter#65248

There should be no breaking change other than stylus would be reported
as `stylus` instead of `touch`.

Tested with flutter master on my test project:

![image](https://github.com/user-attachments/assets/e8b75f96-2334-45e9-be23-753f1565a246)

https://github.com/CodeDoctorDE/flutter-input-demo

~~Tests are currently not there, I will add them next.~~ (Added).

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Demohstens <[email protected]>
Co-authored-by: Demohstens <[email protected]>
Co-authored-by: Matthew Kosarek <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
okorohelijah pushed a commit to okorohelijah/packages that referenced this pull request Mar 26, 2026
…r#11191)

Roll Flutter from d3dd7744e81f to d18214307703 (33 revisions)

flutter/flutter@d3dd774...d182143

2026-03-06 [email protected] Roll Packages from 8d5c5cd to fe3de64 (2 revisions) (flutter/flutter#183308)
2026-03-06 [email protected] Roll Dart SDK from 1b51451cdb99 to 7c7c1e3d024d (2 revisions) (flutter/flutter#183294)
2026-03-06 [email protected] Roll Dart SDK from 9ac06cdd1801 to 1b51451cdb99 (9 revisions) (flutter/flutter#183289)
2026-03-06 [email protected] Add GitHub workflows to assist with release tasks (flutter/flutter#181978)
2026-03-06 [email protected] [Impeller] Fix new convex path shadow generation in perspective (flutter/flutter#183187)
2026-03-06 [email protected] Roll pub packages (flutter/flutter#183178)
2026-03-05 [email protected] fix: use double quotes in settings.gradle.kts template (flutter/flutter#183081)
2026-03-05 [email protected] Add fallbackColor for PredictiveBackPageTransitionBuilder and PredictiveBackFullscreenPageTransitionBuilder (flutter/flutter#182690)
2026-03-05 [email protected] Simplify TesterContextGLES (multithreading logic not needed), and enable some tests that now pass (flutter/flutter#183250)
2026-03-05 [email protected] Roll Skia from a94df1cdabb0 to a69ef43650ee (14 revisions) (flutter/flutter#183280)
2026-03-05 [email protected] Windowing implementation of `showDialog` that uses a native desktop window to display the content  (flutter/flutter#181861)
2026-03-05 [email protected] Build CocoaPod plugin frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183239)
2026-03-05 [email protected] Extend the Linux web_skwasm_tests_1 timeout to 45 minutes (flutter/flutter#183247)
2026-03-05 [email protected] Update Dart to 3.12 beta 2 (flutter/flutter#183251)
2026-03-05 [email protected] Replace the rest of the references to `flutter/engine` with `flutter/flutter` (flutter/flutter#182938)
2026-03-05 [email protected] chore: convert android_verified_input to pub-workspace (flutter/flutter#183175)
2026-03-05 [email protected] Add await to flutter_test callsites (flutter/flutter#182983)
2026-03-05 [email protected] [iOS] Skip gesture recognizer reset workaround on iOS 26+  (flutter/flutter#183186)
2026-03-05 [email protected] Add warning for plugins not migrated to UIScene (flutter/flutter#182826)
2026-03-05 [email protected] Roll Fuchsia Linux SDK from JJw5EJ87vLGqFVl4h... to 8ay15_eQOEgPHCypm... (flutter/flutter#183255)
2026-03-05 [email protected] Roll Skia from ada0b7628c79 to a94df1cdabb0 (2 revisions) (flutter/flutter#183249)
2026-03-05 [email protected] Roll Packages from 82baf93 to 8d5c5cd (2 revisions) (flutter/flutter#183269)
2026-03-05 [email protected] Add `UnlabaledLeafNodeEvaluation` (flutter/flutter#182872)
2026-03-04 [email protected] Re-specify the ndk version in various test apps, to prevent ndk download (flutter/flutter#183134)
2026-03-04 [email protected] Eliminate rebuilds for Scaffold FAB animation (flutter/flutter#182331)
2026-03-04 [email protected] Add Michal Kucharski to AUTHORS (flutter/flutter#182366)
2026-03-04 [email protected] Merge changelog from 3.41.4 stable. (flutter/flutter#183243)
2026-03-04 [email protected] Allow stylus support on windows (flutter/flutter#165323)
2026-03-04 [email protected] Fix docs on SingletonFlutterWindow.supportsShowingSystemContextMenu (flutter/flutter#183142)
2026-03-04 [email protected] Roll Packages from 9083bc9 to 82baf93 (5 revisions) (flutter/flutter#183240)
2026-03-04 [email protected] Fixes FocusHighlightMode on Android when typing in software keyboard (flutter/flutter#180753)
2026-03-04 [email protected] Make compileShader() retry without sksl if it fails with sksl. (flutter/flutter#183146)
2026-03-04 [email protected] [web] Use pointer-events: auto for non-interactive leaf semantics nodes (flutter/flutter#183077)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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:
...
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

This is my attempt for adding support for stylus on windows.
~~**It's work in progress! I post it here to indicate that I'm working
on it and that the same work is not done twice**~~

I'm working on the `flutter_window.cpp` file. Maybe I need to touch some
other code to allow additional information like pressure, rotation and
more.

Would fix flutter#102836 and
flutter#65248

There should be no breaking change other than stylus would be reported
as `stylus` instead of `touch`.

Tested with flutter master on my test project:

![image](https://github.com/user-attachments/assets/e8b75f96-2334-45e9-be23-753f1565a246)

https://github.com/CodeDoctorDE/flutter-input-demo

~~Tests are currently not there, I will add them next.~~ (Added).

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Demohstens <[email protected]>
Co-authored-by: Demohstens <[email protected]>
Co-authored-by: Matthew Kosarek <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
dkmcgowan added a commit to dkmcgowan/finzy that referenced this pull request Apr 30, 2026
Bisected the Windows ARM64 touchscreen regression to flutter/flutter#165323
("Allow stylus support on windows", commit 904dab858c, merged 2026-03-04).
The new WM_POINTER* handler in flutter_window.cc reads lParam as if it were
client coordinates, but Win32 spec says WM_POINTER lParam is in screen
coordinates — the WM_TOUCH path it replaced correctly used ScreenToClient,
which was lost in the conversion. Taps land off by the client area's offset
from the screen origin (~1.5–2 inches on a Surface Pro 12"). Mouse input
is unaffected because WM_MOUSEMOVE/WM_LBUTTONDOWN lParam is client-relative
per the mouse-message convention.

The new pin is the immediate parent of the bad commit, verified good via
finger-touch testing on real ARM64 hardware. Tracked upstream at
flutter/flutter#184954.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@CodeDoctorDE CodeDoctorDE mentioned this pull request May 20, 2026
10 tasks done
victorsanni pushed a commit to MarlonJD/flutter that referenced this pull request Jun 3, 2026
Continuation of flutter#165323.

Now we have stylus support on windows with the last pull request.

This pull request now adds support for `invertedStylus` and 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 `1` always on a
stylus input.

Should completly fix:  flutter#102836.

Tested on my notebook:
<img width="1902" height="1071" alt="grafik"
src="https://github.com/user-attachments/assets/1761336f-8db5-4da2-91b5-2c17bc92d698"
/>
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

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
pull Bot pushed a commit to g-star1024/flutter that referenced this pull request Jun 5, 2026
Reverts: [Add support for stylus
buttons](flutter#183369)

Initiated by: @loic-sharma

Reason for reverting: This PR causes the `Windows
windows_host_engine_test` to fail. cc @CodeDoctorDE

Original PR Author: @CodeDoctorDE

Reviewed By: @mattkae

The original PR description is provided below:

Continuation of flutter#165323.

Now we have stylus support on windows with the last pull request.

This pull request now adds support for `invertedStylus` and 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 `1` always on a
stylus input.

Should completly fix:  flutter#102836.

Tested on my notebook:
<img width="1902" height="1071" alt="grafik"
src="https://github.com/user-attachments/assets/1761336f-8db5-4da2-91b5-2c17bc92d698"
/>
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

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11191)

Roll Flutter from d3dd7744e81f to d18214307703 (33 revisions)

flutter/flutter@d3dd774...d182143

2026-03-06 [email protected] Roll Packages from 8d5c5cd to fe3de64 (2 revisions) (flutter/flutter#183308)
2026-03-06 [email protected] Roll Dart SDK from 1b51451cdb99 to 7c7c1e3d024d (2 revisions) (flutter/flutter#183294)
2026-03-06 [email protected] Roll Dart SDK from 9ac06cdd1801 to 1b51451cdb99 (9 revisions) (flutter/flutter#183289)
2026-03-06 [email protected] Add GitHub workflows to assist with release tasks (flutter/flutter#181978)
2026-03-06 [email protected] [Impeller] Fix new convex path shadow generation in perspective (flutter/flutter#183187)
2026-03-06 [email protected] Roll pub packages (flutter/flutter#183178)
2026-03-05 [email protected] fix: use double quotes in settings.gradle.kts template (flutter/flutter#183081)
2026-03-05 [email protected] Add fallbackColor for PredictiveBackPageTransitionBuilder and PredictiveBackFullscreenPageTransitionBuilder (flutter/flutter#182690)
2026-03-05 [email protected] Simplify TesterContextGLES (multithreading logic not needed), and enable some tests that now pass (flutter/flutter#183250)
2026-03-05 [email protected] Roll Skia from a94df1cdabb0 to a69ef43650ee (14 revisions) (flutter/flutter#183280)
2026-03-05 [email protected] Windowing implementation of `showDialog` that uses a native desktop window to display the content  (flutter/flutter#181861)
2026-03-05 [email protected] Build CocoaPod plugin frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183239)
2026-03-05 [email protected] Extend the Linux web_skwasm_tests_1 timeout to 45 minutes (flutter/flutter#183247)
2026-03-05 [email protected] Update Dart to 3.12 beta 2 (flutter/flutter#183251)
2026-03-05 [email protected] Replace the rest of the references to `flutter/engine` with `flutter/flutter` (flutter/flutter#182938)
2026-03-05 [email protected] chore: convert android_verified_input to pub-workspace (flutter/flutter#183175)
2026-03-05 [email protected] Add await to flutter_test callsites (flutter/flutter#182983)
2026-03-05 [email protected] [iOS] Skip gesture recognizer reset workaround on iOS 26+  (flutter/flutter#183186)
2026-03-05 [email protected] Add warning for plugins not migrated to UIScene (flutter/flutter#182826)
2026-03-05 [email protected] Roll Fuchsia Linux SDK from JJw5EJ87vLGqFVl4h... to 8ay15_eQOEgPHCypm... (flutter/flutter#183255)
2026-03-05 [email protected] Roll Skia from ada0b7628c79 to a94df1cdabb0 (2 revisions) (flutter/flutter#183249)
2026-03-05 [email protected] Roll Packages from 82baf93 to 8d5c5cd (2 revisions) (flutter/flutter#183269)
2026-03-05 [email protected] Add `UnlabaledLeafNodeEvaluation` (flutter/flutter#182872)
2026-03-04 [email protected] Re-specify the ndk version in various test apps, to prevent ndk download (flutter/flutter#183134)
2026-03-04 [email protected] Eliminate rebuilds for Scaffold FAB animation (flutter/flutter#182331)
2026-03-04 [email protected] Add Michal Kucharski to AUTHORS (flutter/flutter#182366)
2026-03-04 [email protected] Merge changelog from 3.41.4 stable. (flutter/flutter#183243)
2026-03-04 [email protected] Allow stylus support on windows (flutter/flutter#165323)
2026-03-04 [email protected] Fix docs on SingletonFlutterWindow.supportsShowingSystemContextMenu (flutter/flutter#183142)
2026-03-04 [email protected] Roll Packages from 9083bc9 to 82baf93 (5 revisions) (flutter/flutter#183240)
2026-03-04 [email protected] Fixes FocusHighlightMode on Android when typing in software keyboard (flutter/flutter#180753)
2026-03-04 [email protected] Make compileShader() retry without sksl if it fails with sksl. (flutter/flutter#183146)
2026-03-04 [email protected] [web] Use pointer-events: auto for non-interactive leaf semantics nodes (flutter/flutter#183077)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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:
...
pull Bot pushed a commit to AbhiShake1/flutter that referenced this pull request Jun 11, 2026
Relands flutter#183369, which was
reverted in flutter#187581 after
`Windows windows_host_engine_test` failed in
`FlutterWindowTest.OnMousePointerDown`.

The original PR continued the Windows stylus work from
flutter#165323 and fixes
flutter#102836.

The original 8 commits from `windows/pointer-buttons` are squashed into
a single reland commit.

## Fix for the reverted failure

The revert was caused by a failing Windows unit test, not by the engine
pointer button logic itself.

The affected test mocked a pointer-down event with
`POINTER_FLAG_INCONTACT`, but did not include the documented Win32
button/down flags needed for a primary button press. The engine now
derives the Flutter button bitmap from the Windows pointer button flags,
so the mock event needs to represent an actual primary-button down
event.

This reland adds the missing flags in the affected test data:

- `POINTER_FLAG_FIRSTBUTTON`
- `POINTER_FLAG_DOWN`

This keeps the engine behavior aligned with the Win32 pointer input
documentation instead of inferring a primary button from
`POINTER_FLAG_INCONTACT` alone. See here:
https://learn.microsoft.com/en-us/windows/win32/inputmsg/pointer-flags-contants.

## Tests

Built successfully:

- `.\src\flutter\bin\et.bat build`
- `autoninja -C engine\src\out\host_debug flutter_windows_unittests
client_wrapper_windows_unittests accessibility_unittests
embedder_a11y_unittests embedder_proctable_unittests embedder_unittests`

Ran relevant Windows/embedder tests:

- `embedder_a11y_unittests --repeat=2`: passed
- `embedder_proctable_unittests --repeat=2`: passed
- `embedder_unittests --repeat=2`: passed
- `accessibility_unittests --repeat=2`: passed
- `client_wrapper_windows_unittests --repeat=2`: passed
- `flutter_windows_unittests --repeat=2`: failed only in
`KeyboardTest.DeadKeyTwiceThenLetter` due to local keyboard layout,
expected `` ` `` but received `ö`

Reran `flutter_windows_unittests` excluding only the unrelated local
keyboard-layout test:

- `flutter_windows_unittests --repeat=2
--gtest_filter=-KeyboardTest.DeadKeyTwiceThenLetter`: passed

The previously failing `FlutterWindowTest.OnMousePointerDown` now
passes.

These are the logs for one run (where this test was failing previously):


<details><summary>Details</summary>
<p>

```
[INFO:flutter/testing/test_timeout_listener.cc(75)] Test timeout of 300 seconds per test case will be enforced.
Note: Google Test filter = FlutterWindowTest.*
[==========] Running 26 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 26 tests from FlutterWindowTest
[ RUN      ] FlutterWindowTest.CreateDestroy
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.CreateDestroy (152 ms)
[ RUN      ] FlutterWindowTest.OnBitmapSurfaceUpdated
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.OnBitmapSurfaceUpdated (56 ms)
[ RUN      ] FlutterWindowTest.OnCursorRectUpdatedRegularDPI
[       OK ] FlutterWindowTest.OnCursorRectUpdatedRegularDPI (1 ms)
[ RUN      ] FlutterWindowTest.OnCursorRectUpdatedHighDPI
[       OK ] FlutterWindowTest.OnCursorRectUpdatedHighDPI (0 ms)
[ RUN      ] FlutterWindowTest.OnPointerStarSendsDeviceType
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.OnPointerStarSendsDeviceType (56 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerDown
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerDown (6 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerMove
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerMove (5 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerUp
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerUp (14 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerLeave
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerLeave (8 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerHover
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerHover (9 ms)
[ RUN      ] FlutterWindowTest.OnStylusHoverAfterPointerUp
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusHoverAfterPointerUp (12 ms)
[ RUN      ] FlutterWindowTest.OnStylusBarrelButtonUsesPenFlags
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusBarrelButtonUsesPenFlags (6 ms)
[ RUN      ] FlutterWindowTest.OnStylusEraserButtonUsesPenFlags
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusEraserButtonUsesPenFlags (6 ms)
[ RUN      ] FlutterWindowTest.OnInvertedStylusPointerDownUsesDeviceKind
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnInvertedStylusPointerDownUsesDeviceKind (6 ms)
[ RUN      ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithUpdatedButtons
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithUpdatedButtons (13 ms)
[ RUN      ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithReleasedButton
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithReleasedButton (10 ms)
[ RUN      ] FlutterWindowTest.OnMousePointerDown
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnMousePointerDown (4 ms)
[ RUN      ] FlutterWindowTest.OnTouchPointerDown
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnTouchPointerDown (6 ms)
[ RUN      ] FlutterWindowTest.PointerMessageScreenCoordinatesAreConvertedToClient
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.PointerMessageScreenCoordinatesAreConvertedToClient (5 ms)
[ RUN      ] FlutterWindowTest.OnScrollCallsGetScrollOffsetMultiplier
[       OK ] FlutterWindowTest.OnScrollCallsGetScrollOffsetMultiplier (0 ms)
[ RUN      ] FlutterWindowTest.OnWindowRepaint
[       OK ] FlutterWindowTest.OnWindowRepaint (0 ms)
[ RUN      ] FlutterWindowTest.OnThemeChange
[       OK ] FlutterWindowTest.OnThemeChange (0 ms)
[ RUN      ] FlutterWindowTest.AccessibilityNodeWithoutView
[       OK ] FlutterWindowTest.AccessibilityNodeWithoutView (0 ms)
[ RUN      ] FlutterWindowTest.AlertNode
[       OK ] FlutterWindowTest.AlertNode (59 ms)
[ RUN      ] FlutterWindowTest.LifecycleFocusMessages
[       OK ] FlutterWindowTest.LifecycleFocusMessages (0 ms)
[ RUN      ] FlutterWindowTest.CachedLifecycleMessage
[       OK ] FlutterWindowTest.CachedLifecycleMessage (0 ms)
[----------] 26 tests from FlutterWindowTest (478 ms total)

[----------] Global test environment tear-down
[==========] 26 tests from 1 test suite ran. (479 ms total)
[  PASSED  ] 26 tests.
```
</p>
</details> 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
Continuation of flutter#165323.

Now we have stylus support on windows with the last pull request.

This pull request now adds support for `invertedStylus` and 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 `1` always on a
stylus input.

Should completly fix:  flutter#102836.

Tested on my notebook:
<img width="1902" height="1071" alt="grafik"
src="https://github.com/user-attachments/assets/1761336f-8db5-4da2-91b5-2c17bc92d698"
/>
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

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
Reverts: [Add support for stylus
buttons](flutter#183369)

Initiated by: @loic-sharma

Reason for reverting: This PR causes the `Windows
windows_host_engine_test` to fail. cc @CodeDoctorDE

Original PR Author: @CodeDoctorDE

Reviewed By: @mattkae

The original PR description is provided below:

Continuation of flutter#165323.

Now we have stylus support on windows with the last pull request.

This pull request now adds support for `invertedStylus` and 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 `1` always on a
stylus input.

Should completly fix:  flutter#102836.

Tested on my notebook:
<img width="1902" height="1071" alt="grafik"
src="https://github.com/user-attachments/assets/1761336f-8db5-4da2-91b5-2c17bc92d698"
/>
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

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
Relands flutter#183369, which was
reverted in flutter#187581 after
`Windows windows_host_engine_test` failed in
`FlutterWindowTest.OnMousePointerDown`.

The original PR continued the Windows stylus work from
flutter#165323 and fixes
flutter#102836.

The original 8 commits from `windows/pointer-buttons` are squashed into
a single reland commit.

## Fix for the reverted failure

The revert was caused by a failing Windows unit test, not by the engine
pointer button logic itself.

The affected test mocked a pointer-down event with
`POINTER_FLAG_INCONTACT`, but did not include the documented Win32
button/down flags needed for a primary button press. The engine now
derives the Flutter button bitmap from the Windows pointer button flags,
so the mock event needs to represent an actual primary-button down
event.

This reland adds the missing flags in the affected test data:

- `POINTER_FLAG_FIRSTBUTTON`
- `POINTER_FLAG_DOWN`

This keeps the engine behavior aligned with the Win32 pointer input
documentation instead of inferring a primary button from
`POINTER_FLAG_INCONTACT` alone. See here:
https://learn.microsoft.com/en-us/windows/win32/inputmsg/pointer-flags-contants.

## Tests

Built successfully:

- `.\src\flutter\bin\et.bat build`
- `autoninja -C engine\src\out\host_debug flutter_windows_unittests
client_wrapper_windows_unittests accessibility_unittests
embedder_a11y_unittests embedder_proctable_unittests embedder_unittests`

Ran relevant Windows/embedder tests:

- `embedder_a11y_unittests --repeat=2`: passed
- `embedder_proctable_unittests --repeat=2`: passed
- `embedder_unittests --repeat=2`: passed
- `accessibility_unittests --repeat=2`: passed
- `client_wrapper_windows_unittests --repeat=2`: passed
- `flutter_windows_unittests --repeat=2`: failed only in
`KeyboardTest.DeadKeyTwiceThenLetter` due to local keyboard layout,
expected `` ` `` but received `ö`

Reran `flutter_windows_unittests` excluding only the unrelated local
keyboard-layout test:

- `flutter_windows_unittests --repeat=2
--gtest_filter=-KeyboardTest.DeadKeyTwiceThenLetter`: passed

The previously failing `FlutterWindowTest.OnMousePointerDown` now
passes.

These are the logs for one run (where this test was failing previously):


<details><summary>Details</summary>
<p>

```
[INFO:flutter/testing/test_timeout_listener.cc(75)] Test timeout of 300 seconds per test case will be enforced.
Note: Google Test filter = FlutterWindowTest.*
[==========] Running 26 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 26 tests from FlutterWindowTest
[ RUN      ] FlutterWindowTest.CreateDestroy
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.CreateDestroy (152 ms)
[ RUN      ] FlutterWindowTest.OnBitmapSurfaceUpdated
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.OnBitmapSurfaceUpdated (56 ms)
[ RUN      ] FlutterWindowTest.OnCursorRectUpdatedRegularDPI
[       OK ] FlutterWindowTest.OnCursorRectUpdatedRegularDPI (1 ms)
[ RUN      ] FlutterWindowTest.OnCursorRectUpdatedHighDPI
[       OK ] FlutterWindowTest.OnCursorRectUpdatedHighDPI (0 ms)
[ RUN      ] FlutterWindowTest.OnPointerStarSendsDeviceType
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.OnPointerStarSendsDeviceType (56 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerDown
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerDown (6 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerMove
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerMove (5 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerUp
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerUp (14 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerLeave
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerLeave (8 ms)
[ RUN      ] FlutterWindowTest.OnStylusPointerHover
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusPointerHover (9 ms)
[ RUN      ] FlutterWindowTest.OnStylusHoverAfterPointerUp
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusHoverAfterPointerUp (12 ms)
[ RUN      ] FlutterWindowTest.OnStylusBarrelButtonUsesPenFlags
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusBarrelButtonUsesPenFlags (6 ms)
[ RUN      ] FlutterWindowTest.OnStylusEraserButtonUsesPenFlags
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusEraserButtonUsesPenFlags (6 ms)
[ RUN      ] FlutterWindowTest.OnInvertedStylusPointerDownUsesDeviceKind
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnInvertedStylusPointerDownUsesDeviceKind (6 ms)
[ RUN      ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithUpdatedButtons
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithUpdatedButtons (13 ms)
[ RUN      ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithReleasedButton
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnStylusBarrelButtonUpdateMovesWithReleasedButton (10 ms)
[ RUN      ] FlutterWindowTest.OnMousePointerDown
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnMousePointerDown (4 ms)
[ RUN      ] FlutterWindowTest.OnTouchPointerDown
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed

GMOCK WARNING:
Uninteresting mock function call - returning directly.
    Function call: OnWindowStateEvent(4-byte object <00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect-useoncall for details.
[       OK ] FlutterWindowTest.OnTouchPointerDown (6 ms)
[ RUN      ] FlutterWindowTest.PointerMessageScreenCoordinatesAreConvertedToClient
[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(182)] CoCreateInstance(CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER, IID_IDirectManipulationManager, &manager_) failed
[       OK ] FlutterWindowTest.PointerMessageScreenCoordinatesAreConvertedToClient (5 ms)
[ RUN      ] FlutterWindowTest.OnScrollCallsGetScrollOffsetMultiplier
[       OK ] FlutterWindowTest.OnScrollCallsGetScrollOffsetMultiplier (0 ms)
[ RUN      ] FlutterWindowTest.OnWindowRepaint
[       OK ] FlutterWindowTest.OnWindowRepaint (0 ms)
[ RUN      ] FlutterWindowTest.OnThemeChange
[       OK ] FlutterWindowTest.OnThemeChange (0 ms)
[ RUN      ] FlutterWindowTest.AccessibilityNodeWithoutView
[       OK ] FlutterWindowTest.AccessibilityNodeWithoutView (0 ms)
[ RUN      ] FlutterWindowTest.AlertNode
[       OK ] FlutterWindowTest.AlertNode (59 ms)
[ RUN      ] FlutterWindowTest.LifecycleFocusMessages
[       OK ] FlutterWindowTest.LifecycleFocusMessages (0 ms)
[ RUN      ] FlutterWindowTest.CachedLifecycleMessage
[       OK ] FlutterWindowTest.CachedLifecycleMessage (0 ms)
[----------] 26 tests from FlutterWindowTest (478 ms total)

[----------] Global test environment tear-down
[==========] 26 tests from 1 test suite ran. (479 ms total)
[  PASSED  ] 26 tests.
```
</p>
</details> 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
pull Bot pushed a commit to edisplay/flutter that referenced this pull request Jul 1, 2026
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

This is my continuation of effort to improve stylus support in flutter.
On linux flutter can detect stylus input type, but have missing
information like rotation and pressure. In this pr, I add these.
<img width="2055" height="1287" alt="image"
src="https://github.com/user-attachments/assets/a5b6d83d-a2cd-40d6-9eb8-ca5580318f38"
/>
Tested on Fedora Linux 44, KDE Plasma with Wayland with an Wacom Stylus
(same as in the windows stylus support pr)
(orientation isn't supported by my stylus, i tested it on other apps so
maybe anyone other can test it).
Tested this pr on my flutter input demo:
https://github.com/CodeDoctorDE/flutter-input-demo/tree/ad61c7d6f5011594a90cbb2b9840904144f877b5
(need to run flutter create . --platforms linux).

Related issue: flutter#63209
My previous windows stylus support pr:
flutter#165323
+ the windows stylus button support pr:
flutter#183369.

This pr now adds pressure and tilt information and stylus button support
on linux.

**This work is based on the windows stylus button support pr which adds
inverted stylus to the embedder**

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Robert Ancell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically team-windows Owned by the Windows platform team

Projects

Development

Successfully merging this pull request may close these issues.

Flutter on Windows ignores stylus input

8 participants