Skip to content

[Windows Desktop] Mouse events at coordinates (0, 0) are captured when cursor leaves the window. #100213

@oddko

Description

@oddko

Weird issue on a Windows Desktop flutter app where a widget that covers the topleft pixel (0, 0) of the Window will receive hover events when the cursor leaves the window.

Steps to reproduce

Create a widget that supports mouse hover events on the top left of the Window, and leave the window anywhere (away from the widget). Said widget should receive a mouse hover event.
Example code:

runApp(
    Column(
      children: [
        Expanded(
          child: Container(
            color: Colors.red,
            child: MouseRegion(
              onHover: (event) {
                print('I capture events when the cursor leaves the window anywhere');
              },
            ),
          ),
        ),
        Expanded(
          child: Container(
            color: Colors.green,
            child: MouseRegion(
              onHover: (event) {
                print('I am fine');
              },
            ),
          ),
        ),
      ],
    ),
  );

Flutter doctor output:

[✓] Flutter (Channel stable, 2.10.3, on Microsoft Windows [version 10.0.19044.1586], locale fr-FR)
    • Flutter version 2.10.3 at C:\flutter
    • Upstream repository https://github.com/flutter/flutter
    • Framework revision 7e9793dee1 (2 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\jvannier\AppData\Local\Android\sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[✓] 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.7)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31911.196
    • Windows 10 SDK version 10.0.19041.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 Community Edition (version 2021.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3
    • Flutter plugin version 65.2.4
    • Dart plugin version 213.7227

[✓] VS Code (version 1.65.1)
    • VS Code at C:\Users\jvannier\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [version 10.0.19044.1586]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 97.0.4692.71
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 99.0.1150.39

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: mouseIssues related to using a mouse or mouse supportfound in release: 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions