summaryrefslogtreecommitdiff
path: root/src/lib/elput/elput_private.h
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-04-06 08:46:29 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-04-13 14:16:17 -0400
commit3070c4cf08a28b2a9a3f4838ec78ce7f7bde95ec (patch)
tree5ff834e695c205bb5399938cc1af9b109f558712 /src/lib/elput/elput_private.h
parentbd0d4ba60fb9ad88ebb8073d67dfde213937fc8c (diff)
elput: Add support for creating and removing devices
This patch adds start of code to create or remove input devices such as keyboards, pointers, or touch devices. Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/elput/elput_private.h')
-rw-r--r--src/lib/elput/elput_private.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 6d88943921..32ab797a7c 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -12,6 +12,7 @@
12# include "Eldbus.h" 12# include "Eldbus.h"
13# include <Elput.h> 13# include <Elput.h>
14 14
15# include <sys/mman.h>
15# include <fcntl.h> 16# include <fcntl.h>
16# include <unistd.h> 17# include <unistd.h>
17# include <linux/vt.h> 18# include <linux/vt.h>
@@ -19,6 +20,7 @@
19# include <linux/major.h> 20# include <linux/major.h>
20# include <linux/input.h> 21# include <linux/input.h>
21# include <libinput.h> 22# include <libinput.h>
23# include <xkbcommon/xkbcommon.h>
22 24
23# ifdef HAVE_SYSTEMD 25# ifdef HAVE_SYSTEMD
24# include <systemd/sd-login.h> 26# include <systemd/sd-login.h>
@@ -56,6 +58,13 @@ extern int _elput_log_dom;
56# endif 58# endif
57# define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__) 59# define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__)
58 60
61typedef enum _Elput_Device_Capability
62{
63 EVDEV_SEAT_POINTER = (1 << 0),
64 EVDEV_SEAT_KEYBOARD = (1 << 1),
65 EVDEV_SEAT_TOUCH = (1 << 2)
66} Elput_Device_Capability;
67
59typedef struct _Elput_Interface 68typedef struct _Elput_Interface
60{ 69{
61 Eina_Bool (*connect)(Elput_Manager **manager, const char *seat, unsigned int tty, Eina_Bool sync); 70 Eina_Bool (*connect)(Elput_Manager **manager, const char *seat, unsigned int tty, Eina_Bool sync);
@@ -75,6 +84,129 @@ typedef struct _Elput_Input
75 Eina_Bool suspended : 1; 84 Eina_Bool suspended : 1;
76} Elput_Input; 85} Elput_Input;
77 86
87typedef struct _Elput_Keyboard_Info
88{
89 int refs;
90
91 struct
92 {
93 int fd;
94 size_t size;
95 char *area;
96 struct xkb_keymap *map;
97 } keymap;
98
99 struct
100 {
101 xkb_mod_index_t shift;
102 xkb_mod_index_t caps;
103 xkb_mod_index_t ctrl;
104 xkb_mod_index_t alt;
105 xkb_mod_index_t altgr;
106 xkb_mod_index_t super;
107 } mods;
108} Elput_Keyboard_Info;
109
110struct _Elput_Keyboard
111{
112 struct
113 {
114 unsigned int depressed;
115 unsigned int latched;
116 unsigned int locked;
117 unsigned int group;
118 } mods;
119
120 struct
121 {
122 unsigned int key;
123 unsigned int timestamp;
124 } grab;
125
126 Elput_Keyboard_Info *info;
127
128 struct xkb_state *state;
129 struct xkb_keymap *pending_map;
130 struct xkb_context *context;
131 struct xkb_rule_names names;
132
133 Elput_Seat *seat;
134
135 Eina_Bool external_map : 1;
136};
137
138struct _Elput_Pointer
139{
140 double x, y;
141 int buttons;
142 unsigned int timestamp;
143
144 int minx, miny;
145 int maxx, maxy;
146 int hotx, hoty;
147
148 struct
149 {
150 double x, y;
151 unsigned int button;
152 unsigned int timestamp;
153 } grab;
154
155 struct
156 {
157 unsigned int threshold;
158 unsigned int last_button, prev_button;
159 unsigned int last_time, prev_time;
160 Eina_Bool double_click : 1;
161 Eina_Bool triple_click : 1;
162 } mouse;
163
164 Elput_Seat *seat;
165};
166
167struct _Elput_Touch
168{
169 double x, y;
170 int slot;
171 unsigned int points;
172
173 struct
174 {
175 int id;
176 double x, y;
177 unsigned int timestamp;
178 } grab;
179
180 Elput_Seat *seat;
181};
182
183struct _Elput_Seat
184{
185 const char *name;
186
187 struct
188 {
189 int kbd, ptr, touch;
190 } count;
191
192 Elput_Keyboard *kbd;
193 Elput_Pointer *ptr;
194 Elput_Touch *touch;
195
196 Eina_List *devices;
197};
198
199struct _Elput_Device
200{
201 Elput_Seat *seat;
202
203 const char *path;
204 const char *output_name;
205 struct libinput_device *device;
206
207 Elput_Device_Capability caps;
208};
209
78struct _Elput_Manager 210struct _Elput_Manager
79{ 211{
80 Elput_Interface *interface; 212 Elput_Interface *interface;
@@ -96,6 +228,13 @@ struct _Elput_Manager
96 Eina_Bool sync : 1; 228 Eina_Bool sync : 1;
97}; 229};
98 230
231int _evdev_event_process(struct libinput_event *event);
232Elput_Device *_evdev_device_create(Elput_Seat *seat, struct libinput_device *device);
233void _evdev_device_destroy(Elput_Device *edev);
234void _evdev_keyboard_destroy(Elput_Keyboard *kbd);
235void _evdev_pointer_destroy(Elput_Pointer *ptr);
236void _evdev_touch_destroy(Elput_Touch *touch);
237
99extern Elput_Interface _logind_interface; 238extern Elput_Interface _logind_interface;
100 239
101#endif 240#endif