From 3a86e8fb6ab31343c17f88084bac1ebece1d12ef Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 10:11:01 -0700 Subject: [PATCH] refactor(windows): frame writes with top = false go through backend() The two Window::set_position(rect, false) call sites (the workspace layout update in workspace.rs and the stackbar tab click) now call backend().set_rect(..), which is Window::set_rect = set_position(rect, false): the animation, slide-in and live-resize guards are the same. Not switched: the top = true callers (window.rs move_to_area/center, workspace.rs maximize area), since the shared set_rect has no top flag, and all window_rect reads: the shared window_rect is built on window(id), which asks title, class, exe and path of every window, returns None instead of the Win32 error and defaults on failure; the 60 call sites rely on Err or unwrap_or_default, so they stay on WindowsApi::window_rect until the trait or the adapter has a cheap frame query. BEHAVIOUR: a dead window fails early with Error::WindowGone, and one extra IsWindow call per write. e2e gate needed: commands, resize, layouts, stacking, scrolling, workspaces. Verified: Windows clippy -D warnings via tools/fast-check PASS; e2e not run. --- komorebi/src/stackbar_manager/stackbar.rs | 6 ++++-- komorebi/src/workspace.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/komorebi/src/stackbar_manager/stackbar.rs b/komorebi/src/stackbar_manager/stackbar.rs index 71c208a4..4d5ecb48 100644 --- a/komorebi/src/stackbar_manager/stackbar.rs +++ b/komorebi/src/stackbar_manager/stackbar.rs @@ -360,8 +360,10 @@ impl Stackbar { // on top of other tiles before eventually ending up in the correct // tile if index != focused_window_idx - && let Err(err) = - window.set_position(&focused_window_rect, false) + && let Err(err) = backend().set_rect( + WindowId::from_hwnd(window.hwnd), + &focused_window_rect, + ) { tracing::error!( "stackbar WM_LBUTTONDOWN repositioning error: hwnd {} ({})", diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index 48e43ddf..dd242c4d 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -850,7 +850,7 @@ impl Workspace { window.restore(); } - window.set_position(layout, false)?; + backend().set_rect(WindowId::from_hwnd(window.hwnd), layout)?; } } }