Commit graph

269 commits

Author SHA1 Message Date
Nathan Sobo
db1cf8f6e1 Rename build_view to new_view and build_model to new_model
The word "new" is shorter and blends in with `new` constructors that are common
in Rust. Been meaning to do this for a while.
2024-01-01 17:42:01 -07:00
Antonio Scandurra
48ad53badd Revert "Revert "Optimize order rendering and border drawing"" 2023-12-22 09:12:18 +01:00
Antonio Scandurra
7cfea09019
Revert "Optimize order rendering and border drawing" 2023-12-21 19:40:03 +01:00
Antonio Scandurra
c03c0d50d5 Use smaller quads to draw borders
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-12-21 17:54:13 +01:00
Antonio Scandurra
73682daf38 Provide mut access to allocated arena struct via non-cloneable ArenaBox
This commit also allows turning an `ArenaBox` into an `ArenaRef` when
non-mutable access is required, which makes `ArenaRef: Clone`. This fixes
a bug that prevented the command palette from reading all the available
actions while the `command_palette::Toggle` action was being dispatched.
2023-12-21 09:41:48 +01:00
Nathan Sobo
5747c9b7a1 Clear pending keystrokes when an action is dispatched 2023-12-20 20:41:36 -07:00
Max Brunsfeld
5e7c74c7b6 Ensure that on_release callbacks are called even if view outlives its window 2023-12-20 16:01:52 -08:00
Antonio Scandurra
90db278724
Prevent ArenaRef from being cloned (#3738)
This could cause multiple mutable references to be acquired for the same
arena element, which is unsafe. I didn't see it cause problems in
practice, but I realized this could have been a problem and fixed it
before it bit us.

Release Notes:

- N/A
2023-12-20 17:52:16 +01:00
Antonio Scandurra
6e2346c537 Prevent ArenaRef from being cloned 2023-12-20 17:32:59 +01:00
Kirill Bulatov
fe40e3920b Fix remaining z-index bugs
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-12-20 18:23:09 +02:00
Antonio Scandurra
390ccbc6ad Disable focus when disconnecting from host 2023-12-20 14:10:56 +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
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
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
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
Nathan Sobo
3781626379 Merge branch 'main' into arena 2023-12-15 13:22:19 -07: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
Nathan Sobo
02606d1fb9 Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 16:56:36 -07:00
Julia
bbbdb9ff3e Render panel in this test to make sure it can receive focus 2023-12-14 17:11:00 -05:00
Mikayla
8791f7cefc Enable dragging from project panel to panes
Rework gpui2 drag API so that receivers need not specify the dragged view type.

co-authored-by: Max <max@zed.dev>
co-authored-by: Conrad <conrad@zed.dev>
2023-12-14 13:20:48 -08:00
Nathan Sobo
fb3382bcc5 Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 14:16:59 -07:00
Nathan Sobo
0dd6c50a20 Use FxHashMap for element state 2023-12-14 14:06:19 -07:00
Nathan Sobo
3d1dae9a06 Make z_indices bigger in StackingOrder 2023-12-14 11:37:48 -07:00
Nathan Sobo
0d30b698a4 Don't allocate interactive bounds 2023-12-14 11:28:52 -07:00
Nathan Sobo
1ae25f52a1 WIP 2023-12-14 10:31:45 -07:00
Nathan Sobo
6f17cf7337 WIP 2023-12-14 09:25:14 -07:00
Julia
cd08d349a5 Quick and dirty attempt to immediately apply focus change in tests
Doesn't quite work yet
2023-12-13 21:48:05 -05:00
Mikayla
53b1948c44
Remove inconsistency with how GPUI used to handle these events 2023-12-13 18:32:42 -08:00
Mikayla
0dd84924e4
add cmd-click-to-jump-to-element 2023-12-13 18:19:25 -08:00
Nathan Sobo
c863227dc2 Log frame timings 2023-12-13 18:44:21 -07:00
Nathan Sobo
1e4a7e6ef1 Don't notify when drawing 2023-12-13 16:05:34 -07:00
Max Brunsfeld
26a31b41b9 frame time 2023-12-13 14:22:34 -07:00
Mikayla
bfbbec0b01
Add fluent quad API 2023-12-13 13:21:48 -08:00
Julia
cfc050e3fe Fire focus handlers on draw to avoid timing with newly created item
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-12-13 12:16:39 -05:00
Antonio Scandurra
5018072203 Automatically transfer focus on mouse down in Interactivity::paint 2023-12-13 09:57:18 +01:00
Antonio Scandurra
c0846d6f74
Set cursor style only if we're the active window (#3607)
Release Notes:

- N/A
2023-12-12 16:56:32 +01:00
Antonio Scandurra
b87c45e6f5 Set cursor style only if we're the active window 2023-12-12 16:32:45 +01:00