Resize border: glass leaves a see-through window's pane to its content, without ground or shadow
CI / platforms (windows-latest) (push) Failing after 10s
CI / site (push) Successful in 22s
CI / crate (push) Failing after 11m28s
CI / platforms (ubuntu-24.04) (push) Canceled after 0s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-15 01:01:26 -04:00
1 parent 2594b3fd0f
commit 5dc4dd1805
1 file changed
+12 -2
+12 -2
View File
@@ -37,12 +37,19 @@ fn cursor(edge: ResizeEdge) -> CursorStyle {
#[derive(IntoElement, Default)] #[derive(IntoElement, Default)]
pub struct ResizeBorder { pub struct ResizeBorder {
children: SmallVec<[AnyElement; 2]>, children: SmallVec<[AnyElement; 2]>,
glass: bool,
} }
impl ResizeBorder { impl ResizeBorder {
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()
} }
/// Leaves a see-through window's pane to its content: no ground, nor the shadow gpui draws under it.
pub fn glass(mut self) -> Self {
self.glass = true;
self
}
} }
impl ParentElement for ResizeBorder { impl ParentElement for ResizeBorder {
@@ -61,6 +68,7 @@ impl RenderOnce for ResizeBorder {
window.set_client_inset(inset); window.set_client_inset(inset);
let radius = theme.radius(Radius::Lg); let radius = theme.radius(Radius::Lg);
let floating = !tiling.is_tiled(); let floating = !tiling.is_tiled();
let glass = self.glass;
div() div()
.id("resize-border") .id("resize-border")
.size_full() .size_full()
@@ -100,12 +108,14 @@ impl RenderOnce for ResizeBorder {
.size_full() .size_full()
.overflow_hidden() .overflow_hidden()
.cursor(CursorStyle::Arrow) .cursor(CursorStyle::Arrow)
.bg(theme.colors.bg) .when(!glass, |pane| pane.bg(theme.colors.bg))
.when(floating, |pane| { .when(floating, |pane| {
pane.rounded(radius) pane.rounded(radius)
.border_1() .border_1()
.border_color(theme.colors.border_strong) .border_color(theme.colors.border_strong)
.shadow(theme.elevation(Elevation::Modal)) })
.when(floating && !glass, |pane| {
pane.shadow(theme.elevation(Elevation::Modal))
}) })
.on_mouse_move(|_, _, cx| cx.stop_propagation()) .on_mouse_move(|_, _, cx| cx.stop_propagation())
.children(self.children), .children(self.children),