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
Taskbar: a display change is not held back by the work-area throttle
coffee-1overf921c58e3591
diff --git a/crates/rf-shellguard/src/tbctl.rs b/crates/rf-shellguard/src/tbctl.rsindex 51137e6b..ecb8dc14 100644--- a/crates/rf-shellguard/src/tbctl.rs+++ b/crates/rf-shellguard/src/tbctl.rs@@ -345,6 +345,13 @@ impl Controller {}}+ /// `WM_DISPLAYCHANGE`: the screens were given new work areas. That is not Explorer taking ours back, so the sets it needs are+ /// not refused for the ones before it (a monitor switched off and on would otherwise wait up to a minute for the strip).+ pub fn screens_changed(&mut self, w: &mut dyn HideWorld) {+ self.throttle.reset();+ self.displays_changed(w);+ }+/// Monitors came or went, the work area changed: look again (a new monitor has a new secondary taskbar).pub fn displays_changed(&mut self, w: &mut dyn HideWorld) {self.reconcile(w);diff --git a/crates/rf-shellguard/src/tbedge_tests.rs b/crates/rf-shellguard/src/tbedge_tests.rsindex 9cd6db9e..a053c929 100644--- a/crates/rf-shellguard/src/tbedge_tests.rs+++ b/crates/rf-shellguard/src/tbedge_tests.rs@@ -364,6 +364,46 @@ fn explorer_taking_the_strip_back_is_answered_a_few_times_and_then_left_alone()assert_eq!(work_a(&w), [0, 0, 2560, 1362]);}+#[test]+fn a_display_change_after_explorer_was_throttled_sets_the_work_area_again_at_once() {+ // The monitor is switched off and on: the sets around it used up the slots, and the new screen's work area (the taskbar strip+ // reserved again) must not wait a minute for them to run out.+ let (mut c, mut w) = settled();+ for _ in 0..8 {+ w.monitors[0].work = [0, 0, 2560, 1392];+ w.now += 1_000;+ c.work_area_changed(&mut w);+ }+ assert!(w.lines.iter().any(|l| l.contains("too often")));+ w.monitors[0].work = [0, 0, 2560, 1392];+ w.now += 1_000;+ c.screens_changed(&mut w);+ assert_eq!(work_a(&w), [0, 0, 2560, 1362]);+ // Explorer recomputing after it is still answered, and still limited+ let before = w.work_sets.len();+ for _ in 0..8 {+ w.monitors[0].work = [0, 0, 2560, 1392];+ w.now += 1_000;+ c.work_area_changed(&mut w);+ }+ assert_eq!(w.work_sets.len(), before + 3, "{:?}", w.work_sets);+}++#[test]+fn the_look_again_after_an_explorer_restart_does_not_free_the_throttle() {+ let (mut c, mut w) = settled();+ for _ in 0..8 {+ w.monitors[0].work = [0, 0, 2560, 1392];+ w.now += 1_000;+ c.work_area_changed(&mut w);+ }+ let before = w.work_sets.len();+ w.monitors[0].work = [0, 0, 2560, 1392];+ w.now += 700;+ c.displays_changed(&mut w);+ assert_eq!(w.work_sets.len(), before, "{:?}", w.work_sets);+}+#[test]fn another_toolbar_on_the_primary_monitor_leaves_that_monitor_and_the_dock_alone() {let (mut c, mut w) = world(true);diff --git a/crates/rf-shellguard/src/tbmodel.rs b/crates/rf-shellguard/src/tbmodel.rsindex 95734a82..5ab66c21 100644--- a/crates/rf-shellguard/src/tbmodel.rs+++ b/crates/rf-shellguard/src/tbmodel.rs@@ -335,6 +335,10 @@ impl Throttle {self.stamps.push(now_ms);true}++ pub fn reset(&mut self) {+ self.stamps.clear();+ }}#[cfg(test)]diff --git a/crates/rf-win/src/taskbar_hide.rs b/crates/rf-win/src/taskbar_hide.rsindex 14b2ad94..82f19c08 100644--- a/crates/rf-win/src/taskbar_hide.rs+++ b/crates/rf-win/src/taskbar_hide.rs@@ -535,7 +535,7 @@ unsafe extern "system" fn wndproc(hwnd: HWND, msg: u32, wp: WPARAM, lp: LPARAM)}TIMER_DISPLAYS => {let _ = KillTimer(Some(hwnd), TIMER_DISPLAYS);- ctx.guarded(|c, w| c.displays_changed(w));+ ctx.guarded(|c, w| c.screens_changed(w));sync_timer(hwnd, ctx);}TIMER_WORK => {