diff --git a/crates/fluent-layout/src/command_palette.rs b/crates/fluent-layout/src/command_palette.rs index aa0c7d6..99d7a46 100644 --- a/crates/fluent-layout/src/command_palette.rs +++ b/crates/fluent-layout/src/command_palette.rs @@ -417,7 +417,7 @@ impl Render for CommandPalette { // Self-focus on the first frame after opening if !self.focus_handle.is_focused(window) { - window.focus(&self.focus_handle); + window.focus(&self.focus_handle, cx); } let theme = cx.theme(); diff --git a/crates/fluent-layout/src/context_menu.rs b/crates/fluent-layout/src/context_menu.rs index 31c2024..b326e89 100644 --- a/crates/fluent-layout/src/context_menu.rs +++ b/crates/fluent-layout/src/context_menu.rs @@ -666,7 +666,7 @@ impl Render for ContextMenu { self.ensure_selection(); } if !self.closing && !focus_handle.is_focused(window) { - window.focus(&focus_handle); + window.focus(&focus_handle, cx); } let theme = cx.theme(); @@ -714,7 +714,7 @@ mod tests { use std::time::Duration; use fluent_test_utils::init_fluent_test; - use gpui::{point, px, AppContext as _, TestAppContext}; + use gpui::{point, px, TestAppContext}; use super::*; diff --git a/crates/fluent-layout/src/menu_bar.rs b/crates/fluent-layout/src/menu_bar.rs index 2b281b5..8e5d9d0 100644 --- a/crates/fluent-layout/src/menu_bar.rs +++ b/crates/fluent-layout/src/menu_bar.rs @@ -691,7 +691,7 @@ impl Render for MenuBar { } }) .on_mouse_down(MouseButton::Left, move |_, win, cx| { - win.focus(&focus_handle); + win.focus(&focus_handle, cx); sw_click .update(cx, |bar, cx| { if bar.open_index == Some(idx) && !bar.closing { @@ -788,7 +788,7 @@ mod tests { use std::time::Duration; use fluent_test_utils::init_fluent_test; - use gpui::{AppContext as _, TestAppContext}; + use gpui::TestAppContext; use super::*; diff --git a/crates/fluent-layout/src/menu_button.rs b/crates/fluent-layout/src/menu_button.rs index 3824d52..bf9ebac 100644 --- a/crates/fluent-layout/src/menu_button.rs +++ b/crates/fluent-layout/src/menu_button.rs @@ -2,8 +2,8 @@ use std::sync::{Arc, Mutex}; use fluent_core::{Theme, ThemeProvider as _}; use gpui::{ - anchored, canvas, deferred, div, point, prelude::*, px, svg, App, Bounds, ClickEvent, Context, - Corner, ElementId, FocusHandle, IntoElement, KeyDownEvent, MouseButton, Pixels, Point, Render, + anchored, canvas, deferred, div, point, prelude::*, px, svg, Anchor, App, Bounds, ClickEvent, + Context, ElementId, FocusHandle, IntoElement, KeyDownEvent, MouseButton, Pixels, Point, Render, SharedString, WeakEntity, Window, }; @@ -628,7 +628,7 @@ impl Render for MenuButton { }) .on_click(cx.listener( move |button: &mut MenuButton, ev: &ClickEvent, window, cx| { - window.focus(&focus_handle); + window.focus(&focus_handle, cx); button.update_origin(point( ev.position().x, ev.position().y + px(cx.theme().components.dropdown_height), @@ -682,7 +682,7 @@ impl Render for MenuButton { root = root.child(deferred( overlay.child( anchored() - .anchor(Corner::TopLeft) + .anchor(Anchor::TopLeft) .position(self.popup_origin) .snap_to_window() .child(menu), @@ -699,7 +699,7 @@ mod tests { use std::time::Duration; use fluent_test_utils::init_fluent_test; - use gpui::{AppContext as _, ClickEvent, TestAppContext}; + use gpui::{ClickEvent, TestAppContext}; use super::*; diff --git a/crates/fluent-layout/src/popover.rs b/crates/fluent-layout/src/popover.rs index 94d4ff9..3a702fc 100644 --- a/crates/fluent-layout/src/popover.rs +++ b/crates/fluent-layout/src/popover.rs @@ -1,6 +1,6 @@ use fluent_core::ThemeProvider as _; use gpui::{ - anchored, deferred, div, prelude::*, px, AnyElement, Corner, IntoElement, Point, RenderOnce, + anchored, deferred, div, prelude::*, px, Anchor, AnyElement, IntoElement, Point, RenderOnce, Window, }; @@ -9,7 +9,7 @@ use gpui::{ pub struct Popover { open: bool, position: Point, - anchor: Corner, + anchor: Anchor, content: AnyElement, } @@ -18,7 +18,7 @@ impl Popover { Self { open: true, position, - anchor: Corner::TopLeft, + anchor: Anchor::TopLeft, content: content.into_any_element(), } } @@ -28,7 +28,7 @@ impl Popover { self } - pub fn anchor(mut self, anchor: Corner) -> Self { + pub fn anchor(mut self, anchor: Anchor) -> Self { self.anchor = anchor; self } diff --git a/crates/fluent-layout/src/toast.rs b/crates/fluent-layout/src/toast.rs index ba2d62a..5758477 100644 --- a/crates/fluent-layout/src/toast.rs +++ b/crates/fluent-layout/src/toast.rs @@ -90,7 +90,7 @@ impl ToastStack { if let Some(timeout) = timeout { cx.spawn(async move |cx| { cx.background_executor().timer(timeout).await; - cx.update(|cx| ToastStack::dismiss(id.as_ref(), cx)).ok(); + cx.update(|cx| ToastStack::dismiss(id.as_ref(), cx)); }) .detach(); } diff --git a/docs/gpui-api-drift.md b/docs/gpui-api-drift.md index d5c2d10..314fb97 100644 --- a/docs/gpui-api-drift.md +++ b/docs/gpui-api-drift.md @@ -155,4 +155,5 @@ signature diff. The rows known to matter are called out under "Notes". |---|---|---| | `fluent-core` | WI-1425 | No source change. Every symbol it imports is in "unchanged" above, and `cargo check`, `cargo test` (22 unit tests) and `cargo clippy --no-deps -D warnings` pass against `vendor/zed` with the public API untouched. | | `fluent-primitives` | WI-1426 | Compiles, 27 unit tests pass, `cargo clippy --all-targets --no-deps -D warnings` is clean. The location check above missed five signature changes, all forced by the vendored gpui and each a mechanical adaptation: `Window::focus`, `focus_next` and `focus_prev` now take `&mut App`; `ShapedLine::paint` takes a `TextAlign` and an optional align width (passed `Left` and `None`, the previous implicit behaviour); `Styled::text_style()` returns the refinement directly instead of an `Option`; `ElementId::NamedChild` holds an `Arc` instead of a `Box`; and `Corner` is gone, replaced by `gpui::Anchor`. The crate re-exports its own four-variant `Corner` that converts into `Anchor`, so the popover anchor API the later crates use does not change. | +| `fluent-layout` | WI-1428 | Compiles, 37 unit tests pass, `cargo clippy --all-targets --no-deps -D warnings` is clean. Three changes, all forced by the vendored gpui: `Window::focus` takes `&mut App`; `AsyncApp::update` returns its value directly instead of a `Result`, so the toast timeout's `.ok()` is gone; and `gpui::Corner` is gone. `Popover::anchor` now takes `gpui::Anchor` instead of `Corner`, and the menu button anchors its popup at `Anchor::TopLeft`. | | `fluent-ribbon` | WI-1427 | No source change. Every gpui symbol it uses (`App`, `AnyElement`, `ClickEvent`, `Context`, `FontWeight`, `IntoElement`, `Render`, `SharedString`, `Window`, `div`, `prelude`, `px`, `svg`) is in "unchanged" above, and `cargo check`, `cargo test` (no unit tests; one ignored doc-test) and `cargo clippy --all-targets --no-deps -D warnings` pass against `vendor/zed` with the public API untouched. |