Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable unfocused windows to update their status based on whether they are clickable or not #10229

Merged

Conversation

weartist
Copy link
Contributor

@weartist weartist commented Apr 6, 2024

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 6, 2024
@weartist weartist marked this pull request as draft April 6, 2024 09:46
…dow was inactive or the state was PopUp, but this restriction was removed and we would receive the Move event at all times to update the Hover Status UI
@weartist weartist force-pushed the show_hover_status_at_non_focused branch from 0a7e45e to 9bb4b18 Compare April 6, 2024 10:00
@weartist weartist marked this pull request as ready for review April 6, 2024 10:04
@maxdeviant maxdeviant changed the title Enables unfocused windows to update their status based on whether they are clickable or not Enable unfocused windows to update their status based on whether they are clickable or not Apr 6, 2024
@as-cii
Copy link
Member

as-cii commented Apr 16, 2024

Thanks for the pull request, @weartist!

I genuinely don't remember why we were ignoring move events if the window was not the active one. I think we were trying to replicate the behavior on macOS? e.g.

Export-1713255079552.mp4

However, after #9553, I guess we'll be able to receive clicks even when the window is not focused. Interestingly, it seems like something that not all elements opt into doing though...

So my only concern with these changes is the sheer amount of move events all windows will receive even when not focused. Like, is each window going to observe a mouse event at all times when the mouse moves now? Can we double check what impact that has on the CPU? Thanks! 🙏

@weartist
Copy link
Contributor Author

Thanks for the pull request, @weartist!

I genuinely don't remember why we were ignoring move events if the window was not the active one. I think we were trying to replicate the behavior on macOS? e.g.

Export-1713255079552.mp4
However, after #9553, I guess we'll be able to receive clicks even when the window is not focused. Interestingly, it seems like something that not all elements opt into doing though...

So my only concern with these changes is the sheer amount of move events all windows will receive even when not focused. Like, is each window going to observe a mouse event at all times when the mouse moves now? Can we double check what impact that has on the CPU? Thanks! 🙏

Your concern is right, and the good news is that we only have one window at most that can receive the event, and need that window to be the topmost window of the current mouse position. So I guess it shouldn't have much of an impact on CPU usage, because if the event is received by our window, then the window is currently in a state where it should be received, later I can test it with instrument

@weartist
Copy link
Contributor Author

weartist commented Apr 17, 2024

Providing a time profile parsing file, I opened three ZED windows during testing, one of which contained ZED's source code project, and the other two were slightly smaller, I'm a beginner for time profile, and if someone can have a better way or find someting, I think it would be great

revceive_move_event.trace.zip

image

@as-cii as-cii merged commit 135a5f2 into zed-industries:main Apr 24, 2024
9 checks passed
@as-cii
Copy link
Member

as-cii commented Apr 24, 2024

I just confirmed that the move event will only be dispatched on one window, so I think we're good. Thanks @weartist!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-focused windows don't show hover state for clickable areas.
2 participants