Primitives · raise: what opens inside a dialog lies over it

gpui 0.2.2 asserts on a deferred draw inside another, and every dialog,
sheet and popover draws inside one, so opening a date field in the
snooze or schedule dialog panicked, as would any list, menu or picker
opened in an overlay. primitives::raise replaces each deferred draw:
at the top it defers as before; inside something raised it leaves a
placeholder in the tree, and its layer lays it out on its own, then
draws it last. check.sh refuses gpui's deferred anywhere else.

The time dialog's rule is now times::ahead, tested for a moment
behind, now itself, a moment ahead and another zone; a gpui test picks
yesterday in the snooze dialog, sees that it has passed and that
nothing is sent, then picks two days ahead and hears that moment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 01:51:51 -04:00
1 parent 5b0a8443a7
commit 9abab5f2ba
20 files changed
+405 -49

No files matched your search

+3 -3
View File
@@ -3,7 +3,7 @@ use std::rc::Rc;
use gpui::{
Animation, AnimationExt, AnyElement, App, ElementId, FocusHandle, FontWeight,
InteractiveElement, IntoElement, ParentElement, Pixels, RenderOnce, SharedString, Styled,
Window, anchored, deferred, div, point, prelude::*,
Window, anchored, div, point, prelude::*,
};
use smallvec::SmallVec;
@@ -11,7 +11,7 @@ use crate::{
buttons::{ButtonVariant, IconButton},
forms::{Enter, Run},
motion,
primitives::{Backdrop, FocusScope, IconName, give_back, take_focus},
primitives::{Backdrop, FocusScope, IconName, give_back, raise, take_focus},
theme::{ActiveTheme, Elevation, Radius, TextSize},
};
@@ -270,7 +270,7 @@ impl RenderOnce for Dialog {
if fullscreen {
let viewport = window.viewport_size();
let top = cx.theme().titlebar_height().to_pixels(window.rem_size());
return deferred(
return raise(
anchored().position(point(Pixels::ZERO, top)).child(
div()
.w(viewport.width)
+4 -4
View File
@@ -2,8 +2,8 @@ use std::rc::Rc;
use gpui::{
AnimationExt, AnyElement, App, Corner, ElementId, Entity, FontWeight, InteractiveElement,
IntoElement, ParentElement, RenderOnce, SharedString, Styled, Window, anchored, canvas,
deferred, div, point, prelude::*,
IntoElement, ParentElement, RenderOnce, SharedString, Styled, Window, anchored, canvas, div,
point, prelude::*,
};
use smallvec::SmallVec;
@@ -12,7 +12,7 @@ use crate::{
forms::{Run, TextInput, surface},
layout::Collapsible,
motion,
primitives::IconName,
primitives::{IconName, raise},
theme::{ActiveTheme, ControlSize, TextSize},
};
@@ -68,7 +68,7 @@ impl RenderOnce for FloatingToolbar {
.when_some(anchor, |host, anchor| {
let lift = cx.theme().float_gap().to_pixels(window.rem_size());
host.child(
deferred(
raise(
anchored()
.position(anchor.origin - point(gpui::Pixels::ZERO, lift))
.anchor(Corner::BottomLeft)
+3 -3
View File
@@ -3,14 +3,14 @@ use std::rc::Rc;
use gpui::{
Animation, AnimationExt, App, Div, ElementId, ImageSource, InteractiveElement, IntoElement,
MouseButton, ObjectFit, ParentElement, Pixels, Point, RenderOnce, SharedString, Size, Stateful,
StatefulInteractiveElement, Styled, Window, anchored, canvas, deferred, div, prelude::*,
StatefulInteractiveElement, Styled, Window, anchored, canvas, div, prelude::*,
};
use crate::{
buttons::label_size,
forms::Run,
motion,
primitives::{FocusRing, FocusScope, Icon, IconName, Image, give_back, take_focus},
primitives::{FocusRing, FocusScope, Icon, IconName, Image, give_back, raise, take_focus},
theme::{ActiveTheme, ControlSize, TextSize},
};
@@ -291,7 +291,7 @@ impl RenderOnce for Lightbox {
),
),
);
deferred(anchored().position(Point::default()).child(stage))
raise(anchored().position(Point::default()).child(stage))
.with_priority(1)
.into_any_element()
}
+3 -3
View File
@@ -3,14 +3,14 @@ use std::{cell::RefCell, rc::Rc};
use gpui::{
Animation, AnimationExt, AnyElement, App, Bounds, ElementId, FontWeight, InteractiveElement,
IntoElement, ParentElement, Pixels, Point, RenderOnce, SharedString, Styled, Subscription,
Window, anchored, canvas, deferred, div, point, prelude::*, size,
Window, anchored, canvas, div, point, prelude::*, size,
};
use crate::{
buttons::{Button, ButtonVariant},
forms::{Run, float_height, surface},
motion,
primitives::{FocusScope, give_back, take_focus},
primitives::{FocusScope, give_back, raise, take_focus},
theme::{ActiveTheme, Radius, TextSize},
};
@@ -192,7 +192,7 @@ fn light(
);
div()
.child(
deferred(
raise(
anchored()
.position(Point::default())
.child(div().w(viewport.width).h(viewport.height).child(frame)),