From 17ecb8787c5f45583b3bc7ab8623f5462e7c567f Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 10:28:06 -0700 Subject: [PATCH] refactor(windows): animation/snapshot.rs reads frames through backend().frame() Every WindowsApi::window_rect(hwnd) in animation/snapshot.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: animation scenarios, workspaces. Verified: Windows clippy -D warnings via tools/fast-check PASS; e2e not run. --- komorebi/src/animation/snapshot.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/komorebi/src/animation/snapshot.rs b/komorebi/src/animation/snapshot.rs index 2be05264..e38df2c7 100644 --- a/komorebi/src/animation/snapshot.rs +++ b/komorebi/src/animation/snapshot.rs @@ -60,6 +60,8 @@ use windows::core::w; use crate::WindowsApi; use crate::border_manager::BorderLook; +use crate::windows_backend::backend; +use komorebi_backend::WindowId; /// Ask for what the window looks like to the compositor, which is the only /// way to capture a window that is drawn with DirectComposition @@ -279,7 +281,7 @@ fn render(hwnd: isize) -> eyre::Result { let window_height = window.bottom - window.top; // what is on screen is the extended frame, inside the invisible borders - let frame = WindowsApi::window_rect(hwnd)?; + let frame = backend().frame(WindowId::from_hwnd(hwnd))?; let x = (frame.left - window.left).clamp(0, window_width); let y = (frame.top - window.top).clamp(0, window_height); let width = frame.right.min(window_width - x);