Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Merge remote-tracking branch 'refs/remotes/pr/2301' into HEAD

Richie McIlroy75057f7936d0
diff --cc crates/recording/src/cursor.rs
index 45a8ee072,3c3ad6ecd..f6a1f5f15
--- a/crates/recording/src/cursor.rs
+++ b/crates/recording/src/cursor.rs
@@@ -634,19 -655,11 +688,21 @@@ pub fn spawn_cursor_recorder
});
#[cfg(target_os = "linux")]
let mut last_window_position = None;
+ #[cfg(windows)]
+ let mut last_window_crop: Option<CursorCropBounds> = None;
let device_state = DeviceState::new();
+ // Reading the held keys asks the OS about every key it knows (two
+ // CoreGraphics queries per key on macOS, 256 GetAsyncKeyState calls
+ // on Windows), so skip it when the keys are not being recorded.
+ let held_keys = || {
+ if keyboard_capture {
+ device_state.get_keys()
+ } else {
+ Vec::new()
+ }
+ };
let mut last_mouse_state = device_state.get_mouse();
- let mut last_keys: Vec<device_query::Keycode> = device_state.get_keys();
+ let mut last_keys: Vec<device_query::Keycode> = held_keys();
let mut last_position =
cap_cursor_capture::RawCursorPosition::from_coords(last_mouse_state.coords);