Commit graph

771 commits

Author SHA1 Message Date
Kirill Bulatov
8471a5f80b Finish all but the styling 2023-12-20 18:23:08 +02:00
Nathan Sobo
12bb13b9fc Perform a bounds check when allocating in the arena
This ensures we don't invoke undefined behavior when overflowing.

Co-Authored-By: Antonio <antonio@zed.dev>
2023-12-20 08:20:00 -07:00
Antonio Scandurra
390ccbc6ad Disable focus when disconnecting from host 2023-12-20 14:10:56 +01:00
Antonio Scandurra
8273865fa3 Introduce InteractiveElement::capture_any_mouse_{down,up} 2023-12-20 14:00:12 +01:00
Antonio Scandurra
5781cf6604 Use InteractiveBounds everywhere we change the cursor style 2023-12-20 13:59:52 +01:00
Antonio Scandurra
00927db711 Fix sluggish experience when dragging tabs
The problem was caused by a missing call to `WindowContext::notify` when
moving the mouse. Actually, we *did* notify as part of a `MouseMoveEvent`
listener registered in `Interactivity` but that code path was never
exercised because we were clearing the `pending_mouse_down`.

This commit fixes the issue by automatically redrawing the window in gpui
when there is an active drag and the mouse moves.
2023-12-20 11:21:55 +01:00
Max Brunsfeld
c81e89a4f4 Ensure that new view observers are called by WindowContext::replace_root_view 2023-12-19 17:04:42 -08:00
Kirill Bulatov
cf12d62fc5 Tidy up z-index handling
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-12-19 23:50:42 +02:00
Kirill Bulatov
f6d31917c1 Optimize stack id in-memory layout 2023-12-19 23:31:17 +02:00
Kirill Bulatov
825a8f0927 Initial fix of the z-index
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-12-19 23:29:08 +02:00
Max Brunsfeld
1c3698ae20 Implement channel modal
Co-authored-by: Nathan <nathan@zed.dev>
2023-12-19 12:02:35 -08:00
Max Brunsfeld
cf037ea4a8 Merge branch 'main' into fix-panel-resize 2023-12-19 08:55:55 -08:00
Antonio Scandurra
dd84993d76 Maintain scroll position in CollabPanel after updating entries
Co-Authored-By: Julia <julia@zed.dev>
2023-12-19 16:06:00 +01:00
Antonio Scandurra
02e53025f3 Track caller on h_stack and v_stack 2023-12-19 14:26:30 +01:00
Antonio Scandurra
ae32706cfe Fix tests 2023-12-19 11:04:32 +01:00
Antonio Scandurra
ba0d7e35bb Set window edited 2023-12-19 10:26:06 +01:00
Max Brunsfeld
2979eb9da9 Allow transparent divs to be considered "top layers"
This changes the meaning of `was_top_layer` so that it is checking that
nothing opaque is on top of the given layer. The layer in question
need not be opaque.
2023-12-18 18:32:08 -08:00
Max Brunsfeld
b88370d5ad Respect a div's own z-index when adding its event listeners 2023-12-18 18:02:19 -08:00
Max Brunsfeld
ee8e1454fc Fix drag and drop logic in div's mouse handling
* Attach mouse up and mouse move listeners immediately, not just when there
  is already a drag in progress, because when starting a drag, these other
  events may fire before the next frame.
* Remove bounds checks for handling mouse move and mouse events, since a
  dragged object may be moved outside of its original container.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-12-18 16:17:56 -08:00
Max Brunsfeld
0000e68310 Remove unused Arena::sized method 2023-12-18 10:41:02 -08:00
Antonio Scandurra
37efe82c5e Use a different frame arena for all elements
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-12-18 19:35:17 +01:00
Antonio Scandurra
cef9aa3590 Use a different frame arena for each window
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-12-18 18:58:40 +01:00
Antonio Scandurra
4e544545d1
Introduce an Arena to allocate and deallocate frame-related structs more cheaply (#3689)
Picture worth a thousand words:


![before-after](https://github.com/zed-industries/zed/assets/482957/0aa92baf-f1cd-485e-a234-6d8f8b63a79a)

Note how having an area makes a substantial amount of frames between
0.5ms and 1ms faster (15-20% faster frames).

Release Notes:

- N/A
2023-12-18 11:16:07 +01:00
Antonio Scandurra
5a4e2e6b90 Use a closure to allocate structs onto the Arena
This is a trick borrowed from Bumpalo that helps LLVM understand
it should instantiate the object directly on the heap, as opposed to
doing so on the stack and then moving it.
2023-12-18 10:56:37 +01:00
Marshall Bowers
54eb452144
Only apply scroll correction in uniform_list when already scrolled (#3687)
This PR fixes an issue where the scroll correction added to the uniform
list in a35fdf45fc was being applied even
if the list wasn't scrolled at all.

This manifested in the project panel starting with an incorrect scroll
offset that would disappear once scrolled.

It seems like we should only need to apply this scroll correction when
the list is already scrolled.

Release Notes:

- N/A
2023-12-15 17:53:10 -05:00
Max Brunsfeld
149a718d65 Don't scroll List on scroll wheel events outside of its bounds 2023-12-15 13:38:49 -08:00
Conrad Irwin
b8cdcf4e93
fix theme selector gaps (#3682)
- Don't scroll beyond end of uniform list
- Restore position of uniform_list padding

[[PR Description]]

Release Notes:

- N/A
2023-12-15 13:27:17 -07:00
Nathan Sobo
3781626379 Merge branch 'main' into arena 2023-12-15 13:22:19 -07:00
Conrad Irwin
2fe9a1df21 Restore position of uniform_list padding
It should be inside the scrollable area.
2023-12-15 13:18:51 -07:00
Conrad Irwin
a35fdf45fc Don't scroll beyond end of uniform list 2023-12-15 12:54:12 -07:00
Marshall Bowers
a40f04b71f Only scroll enough to reveal the next channel if it isn't visible
Co-authored-by: Max <max@zed.dev>
2023-12-15 13:50:51 -05:00
Marshall Bowers
47fc03ab98 Fix positioning of the inline context menu
Added a new `bounds_for_item` for `ListState`.

Co-authored-by: Max <max@zed.dev>
2023-12-15 13:24:30 -05:00
Antonio Scandurra
0a57171066 Use a safe API for Arena 2023-12-15 19:03:37 +01:00
Antonio Scandurra
be73dd852d Move Arena to a thread-local and use it to allocate AnyElement 2023-12-15 16:18:05 +01:00
Antonio Scandurra
e1ca8e81bb Use an Arena to reuse allocations for listeners 2023-12-15 15:13:32 +01:00
Kirill Bulatov
a6403aad1a Remove extra nits, do not panic on clicking the buffer separator 2023-12-15 11:28:48 +02:00
Julia
de523c2d80 Give correct focus handle when project search has no matches 2023-12-14 23:49:44 -05:00
Julia
4be84f3db0 Merge branch 'main' into focus-handlers-on-draw 2023-12-14 23:08:23 -05:00
Mikayla Maki
05cb68eff1
Merge branch 'main' into perf-2 2023-12-14 16:39:10 -08:00
Mikayla Maki
8418f25d0a
Merge branch 'main' into perf-2 2023-12-14 16:25:40 -08:00
Max Brunsfeld
d6383ab0c6 Fix stickiness of main pane drag target
Reimplement the pane drag targets using on_drag_move
2023-12-14 16:23:15 -08:00
Mikayla Maki
0b4b81fa0c
Fix dock resizing (#3663)
This fixes some bugs in the display and tracking of dock resizes

Release Notes:

-
2023-12-14 16:20:29 -08:00
Nathan Sobo
ad8165ae79 Rename draw2 -> draw_and_update_state 2023-12-14 17:20:27 -07:00
Nathan Sobo
f4a954db4f Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 17:15:44 -07:00
Mikayla
8b4cf38379
Fix dock resize handles
co-authored-by: conrad <conrad@zed.dev>
2023-12-14 16:05:10 -08:00
Nathan Sobo
02606d1fb9 Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 16:56:36 -07:00
Marshall Bowers
bc3e6649f8
Fix warning in release mode (#3662)
This PR fixes a warning that was present in release mode, which was
preventing the nightly builds from running:

```
error: variable does not need to be mutable
   --> crates/gpui2/src/elements/div.rs:547:9
    |
547 |     let mut div = Div {
    |         ----^^^
    |         |
    |         help: remove this `mut`
    |
    = note: `-D unused-mut` implied by `-D warnings`
```

Release Notes:

- N/A
2023-12-14 18:52:14 -05:00
Mikayla
4c63c74f92
Fix bug in drag move dispatch
co-authored-by: conrad <conrad@zed.dev>
2023-12-14 15:23:24 -08:00
Max Brunsfeld
23d5f3f3e8 Enable all warnings in workspace, fix all warnings
Bring back some workspace tests

Co-authored-by: Conrad <conrad@zed.dev>
2023-12-14 14:15:56 -08:00
Nathan Sobo
d13a21c238 Don't move in paint 2023-12-14 15:15:18 -07:00