2 * Copyright © 2013 Jonas Ådahl
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the copyright holders not be used in
9 * advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. The copyright holders make
11 * no representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 #include "libinput-private.h"
32 keyboard_notify_key(struct libinput_device *device,
35 enum libinput_keyboard_key_state state)
37 if (device->keyboard_listener)
38 device->keyboard_listener->notify_key(
40 device->keyboard_listener_data);
44 pointer_notify_motion(struct libinput_device *device,
49 if (device->pointer_listener)
50 device->pointer_listener->notify_motion(
52 device->pointer_listener_data);
56 pointer_notify_motion_absolute(struct libinput_device *device,
61 if (device->pointer_listener)
62 device->pointer_listener->notify_motion_absolute(
64 device->pointer_listener_data);
68 pointer_notify_button(struct libinput_device *device,
71 enum libinput_pointer_button_state state)
73 if (device->pointer_listener)
74 device->pointer_listener->notify_button(
76 device->pointer_listener_data);
80 pointer_notify_axis(struct libinput_device *device,
82 enum libinput_pointer_axis axis,
85 if (device->pointer_listener)
86 device->pointer_listener->notify_axis(
88 device->pointer_listener_data);
92 touch_notify_touch(struct libinput_device *device,
97 enum libinput_touch_type touch_type)
99 if (device->touch_listener)
100 device->touch_listener->notify_touch(
101 time, slot, x, y, touch_type,
102 device->touch_listener_data);
106 libinput_device_set_keyboard_listener(
107 struct libinput_device *device,
108 const struct libinput_keyboard_listener *listener,
111 device->keyboard_listener = listener;
112 device->keyboard_listener_data = data;
116 libinput_device_set_pointer_listener(
117 struct libinput_device *device,
118 const struct libinput_pointer_listener *listener,
121 device->pointer_listener = listener;
122 device->pointer_listener_data = data;
126 libinput_device_set_touch_listener(
127 struct libinput_device *device,
128 const struct libinput_touch_listener *listener,
131 device->touch_listener = listener;
132 device->touch_listener_data = data;
136 libinput_device_dispatch(struct libinput_device *device)
138 return evdev_device_dispatch((struct evdev_device *) device);
142 libinput_device_destroy(struct libinput_device *device)
144 evdev_device_destroy((struct evdev_device *) device);
148 libinput_device_led_update(struct libinput_device *device,
149 enum libinput_led leds)
151 evdev_device_led_update((struct evdev_device *) device, leds);
155 libinput_device_get_keys(struct libinput_device *device,
156 char *keys, size_t size)
158 return evdev_device_get_keys((struct evdev_device *) device,
164 libinput_device_calibrate(struct libinput_device *device,
165 float calibration[6])
167 evdev_device_calibrate((struct evdev_device *) device, calibration);