Sitelet https://github.com/flutter/flutter/issues/189583
Skip to content

[Windows] Multi-window: buttons stop working when dragging a click from a window to another one #189583

Description

@kevindespoulains-bc

Steps to reproduce

This issue seems to have been introduced by this commit : #187629
I tried on the previous commit and everything was working fine.

  1. Use the master Flutter channel on Windows
  2. Run the flutter config --enable-windowing command to enable windowing
  3. Launch the app from the code sample below (flutter run -d windows)
  4. Like in the following video, open 2 other windows using the main screen button
  5. Press down the left mouse button on the first child window
  6. While keeping the mouse button down, switch the focused window using Alt+tab
  7. Hover or release the left mouse button on one of the buttons of the new focused window
  8. The button where the click is released doesn't work anymore

Expected results

When moving from a window to another one while keeping the left mouse button pressed, the press should be dismissed when leaving the window and ignored by the new window.

Actual results

When releasing the mouse button that was pressed on one window above a button of another window, the button do not receive the press events anymore and appear pressed (like in the video).

Code sample

The code used in the video :

Code sample
// ignore_for_file: implementation_imports, invalid_use_of_internal_member

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/_window.dart' as fw;

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runWidget(const MultiWindowApp());
}

class MultiWindowApp extends StatefulWidget {
  const MultiWindowApp({super.key});

  @override
  State<MultiWindowApp> createState() => _MultiWindowAppState();
}

class _MultiWindowAppState extends State<MultiWindowApp> {
  final fw.RegularWindowController _controller = fw.RegularWindowController(
    size: const Size(800, 600),
    title: 'Main window',
    delegate: _MainWindowDelegate(),
  );

  @override
  Widget build(BuildContext context) {
    return fw.RegularWindow(
      controller: _controller,
      child: const MaterialApp(home: MainWindow()),
    );
  }
}

class MainWindow extends StatelessWidget {
  const MainWindow({super.key});

  @override
  Widget build(BuildContext context) {
    final registry = fw.WindowRegistry.of(context);

    return Scaffold(
      body: Center(
        child: FilledButton(
          onPressed: () => openChildWindow(registry),
          child: const Text('Open child window'),
        ),
      ),
    );
  }
}

void openChildWindow(fw.WindowRegistry registry) {
  late final fw.WindowEntry entry;
  final controller = fw.RegularWindowController(
    size: const Size(520, 360),
    title: 'Child window',
    delegate: _ChildWindowDelegate(
      onDestroyed: () => registry.unregister(entry),
    ),
  );

  entry = fw.WindowEntry(
    controller: controller,
    builder: (_) => const MaterialApp(home: ChildWindow()),
  );

  registry.register(entry);
}

class ChildWindow extends StatefulWidget {
  const ChildWindow({super.key});

  @override
  State<ChildWindow> createState() => _ChildWindowState();
}

class _ChildWindowState extends State<ChildWindow> {
  static const colors = [
    Color(0xFFE8F0FF),
    Color(0xFFFFE8E8),
  ];

  Color color = colors[0];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: color,
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          spacing: 4,
          children: [
            ElevatedButton(
              onPressed: () {
                setState(() {
                  color = colors.firstWhere((c) => c != color);
                });
              },
              child: const Text('Change color'),
            ),
            ElevatedButton(
              onPressed: () {
                setState(() {
                  color = colors.firstWhere((c) => c != color);
                });
              },
              child: const Text('Change color'),
            ),
          ],
        ),
      ),
    );
  }
}

class _MainWindowDelegate with fw.RegularWindowControllerDelegate {
  @override
  void onWindowDestroyed() {
    exit(0);
  }
}

class _ChildWindowDelegate with fw.RegularWindowControllerDelegate {
  const _ChildWindowDelegate({required this.onDestroyed});

  final VoidCallback onDestroyed;

  @override
  void onWindowDestroyed() {
    onDestroyed();
  }
}

Screenshots or Video

Screenshots / Video demonstration
2026-07-16.14-14-44.mp4

Logs

Logs
Running the app with the `--verbose` flag does not show specific logs when the bug occurs.

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 3.47.0-1.0.pre-98, on Microsoft Windows [version 10.0.19045.6937], locale fr-FR)
[√] Windows Version (10 Famille 64 bits, 22H2, 2009)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: [https://developer.android.com/studio/index.html](https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.android.com%2Fstudio%2Findex.html&data=05%7C02%7Ck.despoulains%40betclicgroup.com%7C92e899b336f5496a86a708dee33cbe7c%7C349cb0f5cf5b4f4c89f1e13af5555b16%7C0%7C0%7C639198047214544654%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=nkI%2FTW4EIgyp2PwtOfjsy0QPCd%2Bq1jHK%2B7oaCqU3AUg%3D&reserved=0)
      On first launch it will assist you in installing the Android SDK components.
      (or visit [https://flutter.dev/to/windows-android-setup](https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fflutter.dev%2Fto%2Fwindows-android-setup&data=05%7C02%7Ck.despoulains%40betclicgroup.com%7C92e899b336f5496a86a708dee33cbe7c%7C349cb0f5cf5b4f4c89f1e13af5555b16%7C0%7C0%7C639198047214584947%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Pd0TYc0zdlxFgRnHHFrrP%2BH1CF2ByQU15gIeybSn2VM%3D&reserved=0) for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2026 18.8.0)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: desktopRunning on desktopa: multi windowIssues related to multi window supporthas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions