From 07d61544835ba4a32dbe9180c88c1721096bf94f Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 10:28:32 -0700 Subject: [PATCH] refactor(windows): live_resize.rs reads frames through backend().frame() Every WindowsApi::window_rect(hwnd) in live_resize.rs becomes backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is Window::window_rect, i.e. the same DWM call with the Win32 error kept; the callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only the error text can differ: a window that died meanwhile reports WindowGone). BEHAVIOUR: none intended; e2e gate needed: resize. Verified: Windows clippy -D warnings via tools/fast-check PASS; e2e not run. --- komorebi/src/live_resize.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/komorebi/src/live_resize.rs b/komorebi/src/live_resize.rs index c01e7eb1..5cbc6e87 100644 --- a/komorebi/src/live_resize.rs +++ b/komorebi/src/live_resize.rs @@ -29,10 +29,12 @@ use crate::core::Rect; use crate::core::Sizing; use crate::window::Window; use crate::window_manager::WindowManager; +use crate::windows_backend::backend; use crate::workspace::WorkspaceLayer; use color_eyre::eyre; use crossbeam_channel::Sender; use crossbeam_channel::bounded; +use komorebi_backend::WindowId; use komorebi_scrolling::ScrollingSpace; use parking_lot::Mutex; use std::collections::HashMap; @@ -163,7 +165,9 @@ pub fn is_catching_up(hwnd: isize, layout: &Rect) -> bool { return false; }; - let arrived = WindowsApi::window_rect(hwnd).is_ok_and(|rect| rect == target); + let arrived = backend() + .frame(WindowId::from_hwnd(hwnd)) + .is_ok_and(|rect| rect == target); if arrived || at.elapsed() >= IN_FLIGHT { return false; @@ -440,7 +444,7 @@ pub fn cover_all(windows: &[(isize, Rect)]) { .into_iter() .map(|(hwnd, origin)| { std::thread::spawn(move || { - let rect = WindowsApi::window_rect(hwnd).ok()?; + let rect = backend().frame(WindowId::from_hwnd(hwnd)).ok()?; // the picture is taken before the window is touched match GhostWindow::create(hwnd, origin, None) { @@ -897,7 +901,7 @@ impl WindowManager { return Ok(()); } - let now = WindowsApi::window_rect(kept.hwnd)?; + let now = backend().frame(WindowId::from_hwnd(kept.hwnd))?; // a window moved by its title bar changes no tile until it is let go, // and a drag that has gone back to where it began is a step that puts @@ -1032,7 +1036,7 @@ impl WindowManager { continue; } - let Ok(rect) = WindowsApi::window_rect(window.hwnd) else { + let Ok(rect) = backend().frame(WindowId::from_hwnd(window.hwnd)) else { continue; };