Commit Graph
308 Commits
Author SHA1 Message Date
Keith Simmons dddfc7beae Add hover test and tweak dismiss logic 2022-06-09 17:03:45 -07:00
Antonio Scandurra ea8b5016f7 Snap overlay's bottom/right edge to same window's edge on overflow 2022-06-09 13:48:02 +02:00
Antonio Scandurra 0408a8259e Add ModelContext::observe_global 2022-06-09 10:05:00 +02:00
Antonio Scandurra a26af194e7 Use visible bounds to determine hit bounds for cursor/mouse regions 2022-06-08 10:17:22 +02:00
Keith Simmons a6c0ee472c Add vim bindings for hover
Allow scrolling in hover popover
2022-06-07 13:07:53 -07:00
Antonio Scandurra c22aedfe69 Fix tests 2022-06-06 09:29:42 +02:00
Antonio Scandurra 22dd68fbfb Add keystroke for menu item only when action is equal to binding
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.
2022-06-06 09:26:33 +02:00
Antonio Scandurra 3a69943df3 Require that PartialEq is implemented for Action 2022-06-06 09:18:44 +02:00
Antonio Scandurra 74aa9c1320 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.
2022-06-04 10:41:29 +02:00
Max Brunsfeld 8d46edd26c Avoid holding RefCell borrow while calling TestAppContext::spawn callback 2022-06-02 17:29:11 -07:00
Max Brunsfeld 7ef9de32b1 Show private projects in the contacts panel
Introduce a ProjectStore that lets you iterate through all open projects.
Allow projects to be made public by clicking the lock.
2022-06-02 17:29:11 -07:00
Antonio Scandurra 701e2090cd Align context menu to fit within the window bounds 2022-06-02 09:47:06 +02:00
Antonio Scandurra cc028cca78 Simplify usage of tooltip
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.
2022-06-02 09:12:50 +02:00
Antonio Scandurra 0e1307fb23 📝 2022-06-01 10:18:10 +02:00
Antonio Scandurra 238827642a Align tooltip based on the available window space 2022-06-01 10:03:46 +02:00
Antonio Scandurra 982de971fa Introduce a new Tooltip element and a with_tooltip helper 2022-06-01 09:55:25 +02:00
Antonio Scandurra 94fc28b29d WIP: start on tooltips 2022-05-31 19:00:44 +02:00
Antonio Scandurra 34bf248614 Avoid notifying views that have been removed 2022-05-31 10:36:10 +02:00
Antonio Scandurra e067212ad4 Always re-render visible elements in List 2022-05-31 09:52:44 +02:00
Antonio Scandurra 0fd47da880 Prevent mouse down events from piercing through overlays 2022-05-31 09:34:37 +02:00
Antonio Scandurra f832c0074f Fix memory leak in ListState 2022-05-30 18:29:51 +02:00
Antonio Scandurra 20e1044d49 Merge branch 'main' into project-panel-with-new-mouse-events 2022-05-30 18:29:46 +02:00
Antonio Scandurra 6c145b2abc Show keystrokes as uppercase 2022-05-30 12:23:03 +02:00
Antonio Scandurra 2b9015c096 Introduce {MutableAppContext,ViewContext}::observe_actions 2022-05-30 10:01:23 +02:00
Antonio Scandurra e7ab61d125 Dismiss context menu when (right-)mousing down outside of it 2022-05-28 08:51:46 +02:00
Antonio Scandurra fb26f8195b Sort mouse regions by their stacking context's depth 2022-05-28 08:45:10 +02:00
Nathan Sobo 44c8ee5709 Add mouse down out handlers
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.
2022-05-27 12:56:44 -06:00
Keith Simmons 48abbb7e63 Merge pull request #1019 from zed-industries/vim-visual-line-mode
Vim visual line mode
2022-05-27 11:22:56 -07:00
Nathan Sobo 9909fc529b Allow context menu to be cancelled after deploying it twice
Previously, two right clicks would cause an issue with cancelling the context menu via escape.
2022-05-27 12:00:11 -06:00
Nathan Sobo c3baf2748f Block hovering behind overlays 2022-05-27 11:54:51 -06:00
Max Brunsfeld 04bd57b2c7 Add an API for setting a window's title
This controls how the window appears in the Window menu.
2022-05-27 10:45:55 -07:00
Nathan Sobo 5413a97c7e Restrict multiple hovered regions to a single stacking context
We won't hover regions from stacking contexts that are below the one being hovered.
2022-05-27 11:09:07 -06:00
Antonio Scandurra 9099c40364 Merge branch 'mouse-events' into project-panel-context-menu 2022-05-27 12:07:00 +02:00
Antonio Scandurra be0e66ef21 Invoke mouse_down and right_mouse_down callbacks 2022-05-27 11:20:39 +02:00
Antonio Scandurra 7c7917494c Don't dispatch events down the tree if they were handled by mouse region 2022-05-27 11:20:32 +02:00
Antonio Scandurra 1d7fc12229 Add right-click support to MouseEventHandler 2022-05-27 10:47:54 +02:00
Antonio Scandurra 307eb1726c Compute dispatch path based on the view id that dispatched the action 2022-05-27 09:59:24 +02:00
Nathan Sobo aedfd74d30 Use the hit bounds when painting mouse regions 2022-05-26 20:05:20 -06:00
Nathan SoboandMax Brunsfeld 893f15ddab Switch MouseEventHandler to use MouseRegions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 20:00:01 -06:00
Nathan SoboandMax Brunsfeld 50edcb06dd Add drag callbacks to mouse regions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:59:38 -06:00
Nathan SoboandMax Brunsfeld bd62a68234 Eliminate ElementStateContext trait
We now always have a RenderContext when rendering MouseEventHandlers or scrollable Flex columns/rows.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:37:28 -06:00
Nathan SoboandMax Brunsfeld b6b16fc9c3 In UniformList, guard against misbehavior of append_items
If for some reason the handle got dropped and we call it, we'll deal with it somewhat gracefully.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:30:28 -06:00
Nathan SoboandMax Brunsfeld 8dd82fdce1 Take a RenderContext in ListState's build item callback
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:23:44 -06:00
Nathan SoboandMax Brunsfeld 2ea085b178 Pass a RenderContext to UniformList
In some cases, we need to render during layout. Previously, we were rendering with a LayoutContext in some cases, but this commit adds the ability to retrieve a render context with a given handle and we use that feature in UniformList.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:03:34 -06:00
Keith Simmons 61f0daa5c5 Visual line mode handles soft wraps 2022-05-26 17:02:05 -07:00
Nathan Sobo d69776585d Add mouse_state method to RenderContext
We can use this to determine if a region is hovered or clicked.
2022-05-26 13:22:23 -06:00
Nathan Sobo 3a59d2a331 Allow hovered and clicked mouse regions to be tracked in the presenter 2022-05-26 12:44:52 -06:00
Nathan SoboandAntonio Scandurra 0866f0ed55 Introduce CursorRegion struct
This will blend in with an upcoming MouseRegion struct that sits next to it in the scene.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-26 11:00:10 -06:00
Antonio Scandurra 82ddac8e7e Restore focus when closing context menu 2022-05-26 15:21:55 +02:00
Antonio Scandurra 580f1a4125 Style context menu 2022-05-26 10:40:53 +02:00