mynameiskenlee / flutter_macos_menubar_example

starter template for building macOS menubar app with flutter and AppKit
https://www.reddit.com/r/FlutterDev/comments/g7aavn/creating_a_menubar_app_for_macos/
128 stars 15 forks source link

Mouse move could not be detected #2

Closed Yesterday17 closed 1 year ago

Yesterday17 commented 1 year ago

I'm trying to migrate my app to a menubar application for macOS. But it seems that all mouse move events were not passed to my app correctly. But click works well.

https://user-images.githubusercontent.com/8667822/199682986-f18c8657-ea84-472d-a0cf-b614789c06f1.mp4

In the video, all the ripples effects were produced by click. And as the list scrolls, the effect is pointing to the wrong position.

Yesterday17 commented 1 year ago

Also, I fount the hover event works well when the mouse moves into the app (onEnter). But moving inside the app would not trigger hover events.

mynameiskenlee commented 1 year ago

Hi, Thanks for raising the issue, I tired to recreate the issue with a list view but I cannot recreate it, it work just fine for me. Would you mind to share the code so I can try to recreate and try to solve the issue? Thank you

My environment: MacBook Pro 2018 15 inch (macOS 13 Ventura) with flutter 3.3.2

https://user-images.githubusercontent.com/38970885/199703477-e2b2fbf3-bbf8-4539-ae61-57221ec45d00.mov

Yesterday17 commented 1 year ago

What about clicking outside the app to hide it and show the popup window again? I found it sometimes works if I only click the icon to hide the window.

And if the window is not closed(window.close() not called), the hover works only if the window is in foreground. So i guess it's an issue about window focus?

Yesterday17 commented 1 year ago

https://user-images.githubusercontent.com/8667822/199713636-58862e53-96ad-448d-9cfc-0fffb0c7e534.mp4

My environment:

mynameiskenlee commented 1 year ago

What about clicking outside the app to hide it and show the popup window again? I found it sometimes works if I only click the icon to hide the window.

It works fine for me

And if the window is not closed(window.close() not called), the hover works only if the window is in foreground. So i guess it's an issue about window focus?

Maybe, because the original window and the popup window shares the same FlutterViewController. I did this in order not to modify the flutter base code. (There is an opening issue flutter/flutter#23600 to bring native support for flutter widget in macOS menu bar)

It is still strange to me because I cannot recreate the same issue at all.

https://user-images.githubusercontent.com/38970885/199719061-5608f70e-e725-4835-aa87-4c12990728a9.mov

Yesterday17 commented 1 year ago

I can reproduce with this repo directly. I guess it's a bug of macOS. I may try to upgrade it to 13 later and test whether the problem can still be reproduced.

mynameiskenlee commented 1 year ago

I think the problem may not be in the macOS side as I developed this on macOS 12 and haven't updated the code after that.

I will try to switch flutter from stable channel to master channel to see if I can recreate the isuue.

mynameiskenlee commented 1 year ago

I think the problem may not be in the macOS side as I developed this on macOS 12 and haven't updated the code after that.

I will try to switch flutter from stable channel to master channel to see if I can recreate the isuue.

I have just tried with 3.5.0-12.0.pre.94, it works same as before, may I have your UI code so I can try to recreate this issue?

Yesterday17 commented 1 year ago

I can reproduce the same issue with the example code in this repository. Here're the steps:

  1. flutter run
  2. Click icon in status bar
  3. Hover on the FAB. It's working now. image
  4. Click outside the window to hide the popup ui.
  5. Redo step 2 to show the window
  6. Hover effect is not working now. image
mynameiskenlee commented 1 year ago

Seems like this is similar to #1 , looks like the issue not only occur in Apple Silicon Mac ,but also the intel one. I will try to find a way to recreate the issue (I just pull code from Github and try the above steps, it still works fine for me) and look for a way to solve that. Meanwhile, if you find out a way to solve the issue, please do feel free to submit a pull request. Thanks a lot🙏.

Yesterday17 commented 1 year ago

I've upgrade macOS to 13.0 and everything seems working well now. Seems to be a OS problem(no idea)?

mynameiskenlee commented 1 year ago

Glad to hear that it works after upgrading the macOS, I will just close this issue now and leave #1 open as they are similar issues.

Please do let me know if there is any other issue, thanks a lot.