# Capture mouse events when rendering disconnected overlay · gitcafe/zed

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

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

Visibility: public

Requested revision: 74aa9c13204775df0940f4e109c790f577957f0c

Requested commit: 74aa9c13204775df0940f4e109c790f577957f0c

Commit: 74aa9c13204775df0940f4e109c790f577957f0c

Tree: a122c25b564987ddbbe91285558f563d2ccb5b4d

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Capture mouse events when rendering disconnected overlay

We do so by replacing `EventHandler::capture` with a new `::capture_all` method.
After switching to mouse regions as part of zed-industries/zed#1081, overriding
`dispatch_event` on `EventHandler` wasn't enough anymore because mouse interactions
take place on a privileged code path that runs *before* dispatching any event.

With this change, `EventHandler` will now push a mouse region that intercepts all
mouse interactions, as well as pushing a cursor region that resets the cursor style
to `Arrow`.

One interesting change as part of this is that we've removed the ability to see which
event we are capturing: we were not using this capability anyway and `capture_all` provides
a simpler interface, so I went with that. In the future, we can opt into capturing specific
events or mouse interactions if there's a code path that needs that.

```

## Parents

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

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