forked from rjmarsan/TuioForAndroid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuinput.h
More file actions
92 lines (71 loc) · 3.02 KB
/
Copy pathsuinput.h
File metadata and controls
92 lines (71 loc) · 3.02 KB
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
/*
suinput - Simple C-API to the Linux uinput-system.
Copyright (C) 2009 Tuomas Räsänen <tuos@codegrove.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SUINPUT_H
#define SUINPUT_H
#include <stdint.h>
#include <linux/input.h>
/*
Creates and opens a connection to the event device. Returns an uinput file
descriptor on success. On error, -1 is returned, and errno is set
appropriately.
*/
int suinput_open(const char* device_name, const struct input_id* id);
/*
Destroys and closes a connection to the event device. Returns 0 on success.
On error, -1 is returned, and errno is set appropriately.
Behaviour is undefined when passed a file descriptor not returned by
suinput_open().
*/
int suinput_close(int uinput_fd);
/*
Sends a relative pointer motion event to the event device. Values increase
towards right-bottom. Returns 0 on success. On error, -1 is returned, and
errno is set appropriately.
Behaviour is undefined when passed a file descriptor not returned by
suinput_open().
*/
int suinput_move_pointer(int uinput_fd, int32_t x, int32_t y);
/*
Sends a press event to the event device. Event is repeated after
a short delay until a release event is sent. Returns 0 on success.
On error, -1 is returned, and errno is set appropriately.
Behaviour is undefined when passed a file descriptor not returned by
suinput_open().
All possible values of `code` are defined in linux/input.h prefixed
by KEY_ or BTN_.
*/
int suinput_press(int uinput_fd, uint16_t code);
/*
Sends a release event to the event device. Returns 0 on success.
On error, -1 is returned, and errno is set appropriately.
Behaviour is undefined when passed a file descriptor not returned by
suinput_open().
All possible values of `code` are defined in linux/input.h prefixed
by KEY_ or BTN_.
*/
int suinput_release(int uinput_fd, uint16_t code);
/*
Sends a press and release events to the event device. Returns 0 on
success. On error, -1 is returned, and errno is set appropriately.
Behaviour is undefined when passed a file descriptor not returned by
suinput_open().
All possible values of `code` are defined in linux/input.h prefixed
by KEY_ or BTN_.
This function is provided as a convenience and has effectively the
same result as calling suinput_press() and suinput_release() sequentially.
*/
int suinput_click(int uinput_fd, uint16_t code);
#endif /* SUINPUT_H */