add a mouse cursor check to anti afk activation

This commit is contained in:
2025-04-16 23:59:50 +01:00
parent 5fe697223c
commit 284c4bb46d
3 changed files with 27 additions and 7 deletions
+15 -1
View File
@@ -6,7 +6,10 @@ use windows::{
UI::{
Input::KeyboardAndMouse::GetAsyncKeyState,
Shell::ShellExecuteW,
WindowsAndMessaging::{GetForegroundWindow, GetWindowTextW, SW_NORMAL},
WindowsAndMessaging::{
CURSOR_SHOWING, CURSORINFO, GetCursorInfo, GetForegroundWindow, GetWindowTextW,
SW_NORMAL,
},
},
},
core::{HSTRING, PCWSTR},
@@ -17,6 +20,17 @@ pub enum ElevationExitMethod<'a> {
Forced,
}
pub fn is_cursor_visible() -> bool {
let mut ci = CURSORINFO {
cbSize: std::mem::size_of::<CURSORINFO>() as u32,
..Default::default()
};
unsafe {
GetCursorInfo(&mut ci).unwrap();
}
ci.flags == CURSOR_SHOWING
}
#[allow(clippy::cast_sign_loss)]
pub fn is_window_focused(target_title: &str) -> bool {
unsafe {