6fa212220fbbee40ff409742b5eaef878f09d238
[platform/core/uifw/libds-tizen.git] / src / libds / backend / libinput / backend.h
1 #ifndef DS_BACKEND_LIBINPUT_H
2 #define DS_BACKEND_LIBINPUT_H
3
4 #include <libinput.h>
5 #include <libudev.h>
6
7 #include "libds/interfaces/backend.h"
8 #include "libds/interfaces/input_device.h"
9 #include "libds/interfaces/pointer.h"
10 #include "libds/interfaces/keyboard.h"
11 #include "libds/interfaces/touch.h"
12
13 struct ds_libinput_backend
14 {
15     struct ds_backend base;
16
17     struct wl_display *display;
18     struct wl_listener display_destroy;
19
20     struct udev *udev;
21     struct libinput *libinput_context;
22     struct wl_list devices; // ds_libinput_input_device::link
23
24     struct wl_event_source *server_event_source;
25 };
26
27 struct ds_libinput_input_device
28 {
29     struct ds_input_device base;
30
31     struct ds_libinput_backend *backend;
32     struct libinput_device *handle;
33
34     struct wl_list link; //ds_libinput_backend.devices
35 };
36
37 struct ds_libinput_backend *
38         libinput_backend_from_backend(struct ds_backend *backend);
39
40 void handle_libinput_event(struct ds_libinput_backend *state,
41         struct libinput_event *event);
42
43 void destroy_libinput_input_device(struct ds_libinput_input_device *dev);
44
45 //keyboard
46 void handle_keyboard_key(struct libinput_event *event,
47         struct ds_keyboard *kbd);
48
49 //pointer
50 void handle_pointer_motion(struct libinput_event *event,
51         struct ds_pointer *pointer);
52 void handle_pointer_motion_abs(struct libinput_event *event,
53         struct ds_pointer *pointer);
54 void handle_pointer_button(struct libinput_event *event,
55         struct ds_pointer *pointer);
56 void handle_pointer_axis(struct libinput_event *event,
57         struct ds_pointer *pointer);
58
59 //touch
60 void handle_touch_down(struct libinput_event *event,
61         struct ds_touch *touch);
62 void handle_touch_up(struct libinput_event *event,
63         struct ds_touch *touch);
64 void handle_touch_motion(struct libinput_event *event,
65         struct ds_touch *touch);
66 void handle_touch_cancel(struct libinput_event *event,
67         struct ds_touch *touch);
68 void handle_touch_frame(struct libinput_event *event,
69         struct ds_touch *touch);
70
71 #endif