PatchworkOS
966e257
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
mouse.h
Go to the documentation of this file.
1
#ifndef _SYS_MOUSE_H
2
#define _SYS_MOUSE_H 1
3
4
#include <
stdint.h
>
5
6
#if defined(__cplusplus)
7
extern
"C"
8
{
9
#endif
10
11
#include "
_internal/clock_t.h
"
12
13
/**
14
* @brief Mouse device header.
15
* @ingroup libstd
16
* @defgroup libstd_sys_mouse Mouse device
17
*
18
* The `sys/mouse.h` header defines structs and constants used by mouse devices for example `/dev/mouse/ps2`. The
19
* primary way to use a mouse device is to open it and then read from it to retrieve `mouse_event_t` structures.
20
*
21
* @{
22
*/
23
24
/**
25
* @brief Mouse buttons enum.
26
*
27
* The `mouse_buttons_t` enum is used to store the state of mouse buttons.
28
*
29
*/
30
typedef
enum
31
{
32
MOUSE_NONE
= 0,
///< None
33
MOUSE_RIGHT
= (1 << 0),
///< Right mouse button
34
MOUSE_MIDDLE
= (1 << 1),
///< Middle mouse button
35
MOUSE_LEFT
= (1 << 2)
///< Left mouse button
36
}
mouse_buttons_t
;
37
38
/**
39
* @brief Mouse event structure.
40
*
41
* The `mouse_event_t` structure can be read from mouse files, for example `/dev/mouse/ps2`. Mouse files will block
42
* until a mouse event happens, mouse files will never return partial events.
43
*/
44
typedef
struct
45
{
46
clock_t
time
;
///< Clock ticks since boot when the event happened
47
mouse_buttons_t
buttons
;
///< Which buttons were held down durring the event
48
int64_t
deltaX
;
///< Change in X coordinate
49
int64_t
deltaY
;
///< Change in Y coordinate
50
}
mouse_event_t
;
51
52
#if defined(__cplusplus)
53
}
54
#endif
55
56
#endif
57
58
/** @} */
clock_t.h
mouse_buttons_t
mouse_buttons_t
Mouse buttons enum.
Definition
mouse.h:31
MOUSE_RIGHT
@ MOUSE_RIGHT
Right mouse button.
Definition
mouse.h:33
MOUSE_NONE
@ MOUSE_NONE
None.
Definition
mouse.h:32
MOUSE_MIDDLE
@ MOUSE_MIDDLE
Middle mouse button.
Definition
mouse.h:34
MOUSE_LEFT
@ MOUSE_LEFT
Left mouse button.
Definition
mouse.h:35
clock_t
__UINT64_TYPE__ clock_t
A nanosecond time.
Definition
clock_t.h:13
stdint.h
int64_t
__INT64_TYPE__ int64_t
Definition
stdint.h:16
mouse_event_t
Mouse event structure.
Definition
mouse.h:45
mouse_event_t::buttons
mouse_buttons_t buttons
Which buttons were held down durring the event.
Definition
mouse.h:47
mouse_event_t::time
clock_t time
Clock ticks since boot when the event happened.
Definition
mouse.h:46
mouse_event_t::deltaY
int64_t deltaY
Change in Y coordinate.
Definition
mouse.h:49
mouse_event_t::deltaX
int64_t deltaX
Change in X coordinate.
Definition
mouse.h:48
include
libstd
sys
mouse.h
Generated on Mon Dec 15 2025 21:55:53 for PatchworkOS by
1.9.8