# gpui_macos: Improve mouse tracking for normal windows \(\#64234\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/db7f9ceed788ebfcbbcb18e65927172f1dd7dde9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: db7f9ceed788ebfcbbcb18e65927172f1dd7dde9

Requested commit: db7f9ceed788ebfcbbcb18e65927172f1dd7dde9

Commit: db7f9ceed788ebfcbbcb18e65927172f1dd7dde9

Tree: 38ed7a84bf933abe2c08503354450494dd5cd745

Author: Smit Barmase

Committer: GitHub

## Message

```
gpui_macos: Improve mouse tracking for normal windows (#64234)

To reproduce:

1. Place Safari over part of Zed, then focus Zed.
2. Right-click Safari to open its context menu, then left-click Safari
anywhere in it.
3. Move the pointer over Safari where it covers the Zed. Zed shows hover
effects underneath.

Use a view tracking area and disable `acceptsMouseMovedEvents` for
normal macOS windows. This addresses hover effects on covered content
when the pointer moves over another window.

[Chromium also requests mouse movement through tracking
areas](https://github.com/chromium/chromium/blob/5a43095e95ffe566d1512b9d67d534e3ae05b975/components/remote_cocoa/app_shim/bridged_content_view.mm#L436-L465).
A search of its macOS window/view code found no explicit use of
`acceptsMouseMovedEvents`, which [defaults to
`false`](https://developer.apple.com/documentation/appkit/nswindow/acceptsmousemovedevents).

Tracking stays enabled in unfocused windows while the app is active.

Before:


https://github.com/user-attachments/assets/f21cd3e5-04d5-4d34-b495-02f8d0f68ecf

After:


https://github.com/user-attachments/assets/89a8b9c9-5aa3-4075-aa91-13e200ea3613

Release Notes:

- [GPUI] Fixed mouse tracking on macOS so moving the pointer over
another app’s window no longer triggers hover effects in covered GPUI
windows.
- Fixed an issue on macOS where moving the pointer over another app
could trigger hover effects in a Zed window underneath it.

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
```

## Parents

- [a95da07db20cf36bd750ecc4bdfecdf2b29e3f0f](https://git.cafe/gitcafe/zed/commit/a95da07db20cf36bd750ecc4bdfecdf2b29e3f0f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/db7f9ceed788ebfcbbcb18e65927172f1dd7dde9?format=markdown)
