blob: d3fc645dcd13654b1a59d02ff23acadbffc4500c [file] [log] [blame]
Jonas Ådahle0de3c22014-03-12 22:08:42 +01001/*
2 * Copyright © 2011, 2012 Intel Corporation
3 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -07004 * 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:
Jonas Ådahle0de3c22014-03-12 22:08:42 +010011 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -070012 * 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.
Jonas Ådahle0de3c22014-03-12 22:08:42 +010024 */
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>
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -050034#include <stdbool.h>
Jonas Ådahle0de3c22014-03-12 22:08:42 +010035
Pekka Paalanen3d5d9472019-03-28 16:28:47 +020036#include <libweston/libweston.h>
Jonas Ådahle0de3c22014-03-12 22:08:42 +010037
38enum evdev_device_seat_capability {
39 EVDEV_SEAT_POINTER = (1 << 0),
40 EVDEV_SEAT_KEYBOARD = (1 << 1),
41 EVDEV_SEAT_TOUCH = (1 << 2)
42};
43
44struct evdev_device {
45 struct weston_seat *seat;
46 enum evdev_device_seat_capability seat_caps;
47 struct libinput_device *device;
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -050048 struct weston_touch_device *touch_device;
Jonas Ådahle0de3c22014-03-12 22:08:42 +010049 struct wl_list link;
50 struct weston_output *output;
51 struct wl_listener output_destroy_listener;
Jonas Ådahle0de3c22014-03-12 22:08:42 +010052 char *output_name;
53 int fd;
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -050054 bool override_wl_calibration;
Jonas Ådahle0de3c22014-03-12 22:08:42 +010055};
56
57void
58evdev_led_update(struct evdev_device *device, enum weston_led leds);
59
60struct evdev_device *
61evdev_device_create(struct libinput_device *libinput_device,
62 struct weston_seat *seat);
63
64int
65evdev_device_process_event(struct libinput_event *event);
66
67void
68evdev_device_set_output(struct evdev_device *device,
69 struct weston_output *output);
70void
71evdev_device_destroy(struct evdev_device *device);
72
73void
74evdev_notify_keyboard_focus(struct weston_seat *seat,
75 struct wl_list *evdev_devices);
Giulio Camuffo8aedf7b2016-06-02 21:48:12 +030076void
77evdev_device_set_calibration(struct evdev_device *device);
Jonas Ådahle0de3c22014-03-12 22:08:42 +010078
79int
80dispatch_libinput(struct libinput *libinput);
81
82#endif /* _LIBINPUT_DEVICE_H_ */