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

+4 -5
View File
@@ -2,8 +2,7 @@ use std::rc::Rc;
use gpui::{
Animation, AnimationExt, AnyElement, App, Bounds, ElementId, Entity, InteractiveElement,
IntoElement, ParentElement, Pixels, Point, Styled, Window, anchored, canvas, deferred, div,
prelude::*,
IntoElement, ParentElement, Pixels, Point, Styled, Window, anchored, canvas, div, prelude::*,
};
use super::{
@@ -13,7 +12,7 @@ use super::{
use crate::{
forms::{Down, Enter, Run, TextInput, Up, float},
motion,
primitives::{Icon, IconName, Takeover, give_back, take_focus},
primitives::{Icon, IconName, Takeover, give_back, raise, take_focus},
theme::{ActiveTheme, IconSize},
};
@@ -384,7 +383,7 @@ pub(crate) fn hang(
});
let placed = match spot {
Spot::Under => float(state.read(cx).anchor, menu.entries.len(), root, window, cx),
Spot::At(point) => deferred(anchored().position(point).snap_to_window().child(
Spot::At(point) => raise(anchored().position(point).snap_to_window().child(
root.with_animation((id.clone(), "in"), enter.clone(), |root, t| root.opacity(t)),
))
.with_priority(1)
@@ -393,7 +392,7 @@ pub(crate) fn hang(
let subs = (1..depth).filter_map(|level| {
let row = state.read(cx).levels[level - 1].row;
(row != Bounds::default()).then(|| {
deferred(
raise(
anchored().position(row.top_right()).snap_to_window().child(
draw::panel(id, menu, state, level, &close, None, cx)
.mt_neg_1()
+3 -3
View File
@@ -3,14 +3,14 @@ use std::{f32::consts::TAU, rc::Rc};
use gpui::{
Animation, AnimationExt, AnyElement, App, Bounds, ElementId, Entity, FontWeight,
InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, Point, RenderOnce,
SharedString, Styled, Window, anchored, canvas, deferred, div, point,
SharedString, Styled, Window, anchored, canvas, div, point,
};
use smallvec::SmallVec;
use crate::{
forms::{Pick, Run},
motion,
primitives::{Icon, IconName, give_back, take_focus},
primitives::{Icon, IconName, give_back, raise, take_focus},
theme::{ActiveTheme, Elevation, IconSize, TextSize},
};
@@ -302,7 +302,7 @@ impl RenderOnce for PieMenu {
}
});
region.child(
deferred(
raise(
anchored()
.position(point(Pixels::ZERO, Pixels::ZERO))
.child(