1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
use ;
// #[cfg(target_os = "linux")]
// mod linux;
// #[cfg(target_os = "macos")]
// mod mac;
/// Errors that occur when trying to capture OS events.
///
/// # Note on macOS
/// On macOS, failing to set Accessibility permissions does not necessarily
/// trigger an error; the system may simply ignore events or return empty data.
/// The system background engine manager.
///
/// `Core` handles the lifecycle of the platform's native event loop.
///
/// # Example
/// ```no_run
/// use raw_input::Core;
///
/// // Initialize and start the background event loop
/// std::thread::spawn(|| {
/// Core::start().expect("Failed to start raw-input core");
/// });
/// ```
;
/// Global input listener for monitoring events.
///
/// This provides a way to observe keyboard and mouse actions without blocking them.
///
/// # Example
/// ```no_run
/// use raw_input::{Listen, Event};
///
/// // It must be started first
/// // Core::start(); // This is a blocking operation
///
/// // Start listening to all input
/// Listen::start(); // defaults to listening to all input
///
/// // customizable
/// // Listen::mouse_move(true);
/// // Listen::mouse_wheel(true);
/// // Listen::mouse_button(true);
/// // Listen::keyboard(true);
///
/// // Subscribe to all global input events
/// let handle = Listen::subscribe(|event| {
/// match event {
/// Event::KeyDown { key } => println!("Key pressed: {:?}", key),
/// Event::MouseMove { delta } => println!("Mouse delta: {:?}", delta),
/// _ => {},
/// }
/// });
///
/// // Use handle.pause(), handle.resume(), or handle.unsubscribe() to manage the lifecycle.
///
/// Listen::stop();
/// ```
;
/// Input interceptor for blocking or modifying events.
///
/// `Grab` allows you to prevent specific events from reaching other applications.
///
/// # Example
/// ```no_run
/// use raw_input::Grab;
///
/// // It must be started first
/// // Core::start(); // This is a blocking operation
///
/// // Block all keyboard input
/// Grab::start(); // defaults to blocking all input
///
/// // customizable
/// // Grab::mouse_move(true);
/// // Grab::mouse_wheel(true);
/// // Grab::mouse_button(true);
/// // Grab::keyboard(true);
///
/// // Stop grabbing later
/// // Grab::stop();
/// ```
;
/// Input simulator for synthesizing events.
///
/// Use `Simulate` to programmatically trigger keyboard and mouse actions.
///
/// # Example
/// ```no_run
/// use raw_input::{Simulate, Event, Key};
///
/// // Simulate pressing the 'A' key
/// Simulate::simulate(Event::KeyDown { key: Key::KeyA });
///
/// // Convenience methods for mouse
/// Simulate::mouse_move(100, 100);
/// ```
;
/// Screen and monitor information provider.
///
/// # Example
/// ```no_run
/// use raw_input::Display;
///
/// let monitors = Display::get_available_monitors();
/// for monitor in monitors {
/// println!("Monitor: {} - Size: {:?}", monitor.name, monitor.size);
/// }
///
/// let scale = Display::get_scale_factor();
/// println!("Current UI Scale: {}", scale);
/// ```
;
/// Information about a connected physical monitor.