Port · Build: Zed's gpui at 1a28cff
gpui and gpui_platform now come from Zed's repo by git at 1a28cff, the code gpui-pre 0.3.7 republishes, so the gallery can later build for the browser. gpui takes stacker, as 0.2.2 always did, and gpui_platform takes font-kit, without which macOS draws no text; runtime_shaders moves to gpui_platform. The API moved: focus, blur and Tab steps take cx, Corner is Anchor, shaped lines paint with an alignment, defer_draw takes a content mask, the inspector registers a factory, async updates return their value, and wrapped lines are shared, not cloned. Updates through a window context go through the window, so a closed window still ends them as it did. Where the new gpui behaves differently, Ely keeps its old intent. Holds and reveals under a resting pointer survive typing through gpui's input-modality-independent hover; previews the keyboard also moves keep the default, and the calendar's leave ignores a key press. Enter reaches a button inside the code editor, since gpui now arms a key click on the press. The event logger skips a lone modifier. A video and an image grid keep their shape in a flex column under taffy 0.13, as a picture does. AGENTS.md records the new stack and the rules this port changes; the rest of the old gpui and taffy rules are re-tested in T44c.
This commit is contained in:
1 parent
25b8a6f22c
commit
4c3ed1bbb9
199 files changed
+2513
-2643
No files matched your search
+14
-14
@@ -70,9 +70,9 @@ impl RenderOnce for FocusScope {
|
||||
if self.root {
|
||||
let handle = self.handle.clone();
|
||||
window.use_keyed_state("focus-root", cx, |window, cx| Root {
|
||||
_lost: cx.on_focus_lost(window, move |_: &mut Root, window, _| {
|
||||
_lost: cx.on_focus_lost(window, move |_: &mut Root, window, cx| {
|
||||
log::info!("focus: its element left the tree; the root takes it");
|
||||
window.focus(&handle);
|
||||
window.focus(&handle, cx);
|
||||
}),
|
||||
});
|
||||
}
|
||||
@@ -85,21 +85,21 @@ impl RenderOnce for FocusScope {
|
||||
}
|
||||
|
||||
fn step(scope: &FocusHandle, trap: bool, forward: bool, window: &mut Window, cx: &mut App) {
|
||||
let advance = |window: &mut Window| {
|
||||
let advance = |window: &mut Window, cx: &mut App| {
|
||||
if forward {
|
||||
window.focus_next()
|
||||
window.focus_next(cx)
|
||||
} else {
|
||||
window.focus_prev()
|
||||
window.focus_prev(cx)
|
||||
}
|
||||
};
|
||||
if !trap {
|
||||
advance(window);
|
||||
advance(window, cx);
|
||||
return;
|
||||
}
|
||||
let origin = window.focused(cx);
|
||||
let mut first = None;
|
||||
loop {
|
||||
advance(window);
|
||||
advance(window, cx);
|
||||
let focused = window.focused(cx);
|
||||
if scope.contains_focused(window, cx) && focused.as_ref() != Some(scope) {
|
||||
return;
|
||||
@@ -113,7 +113,7 @@ fn step(scope: &FocusHandle, trap: bool, forward: bool, window: &mut Window, cx:
|
||||
}
|
||||
log::warn!("focus scope: trap holds no tab stop; focus stays");
|
||||
if let Some(origin) = origin {
|
||||
window.focus(&origin);
|
||||
window.focus(&origin, cx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,16 +137,16 @@ pub(crate) fn take_focus(
|
||||
previous: None,
|
||||
taken: false,
|
||||
returned: false,
|
||||
_lost: cx.on_focus_lost(window, |takeover: &mut Takeover, window, _| {
|
||||
_lost: cx.on_focus_lost(window, |takeover: &mut Takeover, window, cx| {
|
||||
if !takeover.returned {
|
||||
log::info!("focus: its element left the tree; the overlay takes it back");
|
||||
window.focus(&takeover.focus);
|
||||
window.focus(&takeover.focus, cx);
|
||||
}
|
||||
}),
|
||||
});
|
||||
if !state.read(cx).taken {
|
||||
let previous = window.focused(cx);
|
||||
window.focus(&state.read(cx).focus.clone());
|
||||
window.focus(&state.read(cx).focus.clone(), cx);
|
||||
state.update(cx, |takeover, _| {
|
||||
takeover.previous = previous;
|
||||
takeover.taken = true;
|
||||
@@ -163,7 +163,7 @@ pub(crate) fn give_back(state: &Entity<Takeover>, window: &mut Window, cx: &mut
|
||||
});
|
||||
match previous {
|
||||
Some(previous) => {
|
||||
window.focus(&previous);
|
||||
window.focus(&previous, cx);
|
||||
log::info!("focus: handed back after an overlay");
|
||||
}
|
||||
None => log::info!("focus: overlay closed, nothing was focused before"),
|
||||
@@ -193,7 +193,7 @@ pub(crate) fn hold_focus(
|
||||
if on && !was_on && !focus.contains_focused(window, cx) {
|
||||
log::info!("focus: a mode takes it, so Escape reaches it");
|
||||
let previous = window.focused(cx);
|
||||
window.focus(&focus);
|
||||
window.focus(&focus, cx);
|
||||
held.update(cx, |held, _| held.previous = previous);
|
||||
}
|
||||
if on != was_on {
|
||||
@@ -206,7 +206,7 @@ pub(crate) fn hold_focus(
|
||||
pub(crate) fn hand_back(held: &Entity<Held>, window: &mut Window, cx: &mut App) {
|
||||
if let Some(previous) = held.update(cx, |held, _| held.previous.take()) {
|
||||
log::info!("focus: handed back after a mode");
|
||||
window.focus(&previous);
|
||||
window.focus(&previous, cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ impl Element for Raised {
|
||||
) {
|
||||
let child = self.child.take().expect("a raised element prepaints once");
|
||||
if !self.nested {
|
||||
window.defer_draw(child, window.element_offset(), self.priority);
|
||||
window.defer_draw(child, window.element_offset(), self.priority, None);
|
||||
return;
|
||||
}
|
||||
LAYERS.with_borrow_mut(|layers| {
|
||||
|
||||
@@ -113,7 +113,7 @@ fn a_raise_keeps_its_state_while_another_comes_before_it(cx: &mut TestAppContext
|
||||
cx.run_until_parked();
|
||||
let first = seen.borrow().last().cloned().expect("the box drew");
|
||||
let handle = first.read_with(cx, |handle, _| handle.clone());
|
||||
cx.update(|window, _| window.focus(&handle));
|
||||
cx.update(|window, cx| window.focus(&handle, cx));
|
||||
view.update(cx, |nest, cx| {
|
||||
nest.tip = true;
|
||||
cx.notify();
|
||||
|
||||
@@ -2,9 +2,9 @@ use std::{rc::Rc, time::Duration};
|
||||
|
||||
use gpui::{
|
||||
Animation, AnimationExt, AnyElement, AnyView, App, AppContext, Context, Div, ElementId,
|
||||
InteractiveElement, IntoElement, ParentElement, Pixels, Point, Render, RenderOnce,
|
||||
SharedString, StatefulInteractiveElement, Styled, Task, Window, anchored, div, point,
|
||||
prelude::*,
|
||||
HoverListenerMode, InteractiveElement, IntoElement, ParentElement, Pixels, Point, Render,
|
||||
RenderOnce, SharedString, StatefulInteractiveElement, Styled, Task, Window, anchored, div,
|
||||
point, prelude::*,
|
||||
};
|
||||
|
||||
use super::{Icon, IconName, raise};
|
||||
@@ -143,6 +143,7 @@ impl RenderOnce for TooltipTrigger {
|
||||
div()
|
||||
.id(self.id)
|
||||
.child(self.child)
|
||||
.hover_listener_mode(HoverListenerMode::InputModalityIndependent)
|
||||
.on_hover(move |hovered, window, cx| {
|
||||
if !*hovered {
|
||||
hover.update(cx, hide);
|
||||
|
||||
Reference in new issue
Block a user