This lets us bypass the application menu and invoke the event handler
in Zed first. If that doesn't handle the event, the application menu
item corresponding to the shortcut will be actioned. Prior to this
commit the opposite would happen, which would dramatically limit the
throughput at which we could handle events.
This fixes a bug where we would show `cmd-e` instead of `cmd-f` for
`Edit -> Find` because both bindings would have the `buffer_search::Deploy`
action and we were mistakenly selecting the former.
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.
Now you simply specify a text, an action and a style and GPUI will
take of rendering it properly. This is simpler compared to always
providing a custom element and should make tooltip more consistent
across the UI.
We temporarily let it grow when the message size exceed the limit,
but restore the buffer's capacity shortly after. This ensures that,
for each connection in its entire lifetime, we only ever use 1MB.
These will fire whenever the left/right mouse button is pressed down outside a specific region. I'll use these to cancel the context menu in the next commit.