alexmercerind / flutter_acrylic

Flutter library for window acrylic, mica & transparency effects.
MIT License
595 stars 53 forks source link

Mica does not react to window blurring when title bar is hidden #42

Closed beta closed 1 year ago

beta commented 1 year ago

Hi, I'm using flutter_acrylic together with window_manager. My main() function writes as shown below.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Window.initialize();

  await windowManager.ensureInitialized();
  const windowOptions = WindowOptions(
    title: _appName,
    size: Size(800, 600),
    center: true,
    // titleBarStyle: TitleBarStyle.hidden, // <- this line is the case
  );
  await windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  });

  runApp(const GalleryApp());
}

And in my app widget's initState():

  @override
  void initState() {
    super.initState();

    Window.setEffect(
      effect: WindowEffect.mica,
      dark: FluffApp.dark,
    );
  }

With titleBarStyle: TitleBarStyle.normal (the default value), mica works perfectly and turns solid properly when the window is blurred (losing focus).

However after I set titleBarStyle: TitleBarStyle.hidden, the mica background does not react to focus changes any more.

Please help to look into this problem, and let me know if I'm doing anything wrong. Thanks in advance.

beta commented 1 year ago

Environment: Flutter 3.3.8 (Channel stable) and Windows 11 22H2 (22621.819)

alexmercerind commented 1 year ago

I can't say anything unfortunately without getting into depth. I will still suspect package:window_manager. Window behaviour is closely tied with native Win32 calls.

beta commented 1 year ago

Tested with bitsdojo_window and the background is working correctly. I will close this issue and dig into the code of window_manager to see why.