A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.
Rust archive-managerdesktop-appdual-paneexplorer-alternativefile-browserfile-explorerfile-managerfluent-designgpu-acceleratedgpuimacosmicaproductivityquick-lookrustrust-guitabswindowswindows-11windows-explorer
Flat background also applies to the Dock's popups
mrBelogubdbff11357ecd
diff --git a/crates/rf-app/src/dock/app_menu.rs b/crates/rf-app/src/dock/app_menu.rsindex fc436b60..dafabdab 100644--- a/crates/rf-app/src/dock/app_menu.rs+++ b/crates/rf-app/src/dock/app_menu.rs@@ -427,7 +427,7 @@ impl MenuView {fn on_shown(&mut self, dark: bool, window: &mut Window, cx: &mut Context<Self>) {if self.popup.is_none() && self.shown {- self.popup = Some(PopupGlass::start_panel(self.hwnd, dark));+ self.popup = Some(PopupGlass::start_dock_panel(self.hwnd, dark));self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}window.focus(&self.focus, cx);@@ -785,7 +785,7 @@ impl Render for MenuView {}let (pal, _) = host::frame_palette(&self.island, window);let dark = pal.mix < 0.5;- let fill = glass_watch::panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));+ let fill = glass_watch::dock_panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));let frame = match self.anim {Some((t, opening)) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),None => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },diff --git a/crates/rf-app/src/dock/cal_view.rs b/crates/rf-app/src/dock/cal_view.rsindex 3c29abdd..ecf38589 100644--- a/crates/rf-app/src/dock/cal_view.rs+++ b/crates/rf-app/src/dock/cal_view.rs@@ -192,8 +192,8 @@ impl CalView {if self.popup.is_none() && self.shown {// an island growing into this panel: its glass is a shape in the window that the growth moves (grow_host.rs)self.popup = Some(match super::grow_host::shape_for_attach(super::panel::CALENDAR, cx) {- Some((shape, radius)) => PopupGlass::start_panel_shaped(self.hwnd, dark, shape, radius),- None => PopupGlass::start_panel(self.hwnd, dark),+ Some((shape, radius)) => PopupGlass::start_dock_panel_shaped(self.hwnd, dark, shape, radius),+ None => PopupGlass::start_dock_panel(self.hwnd, dark),});self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}@@ -431,7 +431,7 @@ impl Render for CalView {let lang = lang();// The island's glass is growing into this panel (`grow_host.rs`): the motion decides what is seen, the 120 ms easing stays out of it.let grown = super::grow_host::view_frame(super::panel::CALENDAR, cx);- let fill = glass_watch::panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));+ let fill = glass_watch::dock_panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));let frame = match (self.anim, grown) {(_, Some(_)) | (None, None) => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },(Some((t, opening)), None) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),diff --git a/crates/rf-app/src/dock/control_centre.rs b/crates/rf-app/src/dock/control_centre.rsindex 593407aa..88e7b7ce 100644--- a/crates/rf-app/src/dock/control_centre.rs+++ b/crates/rf-app/src/dock/control_centre.rs@@ -587,8 +587,8 @@ impl CcView {if self.popup.is_none() && self.shown {// an island growing into this panel: its glass is a shape in the window that the growth moves (grow_host.rs)self.popup = Some(match super::grow_host::shape_for_attach(PanelId::CONTROL_CENTRE, cx) {- Some((shape, radius)) => PopupGlass::start_panel_shaped(self.hwnd, dark, shape, radius),- None => PopupGlass::start_panel(self.hwnd, dark),+ Some((shape, radius)) => PopupGlass::start_dock_panel_shaped(self.hwnd, dark, shape, radius),+ None => PopupGlass::start_dock_panel(self.hwnd, dark),});self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}@@ -2089,7 +2089,7 @@ impl Render for CcView {// The island's glass is growing into this panel (the setting "Paneller adalardan büyüyerek açılsın"): the motion decides what is// seen (the glass's shape, the content's opacity) and the panel's own 120 ms easing stays out of it (`grow_host.rs`).let grown = super::grow_host::view_frame(PanelId::CONTROL_CENTRE, cx);- let fill = glass_watch::panel_fill(dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));+ let fill = glass_watch::dock_panel_fill(dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));let frame = match (self.anim, grown) {(_, Some(_)) | (None, None) => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },(Some((t, opening)), None) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),diff --git a/crates/rf-app/src/dock/eject_view.rs b/crates/rf-app/src/dock/eject_view.rsindex cb78812c..a569bd66 100644--- a/crates/rf-app/src/dock/eject_view.rs+++ b/crates/rf-app/src/dock/eject_view.rs@@ -165,8 +165,8 @@ impl EjectView {if self.popup.is_none() && self.shown {// an island growing into this panel: its glass is a shape in the window that the growth moves (grow_host.rs)self.popup = Some(match super::grow_host::shape_for_attach(super::panel::EJECT, cx) {- Some((shape, radius)) => PopupGlass::start_panel_shaped(self.hwnd, dark, shape, radius),- None => PopupGlass::start_panel(self.hwnd, dark),+ Some((shape, radius)) => PopupGlass::start_dock_panel_shaped(self.hwnd, dark, shape, radius),+ None => PopupGlass::start_dock_panel(self.hwnd, dark),});self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}@@ -239,7 +239,7 @@ impl Render for EjectView {let (pal, _) = super::host::frame_palette(&self.island, window);let look = Look::of(pal);let grown = super::grow_host::view_frame(super::panel::EJECT, cx);- let fill = glass_watch::panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));+ let fill = glass_watch::dock_panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));let frame = match (self.anim, grown) {(_, Some(_)) | (None, None) => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },(Some((t, opening)), None) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),diff --git a/crates/rf-app/src/dock/hover_preview.rs b/crates/rf-app/src/dock/hover_preview.rsindex 8460c0c2..1efef91a 100644--- a/crates/rf-app/src/dock/hover_preview.rs+++ b/crates/rf-app/src/dock/hover_preview.rs@@ -518,7 +518,7 @@ impl PreviewView {/// above them). Returns how many cards have a live picture.fn on_shown(&mut self, dark: bool, cx: &mut Context<Self>) -> usize {if self.popup.is_none() && self.shown {- self.popup = Some(PopupGlass::start_panel_thin_rim(self.hwnd, dark, rim_cap()));+ self.popup = Some(PopupGlass::start_dock_panel_thin_rim(self.hwnd, dark, rim_cap()));self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}// THE SAME BOX the card is painted with (`Layout::card(i).picture`), in device px. DWM measures its destination from the window's@@ -605,7 +605,7 @@ impl Render for PreviewView {}let (pal, _) = host::frame_palette(&self.island, window);let dark = pal.mix < 0.5;- let fill = glass_watch::panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));+ let fill = glass_watch::dock_panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));// ONE BACKGROUND: the window's glass. A card has no fill and no outline of its own while it rests (it had both, and one window's// preview read as a panel inside a panel); only the card under the pointer is// marked, as in Windows' own previews.diff --git a/crates/rf-app/src/dock/island_menu.rs b/crates/rf-app/src/dock/island_menu.rsindex 2110e78e..76ec9b20 100644--- a/crates/rf-app/src/dock/island_menu.rs+++ b/crates/rf-app/src/dock/island_menu.rs@@ -480,7 +480,7 @@ impl MenuView {fn on_shown(&mut self, dark: bool, window: &mut Window, cx: &mut Context<Self>) {if self.popup.is_none() && self.shown {- self.popup = Some(PopupGlass::start_panel(self.hwnd, dark));+ self.popup = Some(PopupGlass::start_dock_panel(self.hwnd, dark));self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}window.focus(&self.focus, cx);@@ -646,7 +646,7 @@ impl Render for MenuView {}let (pal, _) = host::frame_palette(&self.island, window);let dark = pal.mix < 0.5;- let fill = glass_watch::panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));+ let fill = glass_watch::dock_panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));let frame = match self.anim {Some((t, opening)) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),None => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },diff --git a/crates/rf-app/src/dock/notif_view.rs b/crates/rf-app/src/dock/notif_view.rsindex 8d662920..5316662a 100644--- a/crates/rf-app/src/dock/notif_view.rs+++ b/crates/rf-app/src/dock/notif_view.rs@@ -201,8 +201,8 @@ impl NotifView {if self.popup.is_none() && self.shown {// an island growing into this panel: its glass is a shape in the window that the growth moves (grow_host.rs)self.popup = Some(match super::grow_host::shape_for_attach(super::panel::NOTIFICATIONS, cx) {- Some((shape, radius)) => PopupGlass::start_panel_shaped(self.hwnd, dark, shape, radius),- None => PopupGlass::start_panel(self.hwnd, dark),+ Some((shape, radius)) => PopupGlass::start_dock_panel_shaped(self.hwnd, dark, shape, radius),+ None => PopupGlass::start_dock_panel(self.hwnd, dark),});self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}@@ -619,7 +619,7 @@ impl Render for NotifView {let words = Words::current();// The island's glass is growing into this panel (`grow_host.rs`): the motion decides what is seen, the 120 ms easing stays out of it.let grown = super::grow_host::view_frame(super::panel::NOTIFICATIONS, cx);- let fill = glass_watch::panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));+ let fill = glass_watch::dock_panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));let frame = match (self.anim, grown) {(_, Some(_)) | (None, None) => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },(Some((t, opening)), None) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),diff --git a/crates/rf-app/src/dock/start.rs b/crates/rf-app/src/dock/start.rsindex 07463e08..e66a76cc 100644--- a/crates/rf-app/src/dock/start.rs+++ b/crates/rf-app/src/dock/start.rs@@ -566,8 +566,8 @@ impl StartView {if self.popup.is_none() && self.shown {// an island growing into this panel: its glass is a shape in the window that the growth moves (grow_host.rs)self.popup = Some(match super::grow_host::shape_for_attach(PanelId::START, cx) {- Some((shape, radius)) => PopupGlass::start_panel_shaped(self.hwnd, dark, shape, radius),- None => PopupGlass::start_panel(self.hwnd, dark),+ Some((shape, radius)) => PopupGlass::start_dock_panel_shaped(self.hwnd, dark, shape, radius),+ None => PopupGlass::start_dock_panel(self.hwnd, dark),});self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}@@ -1668,7 +1668,7 @@ impl Render for StartView {// (whether the plain fill is whole: while the glass grows, the engine's own report at this frame decides, not this view's watch,// which is up to 50 ms late and used to paint one opaque dark frame at the start of the motion, see `Run::wash`)let plain = grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain);- let fill = glass_watch::panel_fill(dark, plain);+ let fill = glass_watch::dock_panel_fill(dark, plain);let frame = match (self.anim, grown) {(_, Some(_)) => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },(Some((t, opening)), None) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),@@ -1936,7 +1936,7 @@ impl StartView {fn render_overlays(&mut self, pal: Palette, window: &Window, cx: &mut Context<Self>) -> Vec<AnyElement> {let mut out = Vec::new();let dark = pal.mix < 0.5;- let menu_fill = glass_watch::panel_fill(dark, true);+ let menu_fill = glass_watch::dock_panel_fill(dark, true);let (hover, pressed) = (pal.hover_fill().hsla(), pal.pressed_fill().hsla());let text = pal.text().hsla();let border = pal.separator().hsla();diff --git a/crates/rf-app/src/dock/start_folder.rs b/crates/rf-app/src/dock/start_folder.rsindex 16170512..15795eac 100644--- a/crates/rf-app/src/dock/start_folder.rs+++ b/crates/rf-app/src/dock/start_folder.rs@@ -194,7 +194,7 @@ impl StartView {// HyperGlass: the card is the glass's own wash, as the panel's menus over the glass are, and the grid under it fades out while it// is open (`render_home`) so that only the glass shows through; without the glass it is the plain panellet plain = self.popup.as_ref().is_none_or(|g| g.fallback());- let fill = glass_watch::panel_fill(dark, plain);+ let fill = glass_watch::dock_panel_fill(dark, plain);let rows = folder.apps.len().div_ceil(FOLDER_COLS).max(1);let w = FOLDER_COLS as f32 * CELL_W + 2.0 * FOLDER_PAD;let room = (view_h - 2.0 * PAD - FOLDER_HEAD - 2.0 * FOLDER_PAD).max(page::TILE_H);diff --git a/crates/rf-app/src/dock/tray_overflow.rs b/crates/rf-app/src/dock/tray_overflow.rsindex 3ea29b9d..cb237715 100644--- a/crates/rf-app/src/dock/tray_overflow.rs+++ b/crates/rf-app/src/dock/tray_overflow.rs@@ -132,8 +132,8 @@ impl OverflowView {if self.popup.is_none() && self.shown {// an island growing into this panel: its glass is a shape in the window that the growth moves (grow_host.rs)self.popup = Some(match super::grow_host::shape_for_attach(super::panel::OVERFLOW, cx) {- Some((shape, radius)) => PopupGlass::start_panel_shaped(self.hwnd, dark, shape, radius),- None => PopupGlass::start_panel(self.hwnd, dark),+ Some((shape, radius)) => PopupGlass::start_dock_panel_shaped(self.hwnd, dark, shape, radius),+ None => PopupGlass::start_dock_panel(self.hwnd, dark),});self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}@@ -200,7 +200,7 @@ impl Render for OverflowView {let look = Look::of(pal);// The island's glass is growing into this panel (`grow_host.rs`): the motion decides what is seen, the 120 ms easing stays out of it.let grown = super::grow_host::view_frame(super::panel::OVERFLOW, cx);- let fill = glass_watch::panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));+ let fill = glass_watch::dock_panel_fill(look.dark, grown.map_or_else(|| self.popup.as_ref().is_none_or(|g| g.fallback()), |g| g.plain));let frame = match (self.anim, grown) {(_, Some(_)) | (None, None) => geo::Frame { opacity: 1.0, drop_px: 0.0, done: true },(Some((t, opening)), None) => geo::frame(t.elapsed().as_millis() as u32, opening, crate::settings::animations()),diff --git a/crates/rf-app/src/dock/tray_tip.rs b/crates/rf-app/src/dock/tray_tip.rsindex ea83ae70..8bb997e2 100644--- a/crates/rf-app/src/dock/tray_tip.rs+++ b/crates/rf-app/src/dock/tray_tip.rs@@ -361,7 +361,7 @@ impl TipView {/// The window is on the screen: the glass goes on.fn on_shown(&mut self, dark: bool, cx: &mut Context<Self>) {if self.popup.is_none() && self.shown {- self.popup = Some(PopupGlass::start_panel(self.hwnd, dark));+ self.popup = Some(PopupGlass::start_dock_panel(self.hwnd, dark));self._watch = Some(glass_watch::watch(cx, |this: &mut Self| this.popup.as_mut()));}cx.notify();@@ -385,7 +385,7 @@ impl Render for TipView {}let (pal, _) = host::frame_palette(&self.island, window);let dark = pal.mix < 0.5;- let fill = glass_watch::panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));+ let fill = glass_watch::dock_panel_fill(dark, self.popup.as_ref().is_none_or(|g| g.fallback()));div().size_full().bg(fill)diff --git a/crates/rf-app/src/glass_watch.rs b/crates/rf-app/src/glass_watch.rsindex df35c4ae..03e6a2e1 100644--- a/crates/rf-app/src/glass_watch.rs+++ b/crates/rf-app/src/glass_watch.rs@@ -113,6 +113,20 @@ pub fn panel_fill(dark: bool, fallback: bool) -> gpui_kit::Hsla {c}+/// [`panel_fill`] for the dock's popups: with Settings > Dock > "Flat background" a popup that has no glass is a solid panel, not+/// the dense see-through one (there is nothing blurred behind it, and the switch asks for no glass at all).+pub fn dock_panel_fill(dark: bool, fallback: bool) -> gpui_kit::Hsla {+ flat_panel_fill(dark, fallback, crate::dock::look::plain())+}++fn flat_panel_fill(dark: bool, fallback: bool, flat: bool) -> gpui_kit::Hsla {+ let mut c = panel_fill(dark, fallback);+ if fallback && flat {+ c.a = 1.0;+ }+ c+}+/// The glass behind one popup window (menu level, dropdown list, flyout). Lives in the popup's view: dropping it, or [`release`],/// takes the glass off the window.///@@ -156,6 +170,36 @@ impl PopupGlass {Self::start_with_options(hwnd, dark, true, Some(opts))}+ /// [`start_panel`](Self::start_panel) for a popup of the dock: with "Flat background" on there is no glass, the popup keeps its+ /// solid fill ([`dock_panel_fill`]).+ pub fn start_dock_panel(hwnd: isize, dark: bool) -> PopupGlass {+ Self::flat_or(hwnd, || Self::start_panel(hwnd, dark))+ }++ /// [`start_panel_thin_rim`](Self::start_panel_thin_rim) for a popup of the dock, see [`start_dock_panel`](Self::start_dock_panel).+ pub fn start_dock_panel_thin_rim(hwnd: isize, dark: bool, rim_cap: f32) -> PopupGlass {+ Self::flat_or(hwnd, || Self::start_panel_thin_rim(hwnd, dark, rim_cap))+ }++ /// [`start_panel_shaped`](Self::start_panel_shaped) for a popup of the dock, see [`start_dock_panel`](Self::start_dock_panel).+ pub fn start_dock_panel_shaped(hwnd: isize, dark: bool, shape: [f32; 4], radius_px: f32) -> PopupGlass {+ Self::flat_or(hwnd, || Self::start_panel_shaped(hwnd, dark, shape, radius_px))+ }++ fn flat_or(hwnd: isize, glassy: impl FnOnce() -> PopupGlass) -> PopupGlass {+ if crate::dock::look::plain() {+ return Self::without_glass(hwnd);+ }+ glassy()+ }++ /// A popup that never gets glass: it keeps its plain fill and the engine is not asked.+ fn without_glass(hwnd: isize) -> PopupGlass {+ let mut g = PopupGlass { hwnd, machine: Machine::default(), started: Instant::now(), attached: false, gave_up: true };+ g.machine.attach_failed(0);+ g+ }+fn start_with(hwnd: isize, dark: bool, round: bool) -> PopupGlass {Self::start_with_options(hwnd, dark, round, None)}@@ -364,6 +408,15 @@ mod tests {assert!(panel_fill(true, true).a > panel_fill(true, false).a && panel_fill(false, true).a > panel_fill(false, false).a);}+ #[test]+ fn with_a_flat_dock_a_popup_without_glass_is_solid_and_one_over_glass_is_not_touched() {+ for dark in [true, false] {+ assert_eq!(flat_panel_fill(dark, true, true).a, 1.0);+ assert_eq!(flat_panel_fill(dark, true, false), panel_fill(dark, true));+ assert_eq!(flat_panel_fill(dark, false, true), panel_fill(dark, false));+ }+ }+#[test]fn a_popup_window_without_a_handle_keeps_its_fill_and_does_not_crash() {let mut g = PopupGlass::start(0, true);