Skip to content

Commit

Permalink
dep: fix lazy for exthook
Browse files Browse the repository at this point in the history
  • Loading branch information
jtroo committed Feb 9, 2025
1 parent 876aae2 commit 2781164
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/oskbd/windows/exthook_os.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! A function listener for keyboard input events replacing Windows keyboard hook API
use core::fmt;
use once_cell::sync::Lazy;
use parking_lot::Mutex;

use winapi::ctypes::*;
Expand All @@ -16,6 +15,7 @@ pub const LLHOOK_IDLE_TIME_SECS_CLEAR_INPUTS: u64 = 60;

type HookFn = dyn FnMut(InputEvent) -> bool + Send + Sync + 'static;

type Lazy<T> = std::sync::LazyLock<T>;
pub static HOOK_CB: Lazy<Mutex<Option<Box<HookFn>>>> = Lazy::new(|| Mutex::new(None)); // store thread-safe hook callback with a mutex (can be called from an external process)

pub struct KeyboardHook {} // reusing hook type for our listener
Expand Down

0 comments on commit 2781164

Please sign in to comment.