mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-17 22:33:12 +01:00
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.
This commit is contained in:
1 parent
7ba4327fa0
commit
17ecb8787c
1 file changed
+3
-1
@@ -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<Rendered> {
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user