Repository: flutter
Issue: Flutter on Windows ignores stylus input
Labels: engine,platform-windows,P2,team-engine,triaged-engine

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->
I was looking into building a Flutter app that uses stylus input, but I quickly ran into an issue with the current Flutter engine on Windows. It appears that stylus input is completely ignored, so the Flutter application does not receive any input events for such devices. After downloading the source code for the engine, I was able to track down the file responsible:

[engine\shell\platform\windows\window_win32.cc](https://github.com/flutter/engine/blob/main/shell/platform/windows/window_win32.cc)

On several lines, the code calls "GetFlutterPointerDeviceKind" (which is capable of detecting stylus/pen devices), but the code appears to ignore any device that is not a mouse (see lines 345, 357, 385, and 411). Some examples are shown below.
```c++
...
    case WM_MOUSEMOVE:
      device_kind = GetFlutterPointerDeviceKind();
      if (device_kind == kFlutterPointerDeviceKindMouse) {
        TrackMouseLeaveEvent(window_handle_);
...
    case WM_LBUTTONUP:
    case WM_RBUTTONUP:
    case WM_MBUTTONUP:
    case WM_XBUTTONUP:
      device_kind = GetFlutterPointerDeviceKind();
      if (device_kind != kFlutterPointerDeviceKindMouse) {
        break;
      }
...
```
By commenting out some of these checks, I was able to confirm that the Windows engine is fully capable of receiving stylus input. Following the steps below with the modified engine shows the expected result. However, it is unclear why these checks were added in the first place, so simply removing them may not be the best solution. That file should at least be a good starting place for developing a fix.

## Steps to Reproduce
<!-- Please include full steps to reproduce so that we can reproduce the problem. -->
Note: Reproducing this issue requires a Windows device with a touch screen and stylus support. I am using a Lenovo Flex 5.

1. Execute `flutter run` on the code sample (must be run on a Windows device) <!-- (see "Code sample" section below) -->
2. Click on the blue container with a mouse
3. Tap on the blue container using the touchscreen
4. Tap on the blue container using a stylus

**Expected results:** <!-- what did you want to see? -->
The message in the container updates after each interaction to display the device used. In other words, it detects mouse, touch, and stylus events.
**Actual results:** <!-- what did you see? -->
Mouse and touch events are detected, but the stylus is ignored.

<details>
<summary>Code sample</summary>

<!--
      Please create a minimal reproducible sample that shows the problem
      and attach it below between the lines with the backticks.

      To create it you can use `flutter create bug` command and update the `main.dart` file.

      Alternatively, you can use https://dartpad.dev/
      which is capable of creating and running small Flutter apps.

      Without this we will unlikely be able to progress on the issue, and because of that
      we regretfully will have to close it.
-->

```dart
import 'dart:ui';

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _HomePageState();
}

class _HomePageState extends State<MyHomePage> {
  String _lastDevice = "None";

  void _updateDevice(PointerDeviceKind deviceKind) {
    setState(() {
      _lastDevice = deviceKind.toString();
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Listener(
          onPointerDown: (event) => _updateDevice(event.kind),
          child: Container(
            width: 300,
            height: 150,
            color: Colors.blue,
            alignment: Alignment.center,
            child: Text(
              "Last device:\n$_lastDevice",
              textAlign: TextAlign.center,
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->
flutter run --verbose
```
[  +74 ms] executing: [C:\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +84 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] faab7f81ea277e118c7d5e9d542310b5351a3453
[   +1 ms] executing: [C:\flutter/] git tag --points-at faab7f81ea277e118c7d5e9d542310b5351a3453
[ +170 ms] Exit code 0 from: git tag --points-at faab7f81ea277e118c7d5e9d542310b5351a3453
[   +2 ms] executing: [C:\flutter/] git describe --match *.*.* --long --tags faab7f81ea277e118c7d5e9d542310b5351a3453
[ +133 ms] Exit code 0 from: git describe --match *.*.* --long --tags faab7f81ea277e118c7d5e9d542310b5351a3453
[        ] 2.12.0-4.0.pre-790-gfaab7f81ea
[  +53 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref --symbolic @{upstream}
[  +58 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ] origin/master
[        ] executing: [C:\flutter/] git ls-remote --get-url origin
[  +51 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +78 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref HEAD
[  +73 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] master
[  +74 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +53 ms] executing: C:\Users\natha\AppData\Local\Android\Sdk\platform-tools\adb.exe devices -l
[  +70 ms] List of devices attached
[   +8 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +4 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +70 ms] Multiple devices found:
[  +78 ms] Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.1645]
[   +1 ms] Chrome (web)      • chrome  • web-javascript • Google Chrome 100.0.4896.88
[        ] Edge (web)        • edge    • web-javascript • Microsoft Edge 96.0.1054.53
[   +1 ms] [1]: Windows (windows)
[        ] [2]: Chrome (chrome)
[        ] [3]: Edge (edge)
[   +2 ms] Please choose one (To quit, press "q/Q")
[        ] : 
[+13024 ms] 1
[  +16 ms] Skipping pub get: version match.
[  +98 ms] Generating C:\Users\natha\Repositories\stylus_issue\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +77 ms] Initializing file store
[  +10 ms] Skipping target: gen_localizations
[   +5 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents:
C:\Users\natha\Repositories\stylus_issue\.dart_tool\package_config_subset}
[  +26 ms] gen_dart_plugin_registrant: Complete
[   +2 ms] Skipping target: _composite
[   +2 ms] complete
[   +5 ms] Launching lib\main.dart on Windows in debug mode...
[   +5 ms] C:\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\flutter\bin\cache\dart-sdk\bin\snapshots\frontend_server.dart.snapshot --sdk-root
C:\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names --experimental-emit-debug-metadata
-DFLUTTER_WEB_AUTO_DETECT=true --output-dill C:\Users\natha\AppData\Local\Temp\flutter_tools.96ec1ae2\flutter_tool.ac831377\app.dill --packages
C:\Users\natha\Repositories\stylus_issue\.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme
org-dartlang-root --initialize-from-dill build\c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --flutter-widget-cache --enable-experiment=alternative-invalidation-strategy
[  +17 ms] executing: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -format json -products * -utf8 -latest -version 16 -requires
Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.CMake.Project
[  +52 ms] Exit code 0 from: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -format json -products * -utf8 -latest -version 16 -requires
Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.CMake.Project
[   +3 ms] [
             {
               "instanceId": "5c19e2a3",
               "installDate": "2022-04-28T16:54:38Z",
               "installationName": "VisualStudio/16.11.13+32413.511",
               "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community",
               "installationVersion": "16.11.32413.511",
               "productId": "Microsoft.VisualStudio.Product.Community",
               "productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.exe",
               "state": 4294967295,
               "isComplete": true,
               "isLaunchable": true,
               "isPrerelease": false,
               "isRebootRequired": false,
               "displayName": "Visual Studio Community 2019",
               "description": "Powerful IDE, free for students, open-source contributors, and individuals",
               "channelId": "VisualStudio.16.Release",
               "channelUri": "https://aka.ms/vs/16/release/channel",
               "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
               "releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-v16.11#16.11.13",
               "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909",
               "updateDate": "2022-04-28T16:54:38.4237093Z",
               "catalog": {
                 "buildBranch": "d16.11",
                 "buildVersion": "16.11.32413.511",
                 "id": "VisualStudio/16.11.13+32413.511",
                 "localBuild": "build-lab",
                 "manifestName": "VisualStudio",
                 "manifestType": "installer",
                 "productDisplayVersion": "16.11.13",
                 "productLine": "Dev16",
                 "productLineVersion": "2019",
                 "productMilestone": "RTW",
                 "productMilestoneIsPreRelease": "False",
                 "productName": "Visual Studio",
                 "productPatchVersion": "13",
                 "productPreReleaseMilestoneSuffix": "1.0",
                 "productSemanticVersion": "16.11.13+32413.511",
                 "requiredEngineVersion": "2.11.69.53063"
               },
               "properties": {
                 "campaignId": "618340097.1636419722",
                 "channelManifestId": "VisualStudio.16.Release/16.11.13+32413.511",
                 "nickname": "",
                 "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
               }
             }
           ]
[   +3 ms] Building Windows application...
[  +18 ms] <- compile package:stylus_issue/main.dart
[   +2 ms] executing: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -S
C:\Users\natha\Repositories\stylus_issue\windows -B build\windows -G Visual Studio 16 2019
[  +90 ms] -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
[  +41 ms] -- Configuring done
[  +73 ms] -- Generating done
[  +22 ms] -- Build files have been written to: C:/Users/natha/Repositories/stylus_issue/build/windows
[   +8 ms] executing: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe --build build\windows --config
Debug --target INSTALL --verbose
[ +185 ms] Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
[        ] Copyright (C) Microsoft Corporation. All rights reserved.
[  +45 ms] Build started 4/29/2022 11:49:25 AM.
[ +250 ms] Project "C:\Users\natha\Repositories\stylus_issue\build\windows\INSTALL.vcxproj" on node 1 (default targets).
[        ] Project "C:\Users\natha\Repositories\stylus_issue\build\windows\INSTALL.vcxproj" (1) is building "C:\Users\natha\Repositories\stylus_issue\build\windows\ZERO_CHECK.vcxproj"
(2) on node 1 (default targets).
[   +1 ms] InitializeBuildStatus:
[        ]   Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[  +29 ms] CustomBuild:
[        ]   All outputs are up-to-date.
[  +90 ms]   Checking Build System
[  +74 ms] FinalizeBuildStatus:
[        ]   Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
[        ] Done Building Project "C:\Users\natha\Repositories\stylus_issue\build\windows\ZERO_CHECK.vcxproj" (default targets).
[ +113 ms] Project "C:\Users\natha\Repositories\stylus_issue\build\windows\INSTALL.vcxproj" (1) is building "C:\Users\natha\Repositories\stylus_issue\build\windows\ALL_BUILD.vcxproj"
(3) on node 1 (default targets).
[   +1 ms] Project "C:\Users\natha\Repositories\stylus_issue\build\windows\ALL_BUILD.vcxproj" (3) is building
"C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\flutter_wrapper_app.vcxproj" (4) on node 1 (default targets).
[        ] Project "C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\flutter_wrapper_app.vcxproj" (4) is building
"C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\flutter_assemble.vcxproj" (5) on node 1 (default targets).
[        ] InitializeBuildStatus:
[        ]   Creating "x64\Debug\flutter_assemble\flutter_assemble.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[   +3 ms] CustomBuild:
[        ]   "The build of 'C:\Users\natha\Repositories\stylus_issue\build\windows\CMakeFiles\c4d84a1e43f4a76034a7151987f087df\flutter_assemble.rule' depends on
'C:\USERS\NATHA\REPOSITORIES\STYLUS_ISSUE\WINDOWS\FLUTTER\EPHEMERAL\FLUTTER_WINDOWS.DLL' which is produced by the build of
'C:\Users\natha\Repositories\stylus_issue\build\windows\CMakeFiles\21eb297a3b4229270c640f196f8df99c\flutter_windows.dll.rule'. The items cannot be built in parallel."
[  +66 ms]   Generating C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/flutter_windows.dll,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/flutter_export.h, C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/flutter_windows.h,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/flutter_messenger.h, C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/flutter_plugin_registrar.h,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/flutter_texture_registrar.h,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/cpp_client_wrapper/core_implementations.cc,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/cpp_client_wrapper/standard_codec.cc,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/cpp_client_wrapper/plugin_registrar.cc,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/cpp_client_wrapper/flutter_engine.cc,
C:/Users/natha/Repositories/stylus_issue/windows/flutter/ephemeral/cpp_client_wrapper/flutter_view_controller.cc, _phony_
[ +915 ms]   [  +55 ms] executing: [C:\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +75 ms]   [  +97 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ]   [        ] faab7f81ea277e118c7d5e9d542310b5351a3453
[        ]   [        ] executing: [C:\flutter/] git tag --points-at faab7f81ea277e118c7d5e9d542310b5351a3453
[  +73 ms]   [  +73 ms] Exit code 0 from: git tag --points-at faab7f81ea277e118c7d5e9d542310b5351a3453
[   +1 ms]   [   +1 ms] executing: [C:\flutter/] git describe --match *.*.* --long --tags faab7f81ea277e118c7d5e9d542310b5351a3453
[ +109 ms]   [ +108 ms] Exit code 0 from: git describe --match *.*.* --long --tags faab7f81ea277e118c7d5e9d542310b5351a3453
[        ]   [        ] 2.12.0-4.0.pre-790-gfaab7f81ea
[  +57 ms]   [  +58 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref HEAD
[  +65 ms]   [  +64 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ]   [        ] master
[  +59 ms]   [  +60 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms]   [   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +76 ms]   [  +77 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref --symbolic @{upstream}
[  +55 ms]   [  +55 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ]   [        ] origin/master
[        ]   [        ] executing: [C:\flutter/] git ls-remote --get-url origin
[  +52 ms]   [  +52 ms] Exit code 0 from: git ls-remote --get-url origin
[        ]   [        ] https://github.com/flutter/flutter.git
[        ]   [        ] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ]   [   +2 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[   +6 ms]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +27 ms]   [  +36 ms] Initializing file store
[  +13 ms]   [  +13 ms] Done initializing file store
[  +41 ms]   [  +41 ms] Skipping target: gen_localizations
[  +13 ms]   [  +13 ms] Skipping target: gen_dart_plugin_registrant
[+2677 ms]   [+2677 ms] Skipping target: unpack_windows
[ +451 ms]   [ +451 ms] Skipping target: kernel_snapshot
[ +276 ms]   [ +276 ms] Skipping target: debug_bundle_windows_assets
[   +1 ms]   [        ] Persisting file store
[   +7 ms]   [   +8 ms] Done persisting file store
[   +4 ms]   [   +4 ms] build succeeded.
[   +8 ms]   [   +8 ms] "flutter assemble" took 3,732ms.
[ +163 ms]   [ +163 ms] ensureAnalyticsSent: 159ms
[   +2 ms]   [   +1 ms] Running shutdown hooks
[        ]   [        ] Shutdown hooks complete
[        ]   [        ] exiting with code 0
[  +64 ms] FinalizeBuildStatus:
[        ]   Deleting file "x64\Debug\flutter_assemble\flutter_assemble.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\flutter_assemble\flutter_assemble.tlog\flutter_assemble.lastbuildstate".
[        ] Done Building Project "C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\flutter_assemble.vcxproj" (default targets).
[   +5 ms] InitializeBuildStatus:
[        ]   Creating "flutter_wrapper_app.dir\Debug\flutter_.F7126AD4.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[   +1 ms] CustomBuild:
[        ]   All outputs are up-to-date.
[  +48 ms] ClCompile:
[        ]   All outputs are up-to-date.
[  +26 ms] Lib:
[   +1 ms]   All outputs are up-to-date.
[        ]   flutter_wrapper_app.vcxproj -> C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\Debug\flutter_wrapper_app.lib
[   +7 ms] FinalizeBuildStatus:
[        ]   Deleting file "flutter_wrapper_app.dir\Debug\flutter_.F7126AD4.tlog\unsuccessfulbuild".
[        ]   Touching "flutter_wrapper_app.dir\Debug\flutter_.F7126AD4.tlog\flutter_wrapper_app.lastbuildstate".
[        ] Done Building Project "C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\flutter_wrapper_app.vcxproj" (default targets).
[  +27 ms] Project "C:\Users\natha\Repositories\stylus_issue\build\windows\ALL_BUILD.vcxproj" (3) is building
"C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\flutter_wrapper_plugin.vcxproj" (6) on node 1 (default targets).
[   +1 ms] InitializeBuildStatus:
[        ]   Creating "flutter_wrapper_plugin.dir\Debug\flutter_.FFD6BF67.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[        ] CustomBuild:
[        ]   All outputs are up-to-date.
[   +7 ms] ClCompile:
[        ]   All outputs are up-to-date.
[   +5 ms] Lib:
[        ]   All outputs are up-to-date.
[        ]   flutter_wrapper_plugin.vcxproj -> C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\Debug\flutter_wrapper_plugin.lib
[   +4 ms] FinalizeBuildStatus:
[        ]   Deleting file "flutter_wrapper_plugin.dir\Debug\flutter_.FFD6BF67.tlog\unsuccessfulbuild".
[   +1 ms]   Touching "flutter_wrapper_plugin.dir\Debug\flutter_.FFD6BF67.tlog\flutter_wrapper_plugin.lastbuildstate".
[   +1 ms] Done Building Project "C:\Users\natha\Repositories\stylus_issue\build\windows\flutter\flutter_wrapper_plugin.vcxproj" (default targets).
[  +25 ms] Project "C:\Users\natha\Repositories\stylus_issue\build\windows\ALL_BUILD.vcxproj" (3) is building
"C:\Users\natha\Repositories\stylus_issue\build\windows\runner\stylus_issue.vcxproj" (7) on node 1 (default targets).
[   +1 ms] InitializeBuildStatus:
[        ]   Creating "stylus_issue.dir\Debug\stylus_issue.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[        ] CustomBuild:
[        ]   All outputs are up-to-date.
[  +24 ms] ClCompile:
[   +1 ms]   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\CL.exe /c /IC:\Users\natha\Repositories\stylus_issue\windows
/IC:\Users\natha\Repositories\stylus_issue\windows\flutter\ephemeral /IC:\Users\natha\Repositories\stylus_issue\windows\flutter\ephemeral\cpp_client_wrapper\include /Zi /nologo /W4 /WX
/diagnostics:column /Od /Ob0 /D WIN32 /D _WINDOWS /D _HAS_EXCEPTIONS=0 /D _DEBUG /D NOMINMAX /D UNICODE /D _UNICODE /D "CMAKE_INTDIR=\"Debug\"" /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1
/MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /std:c++17 /Fo"stylus_issue.dir\Debug\\" /Fd"stylus_issue.dir\Debug\vc142.pdb" /external:W4 /Gd /TP /wd4100
/errorReport:queue C:\Users\natha\Repositories\stylus_issue\windows\flutter\generated_plugin_registrant.cc C:\Users\natha\Repositories\stylus_issue\windows\runner\flutter_window.cpp
[  +92 ms]   generated_plugin_registrant.cc
[ +433 ms]   flutter_window.cpp
[ +644 ms]   Generating Code...
[  +89 ms] ResourceCompile:
[   +1 ms]   All outputs are up-to-date.
[  +27 ms] Link:
[   +1 ms]   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE
/OUT:"C:\Users\natha\Repositories\stylus_issue\build\windows\runner\Debug\stylus_issue.exe" /INCREMENTAL /ILK:"stylus_issue.dir\Debug\stylus_issue.ilk" /NOLOGO
..\flutter\Debug\flutter_wrapper_app.lib C:\Users\natha\Repositories\stylus_issue\windows\flutter\ephemeral\flutter_windows.dll.lib kernel32.lib user32.lib gdi32.lib winspool.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed
/manifestinput:C:\Users\natha\Repositories\stylus_issue\windows\runner\runner.exe.manifest /DEBUG
/PDB:"C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/stylus_issue.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT
/IMPLIB:"C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/stylus_issue.lib" /MACHINE:X64  /machine:x64 stylus_issue.dir\Debug\Runner.res
[   +1 ms]   stylus_issue.dir\Debug\flutter_window.obj
[        ]   stylus_issue.dir\Debug\main.obj
[        ]   stylus_issue.dir\Debug\utils.obj
[        ]   stylus_issue.dir\Debug\win32_window.obj
[        ]   stylus_issue.dir\Debug\generated_plugin_registrant.obj
[ +415 ms]   stylus_issue.vcxproj -> C:\Users\natha\Repositories\stylus_issue\build\windows\runner\Debug\stylus_issue.exe
[   +4 ms] FinalizeBuildStatus:
[        ]   Deleting file "stylus_issue.dir\Debug\stylus_issue.tlog\unsuccessfulbuild".
[        ]   Touching "stylus_issue.dir\Debug\stylus_issue.tlog\stylus_issue.lastbuildstate".
[        ] Done Building Project "C:\Users\natha\Repositories\stylus_issue\build\windows\runner\stylus_issue.vcxproj" (default targets).
[   +5 ms] InitializeBuildStatus:
[        ]   Creating "x64\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[   +3 ms] CustomBuild:
[        ]   All outputs are up-to-date.
[  +42 ms]   Building Custom Rule C:/Users/natha/Repositories/stylus_issue/windows/CMakeLists.txt
[  +40 ms] FinalizeBuildStatus:
[   +1 ms]   Deleting file "x64\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\ALL_BUILD\ALL_BUILD.tlog\ALL_BUILD.lastbuildstate".
[        ] Done Building Project "C:\Users\natha\Repositories\stylus_issue\build\windows\ALL_BUILD.vcxproj" (default targets).
[   +6 ms] InitializeBuildStatus:
[        ]   Creating "x64\Debug\INSTALL\INSTALL.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[  +60 ms] PostBuildEvent:
[        ]   setlocal
[        ]   "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake
[        ]   if %errorlevel% neq 0 goto :cmEnd
[        ]   :cmEnd
[        ]   endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
[        ]   :cmErrorLevel
[        ]   exit /b %1
[        ]   :cmDone
[        ]   if %errorlevel% neq 0 goto :VCEnd
[        ]   :VCEnd
[  +42 ms]   -- Install configuration: "Debug"
[   +1 ms]   -- Up-to-date: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/icudtl.dat
[        ]   -- Up-to-date: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/flutter_windows.dll
[   +3 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets
[        ]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/AssetManifest.json
[   +1 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/FontManifest.json
[   +1 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/fonts
[        ]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/fonts/MaterialIcons-Regular.otf
[   +3 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/kernel_blob.bin
[ +108 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/NOTICES.Z
[   +1 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/packages
[        ]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/packages/cupertino_icons
[   +1 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/packages/cupertino_icons/assets
[   +1 ms]   -- Installing: C:/Users/natha/Repositories/stylus_issue/build/windows/runner/Debug/data/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf
[  +12 ms] FinalizeBuildStatus:
[        ]   Deleting file "x64\Debug\INSTALL\INSTALL.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\INSTALL\INSTALL.tlog\INSTALL.lastbuildstate".
[        ] Done Building Project "C:\Users\natha\Repositories\stylus_issue\build\windows\INSTALL.vcxproj" (default targets).
[        ] Build succeeded.
[        ]     0 Warning(s)
[        ]     0 Error(s)
[        ] Time Elapsed 00:00:08.22
[  +23 ms] Building Windows application... (completed in 8.7s)
[ +181 ms] Observatory URL on device: http://127.0.0.1:56506/54h2Wg-fEfM=/
[   +3 ms] Caching compiled dill
[  +33 ms] Connecting to service protocol: http://127.0.0.1:56506/54h2Wg-fEfM=/
[ +128 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:56506/54h2Wg-fEfM=/.
[  +78 ms] DDS is listening at http://127.0.0.1:56509/0L3A7Ftpb5k=/.
[  +57 ms] Successfully connected to service protocol: http://127.0.0.1:56506/54h2Wg-fEfM=/
[  +17 ms] DevFS: Creating new filesystem on the device (null)
[  +16 ms] DevFS: Created new filesystem on the device (file:///C:/Users/natha/AppData/Local/Temp/stylus_issuedd2100e8/stylus_issue/)
[   +3 ms] Updating assets
[  +98 ms] Syncing files to device Windows...
[   +2 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[        ] Processing bundle.
[   +1 ms] <- recompile package:stylus_issue/main.dart adb223cf-633d-4eb7-ad44-a109d6908109
[        ] <- adb223cf-633d-4eb7-ad44-a109d6908109
[   +1 ms] Bundle processing done.
[  +83 ms] Updating files.
[   +1 ms] DevFS: Sync finished
[   +1 ms] Syncing files to device Windows... (completed in 90ms)
[        ] Synced 0.0MB.
[   +1 ms] <- accept
[   +2 ms] Connected to _flutterView/0x1559f140dc0.
[   +1 ms] Flutter run key commands.
[   +1 ms] r Hot reload. 
[        ] R Hot restart.
[        ] h List all available interactive commands.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ]  Running with sound null safety 
[        ] An Observatory debugger and profiler on Windows is available at: http://127.0.0.1:56509/0L3A7Ftpb5k=/
[ +139 ms] The Flutter DevTools debugger and profiler on Windows is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:56509/0L3A7Ftpb5k=/
[+7448 ms] Service protocol connection closed.
[        ] Lost connection to device.
[   +1 ms] DevFS: Deleting filesystem on the device (file:///C:/Users/natha/AppData/Local/Temp/stylus_issuedd2100e8/stylus_issue/)
[ +273 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[   +5 ms] "flutter run" took 31,005ms.
[ +103 ms] ensureAnalyticsSent: 101ms
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 0
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->
flutter analyze
```
Analyzing stylus_issue...
No issues found! (ran in 2.0s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->
flutter doctor -v
```
[√] Flutter (Channel master, 2.13.0-0.0.pre.790, on Microsoft Windows [Version 10.0.19044.1645], locale en-US)
    • Flutter version 2.13.0-0.0.pre.790 at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision faab7f81ea (2 days ago), 2022-04-27 22:06:28 -0400
    • Engine revision 80c04d70c0
    • Dart version 2.18.0 (build 2.18.0-65.0.dev)
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\natha\AppData\Local\Android\Sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.13)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.32413.511
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] IntelliJ IDEA Ultimate Edition (version 2021.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.3
    • Flutter plugin version 66.0.2
    • Dart plugin version 212.5744

[√] VS Code (version 1.66.2)
    • VS Code at C:\Users\natha\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.38.1

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.1645]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 100.0.4896.88
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 96.0.1054.53

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>


<details>
  <summary>Screenshots</summary>

### With current engine:
After clicking:
![image](https://user-images.githubusercontent.com/14063628/166013591-941be022-b45d-4eff-8a58-b4b743bde7b7.png)
After tapping with touchscreen:
![image](https://user-images.githubusercontent.com/14063628/166014364-497164e4-65e1-4043-ad34-6ecd1fff2ba8.png)
After tapping with stylus (no change):
![image](https://user-images.githubusercontent.com/14063628/166015618-85b46c69-7ddf-497a-bd92-2d9a75c6a26c.png)

### With device type checks commented out:
After clicking:
![image](https://user-images.githubusercontent.com/14063628/166025961-0494f7d9-bb38-4310-84df-b6fda6757de7.png)
After tapping with touchscreen:
![image](https://user-images.githubusercontent.com/14063628/166027019-805eb9e8-1090-4eda-9aab-93016c987f61.png)
After tapping with stylus:
![image](https://user-images.githubusercontent.com/14063628/166027976-ab09620e-e6b1-4bfe-9fb9-ea1fb7eb1a83.png)

</details>