Skip to content

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

Merged
as-cii merged 1 commit into
zed-industries:mainfrom
Kalmaegi:show_hover_status_at_non_focused
Apr 24, 2024
Merged

Enable unfocused windows to update their status based on whether they are clickable or not#10229
as-cii merged 1 commit into
zed-industries:mainfrom
Kalmaegi:show_hover_status_at_non_focused

Conversation

@Kalmaegi

@Kalmaegi Kalmaegi commented Apr 6, 2024

Copy link
Copy Markdown
Contributor

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 6, 2024
@Kalmaegi
Kalmaegi 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
@Kalmaegi
Kalmaegi force-pushed the show_hover_status_at_non_focused branch from 0a7e45e to 9bb4b18 Compare April 6, 2024 10:00
@Kalmaegi
Kalmaegi 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
@ConradIrwin
ConradIrwin requested a review from mikayla-maki April 8, 2024 21:41
@as-cii

as-cii commented Apr 16, 2024

Copy link
Copy Markdown
Member

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! 🙏

@Kalmaegi

Copy link
Copy Markdown
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

@Kalmaegi

Kalmaegi commented Apr 17, 2024

Copy link
Copy Markdown
Contributor Author

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
@as-cii

as-cii commented Apr 24, 2024

Copy link
Copy Markdown
Member

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

jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
… are clickable or not (zed-industries#10229)

- Fixed zed-industries#9784 By removing the interception of the MouseMove event, zed
can update the corresponding Hover even when it is inactive
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