Commit Graph
100 Commits
Author SHA1 Message Date
Nathan Sobo 1bc4f22373 Rework element system, phase 1 (#2881)
This is a deep cut. There's still more work to do until we start
building UI with this. I've approached this as additively as possible,
but I've made a few changes to the rest of the code that I think would
be good to upstream before proceeding too much further.

Most of the interesting pieces are in gpui/playground, which is a
standalone binary that opens a single window and renders a new kind of
element. The layout of these new elements is provided by the taffy
layout engine crate, which conforms to web conventions. The idea is that
playground is relatively cheap to build and work on. As concepts
coalesce in playground, we can drop them into gpui and start
transitioning.
2023-08-23 08:26:38 -06:00
Nathan Sobo cd72a42bd4 Mark new crates as publish = false 2023-08-22 20:47:05 -06:00
Nathan Sobo d375f7992d Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
Nathan SoboandAntonio Scandurra 733df38f9b Checkpoint
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-08-22 11:34:06 -06:00
Nathan Sobo 3921278319 Add more style helpers 2023-08-22 09:16:05 -06:00
Nathan Sobo 53679ce045 Checkpoint 2023-08-22 09:07:45 -06:00
Nathan Sobo ff7b25c538 Checkpoint 2023-08-21 16:14:59 -06:00
Nathan Sobo f4d8763d2b WIP 2023-08-19 23:16:20 -06:00
Nathan Sobo 6663d3f8eb Checkpoint 2023-08-19 22:33:28 -06:00
Nathan Sobo afff46b335 Checkpoint 2023-08-19 21:24:28 -06:00
Nathan Sobo 2c6f692c56 Checkpoint 2023-08-19 20:29:55 -06:00
Nathan Sobo 0747131bd4 Compiling checkpoint 2023-08-19 19:51:22 -06:00
Nathan Sobo 76993f6b57 WIP: Trying to find a composable approach to styling that plays nice with layout engine 2023-08-18 20:08:29 -06:00
Nathan Sobo eec39dc23c WIP 2023-08-18 17:14:29 -06:00
Nathan Sobo b910c85f7f Still need to wire up MouseMove with the new regions 2023-08-18 02:23:06 -06:00
Nathan Sobo 3709eff34b Compiling 2023-08-18 01:59:21 -06:00
Nathan Sobo 9b74dc196e Introduce Refinement trait and derive macro 2023-08-18 01:03:46 -06:00
Nathan Sobo 19ccb19c96 Compiling 2023-08-17 18:37:54 -06:00
Nathan Sobo 24d19deb0b Compiling checkpoint 2023-08-17 14:05:18 -06:00
Nathan Sobo f3a275d339 Revert "Add a proc macro for deriving override structs with optional fields"
This reverts commit ab9356e9d8.
2023-08-17 13:48:46 -06:00
Nathan Sobo ab9356e9d8 Add a proc macro for deriving override structs with optional fields 2023-08-17 09:39:23 -06:00
Nathan Sobo b95b2af3e0 Store generic mouse regions on window that contain their event type id 2023-08-17 08:37:55 -06:00
Nathan Sobo 812d3f6af6 Get basic mouse_down and mouse_up working 2023-08-16 22:21:27 -06:00
Nathan Sobo 187d78011c WIP 2023-08-16 13:52:42 -06:00
Nathan SoboandAntonio Scandurra f1aafab61d Get text rendering
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-08-16 12:50:35 -06:00
Nathan Sobo fea987b459 WIP 2023-08-16 06:22:47 -06:00
Nathan Sobo a8ecc1a643 Add support for a measure function to the layout engine facade 2023-08-15 22:02:56 -06:00
Nathan Sobo 4efc46c763 Add derive macro now new elements 2023-08-15 21:04:48 -06:00
Nathan Sobo 77bc682a69 Render a component 2023-08-15 19:46:07 -06:00
Nathan Sobo 65a5c54a2c Compiling checkpoint 2023-08-15 19:29:57 -06:00
Nathan Sobo e7489bd4c9 Compiling checkpoint 2023-08-15 09:33:59 -06:00
Nathan Sobo 0fe457020b WIP 2023-08-15 09:26:16 -06:00
Nathan SoboandMikayla Maki f9858445b8 Get a 50% colored box rendering
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-08-14 14:46:09 -06:00
Nathan SoboandMikayla Maki 740b105330 Merge branch 'main' into taffy
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-08-14 13:50:21 -06:00
Nathan Sobo 7756497933 Simplify adapter 2023-08-14 09:26:35 -06:00
Nathan Sobo 85f35497b6 Compiling checkpoint 2023-08-13 22:39:06 -06:00
Nathan Sobo 7662210776 I think the adapter is ready. Close to pixels. 2023-08-13 22:06:35 -06:00
Nathan Sobo 625e4a1bd0 Introduce new PaintContext and LayoutContext 2023-08-13 21:57:38 -06:00
Nathan Sobo 2d17e9685f Compiling checkpoint 2023-08-13 21:20:47 -06:00
Nathan Sobo be7a43c81c Get taffy style conversion working 2023-08-13 19:47:49 -06:00
Nathan Sobo 52ad48d50b WIP 2023-08-13 17:29:07 -06:00
Nathan Sobo 473ac5a842 WIP 2023-08-13 02:27:36 -06:00
Nathan Sobo 36b853ac05 WIP 2023-08-13 01:40:10 -06:00
Nathan Sobo 1ef486b227 WIP 2023-08-13 01:40:05 -06:00
Nathan Sobo fa7ebd0825 Include drop shadows with different corner radii in the example 2023-08-12 11:08:58 -06:00
Nathan Sobo 65123e6eed Allow individual corner radii on drop shadows 2023-08-12 10:58:08 -06:00
Nathan Sobo 40f478937e Allow distinct corner radii for images 2023-08-12 10:50:04 -06:00
Nathan Sobo 84dc4090bd Wire up per corner radii for quad
Still need to expose this in the styling layer and allow images
to have per corner radii.
2023-08-12 10:40:23 -06:00
Nathan Sobo 0d31d6dac5 WIP 2023-08-12 10:00:08 -06:00
Nathan Sobo 4b4b949972 WIP 2023-08-12 01:11:12 -06:00
Nathan Sobo 5e36040533 Put a Taffy layout engine on window 2023-08-12 00:58:11 -06:00
Nathan Sobo 983641da2b WIP 2023-08-11 07:39:30 -06:00
Nathan Sobo d6eaa3c6b8 Ditch the hot reloading approach 2023-08-11 00:26:58 -06:00
Nathan Sobo 0bf607cd2d WIP 2023-08-10 10:26:48 -06:00
Nathan Sobo dd6425e898 WIP 2023-08-10 09:24:16 -06:00
Nathan Sobo 3b1e5e966a What if we base themes on Rose Pine 2023-08-09 20:54:30 -06:00
Nathan Sobo 82c903de14 Rename node to frame 2023-08-08 21:28:52 -06:00
Nathan Sobo c95aecdd53 Merge branch 'main' into cells 2023-08-08 21:23:57 -06:00
Nathan Sobo 8ed5e8f86d Pass PaintContext to Element::paint (#2788)
I want to use this on another branch, but it's a sweeping change, so
this prepares the ground for it. This can always be reverted if it
doesn't work out.
2023-08-08 21:16:57 -06:00
Nathan Sobo db96fb1307 Merge remote-tracking branch 'origin/main' into paint-context 2023-08-08 18:27:16 -06:00
Nathan Sobo 54ca5f1d44 Replace context methods that take a window id with methods on window handles (#2832)
With this PR, I've eliminated almost all references to window ids
outside of the internals of GPUI. All public methods taking these ids
are now defined on `AnyWindowHandle`, which provides a more coherent
narrative around windows as a concept.
2023-08-08 17:51:37 -06:00
Nathan Sobo 0dc70e6cbf Rename mac platform Window to MacWindow for clarity 2023-08-08 17:21:06 -06:00
Nathan Sobo fc96676662 Use AppContext::update when updating windows so we handle effects 2023-08-08 17:20:46 -06:00
Nathan Sobo 8e49d1419a Minimize window id usage 2023-08-08 16:38:46 -06:00
Nathan Sobo afd89b256a Store AnyWindowHandles instead of usizes 2023-08-08 16:06:53 -06:00
Nathan Sobo 1e8a9ccdb5 Merge remote-tracking branch 'origin/main' into window-handles 2023-08-08 11:42:55 -06:00
Nathan Sobo b77c336a3d Return window handles from WeakItemHandle 2023-08-08 11:39:56 -06:00
Nathan Sobo b2d9ccc0a2 Move more window methods off AsyncAppContext 2023-08-08 11:38:07 -06:00
Nathan Sobo 95cd96e4be Move debug_elements to AnyWindowHandle 2023-08-08 11:27:19 -06:00
Nathan Sobo 4f10f0ee86 Remove window methods from AsyncAppContext 2023-08-08 11:23:49 -06:00
Nathan Sobo 1fd80ba8bd Remove AsyncAppContext::remove_window 2023-08-08 11:22:43 -06:00
Nathan Sobo fe6a1886c1 Remove unused dock code 2023-08-08 11:20:42 -06:00
Nathan Sobo 0a4633f88f Remove more window id usage 2023-08-08 11:20:09 -06:00
Nathan Sobo da7dc9c880 Work with window handles instead of ids in drag code 2023-08-08 11:14:02 -06:00
Nathan Sobo d896d89842 Store an AnyWindowHandle in WindowContext 2023-08-08 11:08:37 -06:00
Nathan Sobo 49f1f1c6c2 Remove window when closing workspace in test 2023-08-08 09:13:17 -06:00
Nathan Sobo dba2facd23 Remove window via handles 2023-08-07 22:58:01 -06:00
Nathan Sobo f0da6b05fd Remove TestAppContext::add_view
Instead, we now call this on window handles.
2023-08-07 22:46:48 -06:00
Nathan Sobo 0f332238b3 Remove unused method 2023-08-07 22:08:44 -06:00
Nathan Sobo d687c3d81f Merge remote-tracking branch 'origin/main' into window-handles 2023-08-07 22:07:20 -06:00
Nathan Sobo f2be3181a9 Move window-related methods from TestAppContext to AnyWindowHandle 2023-08-07 20:23:04 -06:00
Nathan Sobo 0197d49230 Move activation simulation to AnyWindowHandle 2023-08-07 19:45:43 -06:00
Nathan Sobo 486f5bc6ca Get compiling 2023-08-07 19:08:58 -06:00
Nathan Sobo 3e0d0e5c01 WIP 2023-08-07 13:54:47 -06:00
Nathan Sobo d4d32611fe WIP 2023-08-06 18:57:02 -06:00
Nathan Sobo adc50469ff WIP 2023-08-06 12:45:31 -06:00
Nathan Sobo dcf8b00656 WIP 2023-08-05 18:00:44 -06:00
Nathan Sobo b6110fed9e WIP 2023-08-04 07:56:20 -06:00
Nathan Sobo 196946cbb6 Squelch warnings for now 2023-08-03 21:21:45 -06:00
Nathan Sobo 379652f074 Merge branch 'main' into cells 2023-08-03 19:33:04 -06:00
Nathan Sobo d3c1966d96 WIP: Return WindowHandle<V: View> from AppContext::add_window (#2820)
Instead of returning a usize for the window id, I'm instead returning a
`WindowHandle<V: View>` where `V` is the type of the window's root view.
@as-cii helped me with a cool technique using generic associated types
where methods on `WindowHandle` can return either T or Option<T>
depending on the `BorrowWindowContext::Result` associated type.

Some example usage...

```rs
let window = cx.add_window(|cx| MyView::new(cx));
let my_view = window.root(cx); // If cx is TestAppContext, returns MyView. Otherwise returns Option<MyView>, because the window could be closed.
```


This isn't insanely beneficial on its own, but I think it will help
clean up our testing story. I'm planning on making `window` more useful
in tests for laying out elements, etc.

- [x] Rework tests that call `add_window` 😅 to expect only a window in
return.
- [x] Get tests passing
- [x] 🚬  test
2023-08-03 18:45:51 -06:00
Nathan Sobo 2d96388be3 Use WindowHandles in a couple places 2023-08-03 17:46:34 -06:00
Nathan Sobo 485c0a482e Don't refcount window handles 2023-08-03 17:11:47 -06:00
Nathan Sobo afcc0d621b WIP 2023-08-03 17:03:39 -06:00
Nathan Sobo 3c938a7377 WIP 2023-08-03 08:10:16 -06:00
Nathan Sobo 8e36da1382 Get tests passing 2023-08-02 15:02:55 -06:00
Nathan Sobo 884cee6dfd Get tests compiling returning WindowHandle<V: View> from add_window 2023-08-02 14:05:03 -06:00
Nathan Sobo 60e190e500 WIP 2023-08-02 12:08:56 -06:00
Nathan Sobo 300ce61bd0 WIP 2023-08-02 08:25:40 -06:00
Nathan Sobo b695c42e11 WIP: Return WindowHandle<V: View> from AppContext::add_window 2023-08-01 22:28:04 -06:00