refactor(windows): process_command.rs reads frames through backend().frame()

Every WindowsApi::window_rect(hwnd) in process_command.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: commands, resize. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
This commit is contained in:
LGUG2Z committed 2026-10-31 10:30:10 -07:00
1 parent 387d780aa7
commit 74652fb451
1 file changed
+8 -3
+8 -3
View File
@@ -401,7 +401,8 @@ impl WindowManager {
}
SocketMessage::ForceFocus => {
let focused_window = self.focused_window()?;
let focused_window_rect = WindowsApi::window_rect(focused_window.hwnd)?;
let focused_window_rect =
backend().frame(WindowId::from_hwnd(focused_window.hwnd))?;
WindowsApi::center_cursor_in_rect(&focused_window_rect)?;
WindowsApi::left_click();
}
@@ -1299,7 +1300,9 @@ impl WindowManager {
// Sort by window area
window_idx_pairs.sort_by_key(|(_, w)| {
let rect = WindowsApi::window_rect(w.hwnd).unwrap_or_default();
let rect = backend()
.frame(WindowId::from_hwnd(w.hwnd))
.unwrap_or_default();
rect.right * rect.bottom
});
window_idx_pairs.reverse();
@@ -1363,7 +1366,9 @@ impl WindowManager {
// Sort by window area
window_idx_pairs.sort_by_key(|w| {
let rect = WindowsApi::window_rect(w.hwnd).unwrap_or_default();
let rect = backend()
.frame(WindowId::from_hwnd(w.hwnd))
.unwrap_or_default();
rect.right * rect.bottom
});