From 3042d1b3ef6daf6cc8a99336407acd5a0c6e05d9 Mon Sep 17 00:00:00 2001 From: Miles Wirht <114884788+philocalyst@users.noreply.github.com> Date: Thu, 4 Jun 2026 21:41:59 -0400 Subject: [PATCH] API Fixes (#30) --- Cargo.lock | 1 + crates/gpui/Cargo.toml | 1 + crates/gpui/examples/bench/data_table.rs | 2 +- crates/gpui/examples/bench/paths_bench.rs | 2 +- crates/gpui/examples/bench/pattern.rs | 2 +- crates/gpui/examples/bench/shadow.rs | 49 ++++++++++++++++++- crates/gpui/examples/learn/animation.rs | 4 +- crates/gpui/examples/learn/async_tasks.rs | 4 +- .../examples/learn/creating_components.rs | 4 +- crates/gpui/examples/learn/custom_drawing.rs | 4 +- .../examples/learn/interactive_elements.rs | 4 +- crates/gpui/examples/learn/layout.rs | 4 +- crates/gpui/examples/learn/styling.rs | 4 +- crates/gpui/examples/learn/text.rs | 6 +-- crates/gpui/examples/learn/transition.rs | 2 +- crates/gpui/examples/legacy/focus_visible.rs | 2 +- crates/gpui/examples/legacy/gif_viewer.rs | 2 +- crates/gpui/examples/legacy/gradient.rs | 2 +- crates/gpui/examples/legacy/hello_world.rs | 2 +- crates/gpui/examples/legacy/image/image.rs | 2 +- crates/gpui/examples/legacy/image_loading.rs | 2 +- crates/gpui/examples/legacy/input.rs | 2 +- crates/gpui/examples/legacy/layer_shell.rs | 2 +- .../examples/legacy/on_window_close_quit.rs | 4 +- crates/gpui/examples/legacy/opacity.rs | 3 +- crates/gpui/examples/legacy/scrollable.rs | 2 +- crates/gpui/examples/legacy/svg/svg.rs | 4 +- crates/gpui/examples/legacy/tab_stop.rs | 2 +- crates/gpui/examples/legacy/tree.rs | 2 +- crates/gpui/examples/legacy/uniform_list.rs | 2 +- crates/gpui/examples/legacy/window.rs | 2 +- .../examples/legacy/window_positioning.rs | 2 +- crates/gpui/examples/legacy/window_shadow.rs | 4 +- crates/gpui/examples/{ => shared}/prelude.rs | 2 +- crates/gpui_macos/src/window.rs | 2 +- 35 files changed, 95 insertions(+), 45 deletions(-) rename crates/gpui/examples/{ => shared}/prelude.rs (96%) diff --git a/Cargo.lock b/Cargo.lock index 21840b968b..acdef06c3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2516,6 +2516,7 @@ dependencies = [ "serde_json", "slotmap", "smallvec", + "smol", "spin 0.10.0", "stacksafe", "strum", diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index 6815d7882a..2e9350d64a 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -148,6 +148,7 @@ windows = { version = "0.61", features = ["Win32_Foundation"] } [dev-dependencies] backtrace.workspace = true +smol.workspace = true collections = { workspace = true, features = ["test-support"] } env_logger.workspace = true gpui_platform = { workspace = true, features = ["font-kit", "wayland", "x11"] } diff --git a/crates/gpui/examples/bench/data_table.rs b/crates/gpui/examples/bench/data_table.rs index 14e78dbb78..e49ef4f858 100644 --- a/crates/gpui/examples/bench/data_table.rs +++ b/crates/gpui/examples/bench/data_table.rs @@ -1,7 +1,7 @@ use std::{ops::Range, rc::Rc, time::Duration}; use gpui::{ - App, Application, Bounds, Context, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, + App, Bounds, Context, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, Render, SharedString, UniformListScrollHandle, Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px, rgb, size, uniform_list, }; diff --git a/crates/gpui/examples/bench/paths_bench.rs b/crates/gpui/examples/bench/paths_bench.rs index 2ec007e0e9..4c9e89f864 100644 --- a/crates/gpui/examples/bench/paths_bench.rs +++ b/crates/gpui/examples/bench/paths_bench.rs @@ -1,5 +1,5 @@ use gpui::{ - Application, Background, Bounds, ColorSpace, Context, Path, PathBuilder, Pixels, Render, + Background, Bounds, ColorSpace, Context, Path, PathBuilder, Pixels, Render, TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, rgb, size, }; diff --git a/crates/gpui/examples/bench/pattern.rs b/crates/gpui/examples/bench/pattern.rs index 638ca2a913..e7c7069370 100644 --- a/crates/gpui/examples/bench/pattern.rs +++ b/crates/gpui/examples/bench/pattern.rs @@ -1,5 +1,5 @@ use gpui::{ - App, AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, + App, AppContext, Bounds, Context, Window, WindowBounds, WindowOptions, div, linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size, }; diff --git a/crates/gpui/examples/bench/shadow.rs b/crates/gpui/examples/bench/shadow.rs index 08f85ed333..99e1307bfb 100644 --- a/crates/gpui/examples/bench/shadow.rs +++ b/crates/gpui/examples/bench/shadow.rs @@ -1,6 +1,6 @@ use gpui::{ - App, Application, Bounds, BoxShadow, Context, Div, SharedString, Window, WindowBounds, - WindowOptions, current_platform, div, hsla, point, prelude::*, px, relative, rgb, size, + App, Bounds, BoxShadow, Context, Div, SharedString, Window, WindowBounds, + WindowOptions, div, hsla, point, prelude::*, px, relative, rgb, size, }; struct Shadow {} @@ -106,6 +106,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -116,6 +117,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -126,6 +128,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -136,6 +139,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -146,6 +150,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), ]), @@ -182,6 +187,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(0.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -191,6 +197,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(2.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -200,6 +207,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(4.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -209,6 +217,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -218,6 +227,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(16.), spread_radius: px(0.), + inset: false, }]), ), ]), @@ -234,6 +244,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -243,6 +254,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }]), ), example( @@ -252,6 +264,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(4.), + inset: false, }]), ), example( @@ -261,6 +274,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(8.), + inset: false, }]), ), example( @@ -270,6 +284,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(16.), + inset: false, }]), ), ]), @@ -286,6 +301,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -295,6 +311,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(8.), + inset: false, }]), ), example( @@ -304,6 +321,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(16.), + inset: false, }]), ), ]), @@ -320,6 +338,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -329,6 +348,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(8.), + inset: false, }]), ), example( @@ -338,6 +358,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(16.), + inset: false, }]), ), ]), @@ -354,6 +375,7 @@ impl Render for Shadow { offset: point(px(-8.), px(0.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -363,6 +385,7 @@ impl Render for Shadow { offset: point(px(8.), px(0.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -372,6 +395,7 @@ impl Render for Shadow { offset: point(px(0.), px(-8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -381,6 +405,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), ]), @@ -397,6 +422,7 @@ impl Render for Shadow { offset: point(px(-8.), px(0.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -406,6 +432,7 @@ impl Render for Shadow { offset: point(px(8.), px(0.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -415,6 +442,7 @@ impl Render for Shadow { offset: point(px(0.), px(-8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -424,6 +452,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), ]), @@ -440,6 +469,7 @@ impl Render for Shadow { offset: point(px(-8.), px(0.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -449,6 +479,7 @@ impl Render for Shadow { offset: point(px(8.), px(0.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -458,6 +489,7 @@ impl Render for Shadow { offset: point(px(0.), px(-8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), example( @@ -467,6 +499,7 @@ impl Render for Shadow { offset: point(px(0.), px(8.)), blur_radius: px(8.), spread_radius: px(0.), + inset: false, }]), ), ]), @@ -484,24 +517,28 @@ impl Render for Shadow { offset: point(px(0.), px(-12.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(60.0 / 360., 1.0, 0.5, 0.3), // Yellow offset: point(px(12.), px(0.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(120.0 / 360., 1.0, 0.5, 0.3), // Green offset: point(px(0.), px(12.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(240.0 / 360., 1.0, 0.5, 0.3), // Blue offset: point(px(-12.), px(0.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, ]), ), @@ -513,24 +550,28 @@ impl Render for Shadow { offset: point(px(0.), px(-12.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(60.0 / 360., 1.0, 0.5, 0.3), // Yellow offset: point(px(12.), px(0.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(120.0 / 360., 1.0, 0.5, 0.3), // Green offset: point(px(0.), px(12.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(240.0 / 360., 1.0, 0.5, 0.3), // Blue offset: point(px(-12.), px(0.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, ]), ), @@ -542,24 +583,28 @@ impl Render for Shadow { offset: point(px(0.), px(-12.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(60.0 / 360., 1.0, 0.5, 0.3), // Yellow offset: point(px(12.), px(0.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(120.0 / 360., 1.0, 0.5, 0.3), // Green offset: point(px(0.), px(12.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, BoxShadow { color: hsla(240.0 / 360., 1.0, 0.5, 0.3), // Blue offset: point(px(-12.), px(0.)), blur_radius: px(8.), spread_radius: px(2.), + inset: false, }, ]), ), diff --git a/crates/gpui/examples/learn/animation.rs b/crates/gpui/examples/learn/animation.rs index ca719b0be8..53254633ac 100644 --- a/crates/gpui/examples/learn/animation.rs +++ b/crates/gpui/examples/learn/animation.rs @@ -7,7 +7,7 @@ //! 3. Transformations - rotate, scale, translate //! 4. Repeating and duration controls -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; use std::time::Duration; @@ -15,7 +15,7 @@ use std::time::Duration; use anyhow::Result; use gpui::colors::Colors; use gpui::{ - Animation, AnimationExt as _, App, Application, AssetSource, Bounds, Context, Hsla, + Animation, AnimationExt as _, App, AssetSource, Bounds, Context, Hsla, SharedString, Transformation, Window, WindowBounds, WindowOptions, bounce, div, ease_in_out, linear, percentage, prelude::*, px, rgb, size as gpui_size, svg, }; diff --git a/crates/gpui/examples/learn/async_tasks.rs b/crates/gpui/examples/learn/async_tasks.rs index 96732f0a8c..4959d85e1b 100644 --- a/crates/gpui/examples/learn/async_tasks.rs +++ b/crates/gpui/examples/learn/async_tasks.rs @@ -7,14 +7,14 @@ //! 3. Task management - Storing, canceling, and detaching tasks //! 4. Progress updates - Communicating from background to UI -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; use std::time::Duration; use gpui::colors::Colors; use gpui::{ - App, Application, Bounds, Context, Entity, Render, Task, Window, WindowBounds, WindowOptions, + App, Bounds, Context, Entity, Render, Task, Window, WindowBounds, WindowOptions, div, prelude::*, px, rgb, size, }; diff --git a/crates/gpui/examples/learn/creating_components.rs b/crates/gpui/examples/learn/creating_components.rs index 37f549e11e..94eba05027 100644 --- a/crates/gpui/examples/learn/creating_components.rs +++ b/crates/gpui/examples/learn/creating_components.rs @@ -7,13 +7,13 @@ //! 2. `RenderOnce` - Stateless component that receives state from parent //! 3. `Render` - Entity-backed view with persistent internal state -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; use example_prelude::init_example; use gpui::colors::Colors; use gpui::{ - App, Application, Bounds, Context, Entity, IntoElement, Render, RenderOnce, Window, + App, Bounds, Context, Entity, IntoElement, Render, RenderOnce, Window, WindowBounds, WindowOptions, div, prelude::*, px, rgb, size, }; diff --git a/crates/gpui/examples/learn/custom_drawing.rs b/crates/gpui/examples/learn/custom_drawing.rs index 1f4dd9c5fe..49e743769c 100644 --- a/crates/gpui/examples/learn/custom_drawing.rs +++ b/crates/gpui/examples/learn/custom_drawing.rs @@ -9,12 +9,12 @@ use gpui::colors::Colors; use gpui::{ - App, Application, Bounds, Context, Hsla, MouseButton, MouseDownEvent, MouseMoveEvent, + App, Bounds, Context, Hsla, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Path, PathBuilder, Pixels, Point, Render, Rgba, Window, WindowBounds, WindowOptions, canvas, div, fill, point, prelude::*, px, rgb, size, }; -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; // Example 1: Basic Canvas Drawing diff --git a/crates/gpui/examples/learn/interactive_elements.rs b/crates/gpui/examples/learn/interactive_elements.rs index b36bc6413f..523b81482c 100644 --- a/crates/gpui/examples/learn/interactive_elements.rs +++ b/crates/gpui/examples/learn/interactive_elements.rs @@ -7,13 +7,13 @@ //! 3. Mouse events - mouse down, mouse up, mouse move //! 4. Drag and drop - draggable elements and drop targets -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; use example_prelude::init_example; use gpui::colors::Colors; use gpui::{ - App, Application, Bounds, ClickEvent, Context, Entity, Half, Hsla, IntoElement, MouseButton, + App, Bounds, ClickEvent, Context, Entity, Half, Hsla, IntoElement, MouseButton, MouseMoveEvent, Pixels, Point, Render, Window, WindowBounds, WindowOptions, div, prelude::*, px, rgb, size, }; diff --git a/crates/gpui/examples/learn/layout.rs b/crates/gpui/examples/learn/layout.rs index f72d7016a6..66bfa73027 100644 --- a/crates/gpui/examples/learn/layout.rs +++ b/crates/gpui/examples/learn/layout.rs @@ -6,13 +6,13 @@ //! 2. Grid - Two-dimensional layouts with spans //! 3. Common patterns - Sidebar, header/footer, centering -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; use example_prelude::init_example; use gpui::colors::Colors; use gpui::{ - App, Application, Bounds, Context, Div, Hsla, Render, Rgba, Window, WindowBounds, + App, Bounds, Context, Div, Hsla, Render, Rgba, Window, WindowBounds, WindowOptions, div, prelude::*, px, size, }; diff --git a/crates/gpui/examples/learn/styling.rs b/crates/gpui/examples/learn/styling.rs index 21f6031624..f40fa4cb64 100644 --- a/crates/gpui/examples/learn/styling.rs +++ b/crates/gpui/examples/learn/styling.rs @@ -8,7 +8,7 @@ use gpui::colors::Colors; use gpui::{ - App, Application, Bounds, Context, FocusHandle, Hsla, KeyBinding, Menu, MenuItem, Render, Rgba, + App, Bounds, Context, FocusHandle, Hsla, KeyBinding, Menu, MenuItem, Render, Rgba, Window, WindowBounds, WindowOptions, actions, div, prelude::*, px, rgb, size, }; @@ -493,7 +493,7 @@ fn main() { items: vec![MenuItem::action("Quit", Quit)], disabled: false, }]); - cx.on_window_closed(|cx| { + cx.on_window_closed(|cx, _window_id| { if cx.windows().is_empty() { cx.quit(); } diff --git a/crates/gpui/examples/learn/text.rs b/crates/gpui/examples/learn/text.rs index 5e724f8f1c..30ff8261e1 100644 --- a/crates/gpui/examples/learn/text.rs +++ b/crates/gpui/examples/learn/text.rs @@ -9,13 +9,13 @@ //! 5. Styled Text - Inline style variations with highlights //! 6. Character Grid - Unicode and emoji support -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; use example_prelude::init_example; use gpui::{ - App, Application, Bounds, Context, FontStyle, FontWeight, Hsla, Render, StyledText, - TextOverflow, Window, WindowBounds, WindowOptions, colors::Colors, current_platform, div, + App, Bounds, Context, FontStyle, FontWeight, Hsla, Render, StyledText, + TextOverflow, Window, WindowBounds, WindowOptions, colors::Colors, div, prelude::*, px, relative, rgb, size, }; diff --git a/crates/gpui/examples/learn/transition.rs b/crates/gpui/examples/learn/transition.rs index ce5f667b97..d5c0509536 100644 --- a/crates/gpui/examples/learn/transition.rs +++ b/crates/gpui/examples/learn/transition.rs @@ -2,7 +2,7 @@ //! //! This example demonstrates transition capabilities in GPUI via `use_keyed_transition`. -#[path = "../prelude.rs"] +#[path = "../shared/prelude.rs"] mod example_prelude; use std::time::Duration; diff --git a/crates/gpui/examples/legacy/focus_visible.rs b/crates/gpui/examples/legacy/focus_visible.rs index e704d82506..2cab61de4f 100644 --- a/crates/gpui/examples/legacy/focus_visible.rs +++ b/crates/gpui/examples/legacy/focus_visible.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString, + App, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString, Stateful, Window, WindowBounds, WindowOptions, actions, div, prelude::*, px, size, }; diff --git a/crates/gpui/examples/legacy/gif_viewer.rs b/crates/gpui/examples/legacy/gif_viewer.rs index bec9047b4e..ca00688ce6 100644 --- a/crates/gpui/examples/legacy/gif_viewer.rs +++ b/crates/gpui/examples/legacy/gif_viewer.rs @@ -1,4 +1,4 @@ -use gpui::{App, Application, Context, Render, Window, WindowOptions, div, img, prelude::*}; +use gpui::{App, Context, Render, Window, WindowOptions, div, img, prelude::*}; use std::path::PathBuf; struct GifViewer { diff --git a/crates/gpui/examples/legacy/gradient.rs b/crates/gpui/examples/legacy/gradient.rs index 8b1f9970ef..d1d2f92720 100644 --- a/crates/gpui/examples/legacy/gradient.rs +++ b/crates/gpui/examples/legacy/gradient.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, canvas, + App, Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, size, }; diff --git a/crates/gpui/examples/legacy/hello_world.rs b/crates/gpui/examples/legacy/hello_world.rs index 32706515eb..7850ff4f11 100644 --- a/crates/gpui/examples/legacy/hello_world.rs +++ b/crates/gpui/examples/legacy/hello_world.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div, + App, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div, prelude::*, px, rgb, size, }; diff --git a/crates/gpui/examples/legacy/image/image.rs b/crates/gpui/examples/legacy/image/image.rs index a8e282ce8e..1e7649437d 100644 --- a/crates/gpui/examples/legacy/image/image.rs +++ b/crates/gpui/examples/legacy/image/image.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use anyhow::Result; use gpui::{ - actions, div, img, prelude::*, px, rgb, size, App, AppContext, Application, AssetSource, + actions, div, img, prelude::*, px, rgb, size, App, AppContext, AssetSource, Bounds, Context, ImageSource, KeyBinding, Menu, MenuItem, Point, SharedString, SharedUri, TitlebarOptions, Window, WindowBounds, WindowOptions, }; diff --git a/crates/gpui/examples/legacy/image_loading.rs b/crates/gpui/examples/legacy/image_loading.rs index ec0f2ea1d5..7c59f34020 100644 --- a/crates/gpui/examples/legacy/image_loading.rs +++ b/crates/gpui/examples/legacy/image_loading.rs @@ -1,7 +1,7 @@ use std::{path::Path, sync::Arc, time::Duration}; use gpui::{ - Animation, AnimationExt, App, Application, Asset, AssetLogger, AssetSource, Bounds, Context, + Animation, AnimationExt, App, Asset, AssetLogger, AssetSource, Bounds, Context, Hsla, ImageAssetLoader, ImageCacheError, ImgResourceLoader, LOADING_DELAY, Length, RenderImage, Resource, SharedString, Window, WindowBounds, WindowOptions, black, div, img, prelude::*, pulsating_between, px, red, size, diff --git a/crates/gpui/examples/legacy/input.rs b/crates/gpui/examples/legacy/input.rs index 0ea91ca75e..7eb708c0bb 100644 --- a/crates/gpui/examples/legacy/input.rs +++ b/crates/gpui/examples/legacy/input.rs @@ -1,7 +1,7 @@ use std::ops::Range; use gpui::{ - App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId, ElementInputHandler, + App, Bounds, ClipboardItem, Context, CursorStyle, ElementId, ElementInputHandler, Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId, KeyBinding, Keystroke, LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point, ShapedLine, SharedString, Style, TextRun, UTF16Selection, UnderlineStyle, Window, WindowBounds, diff --git a/crates/gpui/examples/legacy/layer_shell.rs b/crates/gpui/examples/legacy/layer_shell.rs index 0f8baa989a..1ac3078203 100644 --- a/crates/gpui/examples/legacy/layer_shell.rs +++ b/crates/gpui/examples/legacy/layer_shell.rs @@ -11,7 +11,7 @@ mod example { use std::time::{Duration, SystemTime, UNIX_EPOCH}; use gpui::{ - App, Application, Bounds, Context, FontWeight, Size, Window, WindowBackgroundAppearance, + App, Bounds, Context, FontWeight, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowKind, WindowOptions, div, layer_shell::*, point, prelude::*, px, rems, rgba, white, }; diff --git a/crates/gpui/examples/legacy/on_window_close_quit.rs b/crates/gpui/examples/legacy/on_window_close_quit.rs index c615bfe627..e91babdb3b 100644 --- a/crates/gpui/examples/legacy/on_window_close_quit.rs +++ b/crates/gpui/examples/legacy/on_window_close_quit.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, FocusHandle, KeyBinding, Window, WindowBounds, + App, Bounds, Context, FocusHandle, KeyBinding, Window, WindowBounds, WindowOptions, actions, div, prelude::*, px, rgb, size, }; @@ -39,7 +39,7 @@ fn main() { let mut bounds = Bounds::centered(None, size(px(500.), px(500.0)), cx); cx.bind_keys([KeyBinding::new("cmd-w", CloseWindow, None)]); - cx.on_window_closed(|cx| { + cx.on_window_closed(|cx, _| { if cx.windows().is_empty() { cx.quit(); } diff --git a/crates/gpui/examples/legacy/opacity.rs b/crates/gpui/examples/legacy/opacity.rs index d7104f9202..6a7c7db7be 100644 --- a/crates/gpui/examples/legacy/opacity.rs +++ b/crates/gpui/examples/legacy/opacity.rs @@ -2,7 +2,7 @@ use std::{fs, path::PathBuf}; use anyhow::Result; use gpui::{ - App, Application, AssetSource, Bounds, BoxShadow, ClickEvent, Context, SharedString, Task, + App, AssetSource, Bounds, BoxShadow, ClickEvent, Context, SharedString, Task, Window, WindowBounds, WindowOptions, div, hsla, img, point, prelude::*, px, rgb, size, svg, }; @@ -116,6 +116,7 @@ impl Render for HelloWorld { blur_radius: px(1.0), spread_radius: px(5.0), offset: point(px(10.0), px(10.0)), + inset: false, }]) .child(img("image/app-icon.png").size_8()) .child("Opacity Panel (Click to test)") diff --git a/crates/gpui/examples/legacy/scrollable.rs b/crates/gpui/examples/legacy/scrollable.rs index 2e42bde94c..0cf909da3f 100644 --- a/crates/gpui/examples/legacy/scrollable.rs +++ b/crates/gpui/examples/legacy/scrollable.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, + App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, size, }; diff --git a/crates/gpui/examples/legacy/svg/svg.rs b/crates/gpui/examples/legacy/svg/svg.rs index daa1c4d06e..82a0d63b50 100644 --- a/crates/gpui/examples/legacy/svg/svg.rs +++ b/crates/gpui/examples/legacy/svg/svg.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; use anyhow::Result; use gpui::{ - App, Application, AssetSource, Bounds, Context, SharedString, Window, WindowBounds, - WindowOptions, current_platform, div, prelude::*, px, rgb, size, svg, + App, AssetSource, Bounds, Context, SharedString, Window, WindowBounds, + WindowOptions, div, prelude::*, px, rgb, size, svg, }; struct Assets { diff --git a/crates/gpui/examples/legacy/tab_stop.rs b/crates/gpui/examples/legacy/tab_stop.rs index 8e126b7b96..076e3da085 100644 --- a/crates/gpui/examples/legacy/tab_stop.rs +++ b/crates/gpui/examples/legacy/tab_stop.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString, + App, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString, Stateful, Window, WindowBounds, WindowOptions, actions, div, prelude::*, px, size, }; diff --git a/crates/gpui/examples/legacy/tree.rs b/crates/gpui/examples/legacy/tree.rs index 506632ed56..49dbd5510c 100644 --- a/crates/gpui/examples/legacy/tree.rs +++ b/crates/gpui/examples/legacy/tree.rs @@ -3,7 +3,7 @@ use std::sync::LazyLock; use gpui::{ - App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, + App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, size, }; diff --git a/crates/gpui/examples/legacy/uniform_list.rs b/crates/gpui/examples/legacy/uniform_list.rs index e84d74b049..5866e50043 100644 --- a/crates/gpui/examples/legacy/uniform_list.rs +++ b/crates/gpui/examples/legacy/uniform_list.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, + App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, rgb, size, uniform_list, }; diff --git a/crates/gpui/examples/legacy/window.rs b/crates/gpui/examples/legacy/window.rs index d2a0bc3797..f9b6afdacd 100644 --- a/crates/gpui/examples/legacy/window.rs +++ b/crates/gpui/examples/legacy/window.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Window, WindowBounds, + App, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Window, WindowBounds, WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size, }; diff --git a/crates/gpui/examples/legacy/window_positioning.rs b/crates/gpui/examples/legacy/window_positioning.rs index 40606f0bf1..a383bb1148 100644 --- a/crates/gpui/examples/legacy/window_positioning.rs +++ b/crates/gpui/examples/legacy/window_positioning.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, DisplayId, Hsla, Pixels, SharedString, Size, Window, + App, Bounds, Context, DisplayId, Hsla, Pixels, SharedString, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowKind, WindowOptions, div, point, prelude::*, px, rgb, }; diff --git a/crates/gpui/examples/legacy/window_shadow.rs b/crates/gpui/examples/legacy/window_shadow.rs index fb96d8cbac..d842df56a3 100644 --- a/crates/gpui/examples/legacy/window_shadow.rs +++ b/crates/gpui/examples/legacy/window_shadow.rs @@ -1,5 +1,5 @@ use gpui::{ - App, Application, Bounds, Context, CursorStyle, Decorations, HitboxBehavior, Hsla, MouseButton, + App, Bounds, Context, CursorStyle, Decorations, HitboxBehavior, Hsla, MouseButton, Pixels, Point, ResizeEdge, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowOptions, black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black, white, @@ -114,6 +114,7 @@ impl Render for WindowShadow { blur_radius: shadow_size / 2., spread_radius: px(0.), offset: point(px(0.0), px(0.0)), + inset: false, }]) }), }) @@ -154,6 +155,7 @@ impl Render for WindowShadow { blur_radius: px(20.0), spread_radius: px(0.0), offset: point(px(0.0), px(0.0)), + inset: false, }]) .map(|div| match decorations { Decorations::Server => div, diff --git a/crates/gpui/examples/prelude.rs b/crates/gpui/examples/shared/prelude.rs similarity index 96% rename from crates/gpui/examples/prelude.rs rename to crates/gpui/examples/shared/prelude.rs index 466abf185f..9135aa423e 100644 --- a/crates/gpui/examples/prelude.rs +++ b/crates/gpui/examples/shared/prelude.rs @@ -3,7 +3,7 @@ //! Common helpers for GPUI examples. Import with: //! //! ```ignore -//! #[path = "../prelude.rs"] +//! #[path = "../shared/prelude.rs"] //! mod example_prelude; //! use example_prelude::init_example; //! ``` diff --git a/crates/gpui_macos/src/window.rs b/crates/gpui_macos/src/window.rs index 68cb31d9ea..1793917861 100644 --- a/crates/gpui_macos/src/window.rs +++ b/crates/gpui_macos/src/window.rs @@ -1724,7 +1724,7 @@ impl PlatformWindow for MacWindow { } fn play_system_bell(&self) { - unsafe { NSBeep() } + NSBeep() } #[cfg(any(test, feature = "test-support"))]