bitsdojo_window icon indicating copy to clipboard operation
bitsdojo_window copied to clipboard

Lag for window button operations (close, maximize, minimize)

Open mathaou opened this issue 3 years ago • 12 comments
trafficstars

Flutter 3.1.0-0.0.pre.1887 (upgraded from 3.0.1 to see if latest master could help)

With a setup like this

final _windowButtons = [
  MinimizeWindowButton(
    animate: false,
    colors: WindowButtonColors(iconNormal: Colors.black),
  ),
  MaximizeWindowButton(
    animate: false,
    colors: WindowButtonColors(iconNormal: Colors.black),
  ),
  CloseWindowButton(
    animate: false,
    colors: WindowButtonColors(
        iconNormal: Colors.black,
        iconMouseDown: Colors.white,
        iconMouseOver: Colors.white,
        mouseDown: Colors.red,
        mouseOver: Colors.red),
  )
];

Using any of these operations (or calling the same functions from the window_manager plugin) has a pretty jarring delay before the operation completes. On the run-of-the-mill native app all of those are practically instantaneous, but profiling the code shows me that I'm spending close to 70ms getting a GestureDetector to service an action, and then pass that through some kind of ffi that needs bytestreams or some other binary blob to function. My gut feeling is that there isn't much that can be done to speed this up, but I thought I'd make an issue in case this is thoroughly a "me" problem and I'm just doing something wrong.

mathaou avatar Jul 27 '22 23:07 mathaou

I experienced a similar problem today, not sure if it's related. I put WindowButtons under a MoveWindow (which enables onDoubleTap) in a Stack. In Flutter, if onDoubleTap is enabled, onTap is delayed for some time (300ms?) to detect double tap. https://github.com/flutter/flutter/issues/110300

Stack(children: [
  Row(
    children: [
      Expanded(
          child: Tabbar()),
      const WindowButtons()
    ],
  ),
  MoveWindow(),
])

ngugcx avatar Aug 26 '22 09:08 ngugcx

MoveWind

Noticed the same exact thing

Auties00 avatar Aug 29 '22 21:08 Auties00

Thank you all for reporting. Will investigate.

bitsdojo avatar Aug 29 '22 23:08 bitsdojo

What OS are you using for testing?

bitsdojo avatar Aug 31 '22 19:08 bitsdojo

What OS are you using for testing?

I used Windows.

mathaou avatar Aug 31 '22 19:08 mathaou

yeah I experienced the same today, also on Windows OS btw double tapping the app bar is "instant" and tapping the buttons is with a slight delay, I will try and take the buttons out of the moveWindow widget for now

nickcuypers avatar Sep 13 '22 21:09 nickcuypers

yeah I experienced the same today, also on Windows OS btw double tapping the app bar is "instant" and tapping the buttons is with a slight delay, I will try and take the buttons out of the moveWindow widget for now

Just use the stack as previously explained by @ngugcx

Auties00 avatar Sep 14 '22 07:09 Auties00

yeah I experienced the same today, also on Windows OS btw double tapping the app bar is "instant" and tapping the buttons is with a slight delay, I will try and take the buttons out of the moveWindow widget for now

Just use the stack as previously explained by @ngugcx

yes was exactly what I did 👍

nickcuypers avatar Sep 14 '22 08:09 nickcuypers

is there any news or estimation on this issue? workaround aint perfect for my needs sadly

nickcuypers avatar Sep 20 '22 20:09 nickcuypers

I have the same issue, developed multiple apps and experienced it in all of them, any chance we're getting a fix anytime soon ?

actions: MoveWindow( child: Row( children: [ const Spacer(), MinimizeWindowButton( colors: buttonColors, ), MaximizeWindowButton( colors: buttonColors, ), CloseWindowButton( colors: buttonColorsExit, ) ], ), ),

asad-albadi avatar Oct 17 '22 07:10 asad-albadi

A simple solution is to put the three window buttons in the container, set the container color to transparent, and the colored container will intercept the onDoubleTap() of MoveWindow() below

shadowmelds avatar Jun 22 '23 15:06 shadowmelds

the issue is something related to MoveWindow() widget. when i added the MoveWindow() on top of the window buttons using Stack() it made them slow.

meltamagodan avatar Aug 25 '24 12:08 meltamagodan