fix(wm): make force-focus command read wm state

This commit ensures that the force-focus command reads the window
manager state to get the coordinates of the window that should be
currently focused, places the cursor in the middle of that rect, and
then simulates a left-click.
This commit is contained in:
LGUG2Z
2022-12-21 15:36:52 -08:00
parent 4ee4d199a0
commit 99af0f8f7b

View File

@@ -181,6 +181,9 @@ impl WindowManager {
self.cycle_container_window_in_direction(direction)?;
}
SocketMessage::ForceFocus => {
let focused_window = self.focused_window()?;
let focused_window_rect = WindowsApi::window_rect(focused_window.hwnd())?;
WindowsApi::center_cursor_in_rect(&focused_window_rect)?;
WindowsApi::left_click();
}
SocketMessage::Close => self.focused_window()?.close()?,