summaryrefslogtreecommitdiff
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
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>
-rw-r--r--src/Makefile_Elput.am1
-rw-r--r--src/lib/elput/Elput.h15
-rw-r--r--src/lib/elput/elput_evdev.c464
-rw-r--r--src/lib/elput/elput_input.c100
-rw-r--r--src/lib/elput/elput_private.h139
5 files changed, 715 insertions, 4 deletions
diff --git a/src/Makefile_Elput.am b/src/Makefile_Elput.am
index c79763e298..d177f6d3e4 100644
--- a/src/Makefile_Elput.am
+++ b/src/Makefile_Elput.am
@@ -9,6 +9,7 @@ dist_installed_elputmainheaders_DATA = \
9 lib/elput/Elput.h 9 lib/elput/Elput.h
10 10
11lib_elput_libelput_la_SOURCES = \ 11lib_elput_libelput_la_SOURCES = \
12lib/elput/elput_evdev.c \
12lib/elput/elput_input.c \ 13lib/elput/elput_input.c \
13lib/elput/elput_logind.c \ 14lib/elput/elput_logind.c \
14lib/elput/elput_manager.c \ 15lib/elput/elput_manager.c \
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index 234597ff33..f6ad5d219c 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -28,6 +28,21 @@
28/* opaque structure to represent an input manager */ 28/* opaque structure to represent an input manager */
29typedef struct _Elput_Manager Elput_Manager; 29typedef struct _Elput_Manager Elput_Manager;
30 30
31/* opaque structure to represent an input seat */
32typedef struct _Elput_Seat Elput_Seat;
33
34/* opaque structure to represent an input device */
35typedef struct _Elput_Device Elput_Device;
36
37/* opaque structure to represent a keyboard */
38typedef struct _Elput_Keyboard Elput_Keyboard;
39
40/* opaque structure to represent a mouse */
41typedef struct _Elput_Pointer Elput_Pointer;
42
43/* opaque structure to represent a touch device */
44typedef struct _Elput_Touch Elput_Touch;
45
31/** 46/**
32 * @file 47 * @file
33 * @brief Ecore functions for dealing with libinput 48 * @brief Ecore functions for dealing with libinput
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
new file mode 100644
index 0000000000..4c347386df
--- /dev/null
+++ b/src/lib/elput/elput_evdev.c
@@ -0,0 +1,464 @@
1#include "elput_private.h"
2
3static void
4_seat_caps_update(Elput_Seat *seat)
5{
6 /* TODO: raise event for seat caps */
7}
8
9static int
10_keyboard_fd_get(off_t size)
11{
12 int fd = 0, blen = 0, len = 0;
13 const char *path;
14 char tmp[PATH_MAX];
15 long flags;
16
17 blen = sizeof(tmp) - 1;
18
19 if (!(path = getenv("XDG_RUNTIME_DIR")))
20 return -1;
21
22 len = strlen(path);
23 if (len < blen)
24 {
25 strcpy(tmp, path);
26 strcat(tmp, "/elput-keymap-XXXXXX");
27 }
28 else
29 return -1;
30
31 if ((fd = mkstemp(tmp)) < 0) return -1;
32
33 flags = fcntl(fd, F_GETFD);
34 if (flags < 0)
35 {
36 close(fd);
37 return -1;
38 }
39
40 if (fcntl(fd, F_SETFD, (flags | FD_CLOEXEC)) == -1)
41 {
42 close(fd);
43 return -1;
44 }
45
46 if (ftruncate(fd, size) < 0)
47 {
48 close(fd);
49 return -1;
50 }
51
52 unlink(tmp);
53 return fd;
54}
55
56static Elput_Keyboard_Info *
57_keyboard_info_create(struct xkb_keymap *keymap, Eina_Bool external)
58{
59 Elput_Keyboard_Info *info;
60 char *str;
61
62 info = calloc(1, sizeof(Elput_Keyboard_Info));
63 if (!info) return NULL;
64
65 info->keymap.map = xkb_keymap_ref(keymap);
66 info->refs = 1;
67
68 info->mods.super =
69 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_LOGO);
70 info->mods.shift =
71 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_SHIFT);
72 info->mods.caps =
73 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_CAPS);
74 info->mods.ctrl =
75 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_CTRL);
76 info->mods.alt =
77 1 << xkb_keymap_mod_get_index(info->keymap.map, XKB_MOD_NAME_ALT);
78 info->mods.altgr =
79 1 << xkb_keymap_mod_get_index(info->keymap.map, "ISO_Level3_Shift");
80
81 /* if we are using an external keymap then we do not need go further */
82 if (external) return info;
83
84 str = xkb_keymap_get_as_string(info->keymap.map, XKB_KEYMAP_FORMAT_TEXT_V1);
85 if (!str) goto err;
86
87 info->keymap.size = strlen(str) + 1;
88
89 info->keymap.fd = _keyboard_fd_get(info->keymap.size);
90 if (info->keymap.fd < 0) goto err_fd;
91
92 info->keymap.area =
93 mmap(NULL, info->keymap.size, PROT_READ | PROT_WRITE,
94 MAP_SHARED, info->keymap.fd, 0);
95 if (info->keymap.area == MAP_FAILED) goto err_map;
96
97 strcpy(info->keymap.area, str);
98 free(str);
99
100 return info;
101
102err_map:
103 close(info->keymap.fd);
104err_fd:
105 free(str);
106err:
107 xkb_keymap_unref(info->keymap.map);
108 free(info);
109 return NULL;
110}
111
112static void
113_keyboard_info_destroy(Elput_Keyboard_Info *info, Eina_Bool external)
114{
115 if (--info->refs > 0) return;
116
117 if (!external)
118 {
119 xkb_keymap_unref(info->keymap.map);
120 if (info->keymap.area) munmap(info->keymap.area, info->keymap.size);
121 if (info->keymap.fd >= 0) close(info->keymap.fd);
122 }
123
124 free(info);
125}
126
127static Eina_Bool
128_keyboard_global_build(Elput_Keyboard *kbd)
129{
130 struct xkb_keymap *keymap;
131
132 kbd->context = xkb_context_new(0);
133 if (!kbd->context) return EINA_FALSE;
134
135 if (!kbd->names.rules) kbd->names.rules = strdup("evdev");
136 if (!kbd->names.model) kbd->names.model = strdup("pc105");
137 if (!kbd->names.layout) kbd->names.layout = strdup("us");
138
139 keymap = xkb_keymap_new_from_names(kbd->context, &kbd->names, 0);
140 if (!keymap) return EINA_FALSE;
141
142 kbd->info = _keyboard_info_create(keymap, EINA_FALSE);
143 xkb_keymap_unref(keymap);
144
145 if (!kbd->info) return EINA_FALSE;
146 return EINA_TRUE;
147}
148
149static Elput_Keyboard *
150_keyboard_create(Elput_Seat *seat)
151{
152 Elput_Keyboard *kbd;
153
154 kbd = calloc(1, sizeof(Elput_Keyboard));
155 if (!kbd) return NULL;
156
157 kbd->seat = seat;
158 return kbd;
159}
160
161static Eina_Bool
162_keyboard_init(Elput_Seat *seat, struct xkb_keymap *keymap)
163{
164 Elput_Keyboard *kbd;
165
166 if (seat->kbd)
167 {
168 seat->count.kbd += 1;
169 if (seat->count.kbd == 1)
170 {
171 _seat_caps_update(seat);
172 return EINA_TRUE;
173 }
174 }
175
176 kbd = _keyboard_create(seat);
177 if (!kbd) return EINA_FALSE;
178
179 if (keymap)
180 {
181 kbd->info = _keyboard_info_create(keymap, EINA_TRUE);
182 if (!kbd->info) goto err;
183 }
184 else
185 {
186 if (!_keyboard_global_build(kbd)) goto err;
187 kbd->info->refs++;
188 }
189
190 kbd->state = xkb_state_new(kbd->info->keymap.map);
191 if (!kbd->state) goto err;
192
193 seat->kbd = kbd;
194 seat->count.kbd = 1;
195
196 _seat_caps_update(seat);
197
198 return EINA_TRUE;
199
200err:
201 if (kbd->info) _keyboard_info_destroy(kbd->info, kbd->external_map);
202 free(kbd);
203 return EINA_FALSE;
204}
205
206static void
207_keyboard_state_reset(Elput_Keyboard *kbd)
208{
209 struct xkb_state *state;
210
211 state = xkb_state_new(kbd->info->keymap.map);
212 if (!state) return;
213
214 xkb_state_unref(kbd->state);
215 kbd->state = state;
216}
217
218static void
219_keyboard_release(Elput_Seat *seat)
220{
221 seat->count.kbd--;
222 if (seat->count.kbd == 0)
223 {
224 _keyboard_state_reset(seat->kbd);
225 _seat_caps_update(seat);
226 }
227}
228
229static Elput_Pointer *
230_pointer_create(Elput_Seat *seat)
231{
232 Elput_Pointer *ptr;
233
234 ptr = calloc(1, sizeof(Elput_Pointer));
235 if (!ptr) return NULL;
236
237 ptr->seat = seat;
238
239 return ptr;
240}
241
242static Eina_Bool
243_pointer_init(Elput_Seat *seat)
244{
245 Elput_Pointer *ptr;
246
247 if (seat->ptr)
248 {
249 seat->count.ptr += 1;
250 if (seat->count.ptr == 1)
251 {
252 _seat_caps_update(seat);
253 return EINA_TRUE;
254 }
255 }
256
257 ptr = _pointer_create(seat);
258 if (!ptr) return EINA_FALSE;
259
260 seat->ptr = ptr;
261 seat->count.ptr = 1;
262
263 _seat_caps_update(seat);
264
265 return EINA_TRUE;
266}
267
268static void
269_pointer_release(Elput_Seat *seat)
270{
271 seat->count.ptr--;
272 if (seat->count.ptr == 0)
273 {
274 seat->ptr->buttons = 0;
275 _seat_caps_update(seat);
276 }
277}
278
279static Elput_Touch *
280_touch_create(Elput_Seat *seat)
281{
282 Elput_Touch *touch;
283
284 touch = calloc(1, sizeof(Elput_Touch));
285 if (!touch) return NULL;
286
287 touch->seat = seat;
288
289 return touch;
290}
291
292static Eina_Bool
293_touch_init(Elput_Seat *seat)
294{
295 Elput_Touch *touch;
296
297 if (seat->touch)
298 {
299 seat->count.touch += 1;
300 if (seat->count.touch == 1)
301 {
302 _seat_caps_update(seat);
303 return EINA_TRUE;
304 }
305 }
306
307 touch = _touch_create(seat);
308 if (!touch) return EINA_FALSE;
309
310 seat->touch = touch;
311 seat->count.touch = 1;
312
313 _seat_caps_update(seat);
314
315 return EINA_TRUE;
316}
317
318static void
319_touch_release(Elput_Seat *seat)
320{
321 seat->count.touch--;
322 if (seat->count.touch == 0)
323 {
324 seat->touch->points = 0;
325 _seat_caps_update(seat);
326 }
327}
328
329int
330_evdev_event_process(struct libinput_event *event)
331{
332 struct libinput_device *idev;
333 int ret = 1;
334 Eina_Bool frame = EINA_FALSE;
335
336 idev = libinput_event_get_device(event);
337 switch (libinput_event_get_type(event))
338 {
339 case LIBINPUT_EVENT_KEYBOARD_KEY:
340 break;
341 case LIBINPUT_EVENT_POINTER_MOTION:
342 break;
343 case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
344 break;
345 case LIBINPUT_EVENT_POINTER_BUTTON:
346 break;
347 case LIBINPUT_EVENT_POINTER_AXIS:
348 break;
349 case LIBINPUT_EVENT_TOUCH_DOWN:
350 break;
351 case LIBINPUT_EVENT_TOUCH_MOTION:
352 break;
353 case LIBINPUT_EVENT_TOUCH_UP:
354 break;
355 case LIBINPUT_EVENT_TOUCH_FRAME:
356 default:
357 ret = 0;
358 break;
359 }
360
361 if (frame)
362 {
363
364 }
365
366 return ret;
367}
368
369Elput_Device *
370_evdev_device_create(Elput_Seat *seat, struct libinput_device *device)
371{
372 Elput_Device *edev;
373
374 edev = calloc(1, sizeof(Elput_Device));
375 if (!edev) return NULL;
376
377 edev->seat = seat;
378 edev->device = device;
379
380 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD))
381 {
382 _keyboard_init(seat, NULL);
383 edev->caps |= EVDEV_SEAT_KEYBOARD;
384 }
385
386 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER))
387 {
388 _pointer_init(seat);
389 edev->caps |= EVDEV_SEAT_POINTER;
390 }
391
392 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))
393 {
394 _touch_init(seat);
395 edev->caps |= EVDEV_SEAT_TOUCH;
396 }
397
398 libinput_device_set_user_data(device, edev);
399 libinput_device_ref(edev->device);
400
401 if (libinput_device_config_tap_get_finger_count(edev->device) > 0)
402 {
403 Eina_Bool enable = EINA_FALSE;
404
405 enable = libinput_device_config_tap_get_default_enabled(edev->device);
406 libinput_device_config_tap_set_enabled(edev->device, enable);
407 }
408
409 /* FIXME: Normally we would do a device calibration set here however
410 * that requires Output support. Since this is just an input library, we
411 * may need to add external facing APIs to do calibration. Then a user of
412 * elput would handle outputs, and make calls to calibrate */
413
414 return edev;
415}
416
417void
418_evdev_device_destroy(Elput_Device *edev)
419{
420 if (!edev) return;
421
422 if (edev->caps & EVDEV_SEAT_POINTER)
423 _pointer_release(edev->seat);
424 if (edev->caps & EVDEV_SEAT_KEYBOARD)
425 _keyboard_release(edev->seat);
426 if (edev->caps & EVDEV_SEAT_TOUCH)
427 _touch_release(edev->seat);
428
429 libinput_device_unref(edev->device);
430 eina_stringshare_del(edev->output_name);
431 free(edev);
432}
433
434void
435_evdev_keyboard_destroy(Elput_Keyboard *kbd)
436{
437 free((char *)kbd->names.rules);
438 free((char *)kbd->names.model);
439 free((char *)kbd->names.layout);
440 free((char *)kbd->names.variant);
441 free((char *)kbd->names.options);
442
443 if (kbd->state) xkb_state_unref(kbd->state);
444 if (kbd->info) _keyboard_info_destroy(kbd->info, kbd->external_map);
445
446 xkb_context_unref(kbd->context);
447 xkb_keymap_unref(kbd->pending_map);
448
449 free(kbd);
450}
451
452void
453_evdev_pointer_destroy(Elput_Pointer *ptr)
454{
455 /* FIXME: destroy any resources inside pointer structure */
456 free(ptr);
457}
458
459void
460_evdev_touch_destroy(Elput_Touch *touch)
461{
462 /* FIXME: destroy any resources inside touch structure */
463 free(touch);
464}
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index c001e52e5a..499efcf48b 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -24,6 +24,95 @@ const struct libinput_interface _input_interface =
24 _cb_close_restricted, 24 _cb_close_restricted,
25}; 25};
26 26
27static Elput_Seat *
28_udev_seat_create(Elput_Manager *em, const char *name)
29{
30 Elput_Seat *eseat;
31
32 eseat = calloc(1, sizeof(Elput_Seat));
33 if (!eseat) return NULL;
34
35 eseat->name = eina_stringshare_add(name);
36 em->input.seats = eina_list_append(em->input.seats, eseat);
37
38 return eseat;
39}
40
41static void
42_udev_seat_destroy(Elput_Seat *eseat)
43{
44 Elput_Device *edev;
45
46 EINA_LIST_FREE(eseat->devices, edev)
47 _evdev_device_destroy(edev);
48
49 if (eseat->kbd) _evdev_keyboard_destroy(eseat->kbd);
50 if (eseat->ptr) _evdev_pointer_destroy(eseat->ptr);
51 if (eseat->touch) _evdev_touch_destroy(eseat->touch);
52
53 eina_stringshare_del(eseat->name);
54 free(eseat);
55}
56
57static Elput_Seat *
58_udev_seat_named_get(Elput_Manager *em, const char *name)
59{
60 Elput_Seat *eseat;
61 Eina_List *l;
62
63 EINA_LIST_FOREACH(em->input.seats, l, eseat)
64 if (!strcmp(eseat->name, name)) return eseat;
65
66 return _udev_seat_create(em, name);
67}
68
69static Elput_Seat *
70_udev_seat_get(Elput_Manager *em, struct libinput_device *device)
71{
72 struct libinput_seat *lseat;
73 const char *name;
74
75 lseat = libinput_device_get_seat(device);
76 name = libinput_seat_get_logical_name(lseat);
77
78 return _udev_seat_named_get(em, name);
79}
80
81static void
82_device_add(Elput_Manager *em, struct libinput_device *dev)
83{
84 Elput_Seat *eseat;
85 Elput_Device *edev;
86 const char *oname;
87
88 eseat = _udev_seat_get(em, dev);
89 if (!eseat) return;
90
91 edev = _evdev_device_create(eseat, dev);
92 if (!edev) return;
93
94 oname = libinput_device_get_output_name(dev);
95 eina_stringshare_replace(&edev->output_name, oname);
96
97 eseat->devices = eina_list_append(eseat->devices, edev);
98}
99
100static void
101_device_remove(Elput_Manager *em, struct libinput_device *device)
102{
103 Elput_Seat *eseat;
104 Elput_Device *edev;
105
106 edev = libinput_device_get_user_data(device);
107 if (!edev) return;
108
109 eseat = _udev_seat_get(em, device);
110 if (eseat)
111 eseat->devices = eina_list_remove(eseat->devices, edev);
112
113 _evdev_device_destroy(edev);
114}
115
27static int 116static int
28_udev_process_event(struct libinput_event *event) 117_udev_process_event(struct libinput_event *event)
29{ 118{
@@ -40,11 +129,11 @@ _udev_process_event(struct libinput_event *event)
40 { 129 {
41 case LIBINPUT_EVENT_DEVICE_ADDED: 130 case LIBINPUT_EVENT_DEVICE_ADDED:
42 DBG("Input Device Added: %s", libinput_device_get_name(dev)); 131 DBG("Input Device Added: %s", libinput_device_get_name(dev));
43 /* TODO: add device */ 132 _device_add(em, dev);
44 break; 133 break;
45 case LIBINPUT_EVENT_DEVICE_REMOVED: 134 case LIBINPUT_EVENT_DEVICE_REMOVED:
46 DBG("Input Device Removed: %s", libinput_device_get_name(dev)); 135 DBG("Input Device Removed: %s", libinput_device_get_name(dev));
47 /* TODO: remove device */ 136 _device_remove(em, dev);
48 break; 137 break;
49 default: 138 default:
50 ret = 0; 139 ret = 0;
@@ -58,7 +147,7 @@ static void
58_process_event(struct libinput_event *event) 147_process_event(struct libinput_event *event)
59{ 148{
60 if (_udev_process_event(event)) return; 149 if (_udev_process_event(event)) return;
61 /* TODO: evdev processing */ 150 if (_evdev_event_process(event)) return;
62} 151}
63 152
64static void 153static void
@@ -136,12 +225,15 @@ udev_err:
136EAPI void 225EAPI void
137elput_input_shutdown(Elput_Manager *manager) 226elput_input_shutdown(Elput_Manager *manager)
138{ 227{
228 Elput_Seat *seat;
229
139 EINA_SAFETY_ON_NULL_RETURN(manager); 230 EINA_SAFETY_ON_NULL_RETURN(manager);
140 EINA_SAFETY_ON_NULL_RETURN(&manager->input); 231 EINA_SAFETY_ON_NULL_RETURN(&manager->input);
141 232
142 if (manager->input.hdlr) ecore_main_fd_handler_del(manager->input.hdlr); 233 if (manager->input.hdlr) ecore_main_fd_handler_del(manager->input.hdlr);
143 234
144 /* TODO */ 235 EINA_LIST_FREE(manager->input.seats, seat)
236 _udev_seat_destroy(seat);
145 237
146 libinput_unref(manager->input.lib); 238 libinput_unref(manager->input.lib);
147} 239}
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