• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2011, 2012 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial
14  * portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25 
26 #ifndef _LIBINPUT_DEVICE_H_
27 #define _LIBINPUT_DEVICE_H_
28 
29 #include "config.h"
30 
31 #include <linux/input.h>
32 #include <wayland-util.h>
33 #include <libinput.h>
34 #include <stdbool.h>
35 
36 #include <libweston/libweston.h>
37 
38 enum evdev_device_seat_capability {
39 	EVDEV_SEAT_POINTER = (1 << 0),
40 	EVDEV_SEAT_KEYBOARD = (1 << 1),
41 	EVDEV_SEAT_TOUCH = (1 << 2)
42 };
43 
44 struct evdev_device {
45 	struct weston_seat *seat;
46 	enum evdev_device_seat_capability seat_caps;
47 	struct libinput_device *device;
48 	struct weston_touch_device *touch_device;
49 	struct wl_list link;
50 	struct weston_output *output;
51 	struct wl_listener output_destroy_listener;
52 	char *output_name;
53 	int fd;
54 	bool override_wl_calibration;
55 };
56 
57 void
58 evdev_led_update_l(struct evdev_device *device, enum weston_led leds);
59 
60 struct evdev_device *
61 evdev_device_create_l(struct libinput_device *libinput_device,
62 		    struct weston_seat *seat);
63 
64 int
65 evdev_device_process_event_l(struct libinput_event *event);
66 
67 void
68 evdev_device_set_output_l(struct evdev_device *device,
69 			struct weston_output *output);
70 void
71 evdev_device_destroy_l(struct evdev_device *device);
72 
73 void
74 evdev_notify_keyboard_focus_l(struct weston_seat *seat,
75 			    struct wl_list *evdev_devices);
76 void
77 evdev_device_set_calibration_l(struct evdev_device *device);
78 
79 int
80 dispatch_libinput(struct libinput *libinput);
81 
82 #endif /* _LIBINPUT_DEVICE_H_ */
83