Debian Codegraph @

clutter/evdev/clutter-evdev.h

raw
1 /*
2 * Clutter.
3 *
4 * An OpenGL based 'interactive canvas' library.
5 *
6 * Copyright (C) 2012 Intel Corp.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 *
21 *
22 */
23
24 #ifndef __CLUTTER_EVDEV_H__
25 #define __CLUTTER_EVDEV_H__
26
27 #include <glib.h>
28 #include <glib-object.h>
29 #include <xkbcommon/xkbcommon.h>
30 #include <clutter/clutter.h>
31 #include <libinput.h>
32
33 G_BEGIN_DECLS
34
35 #if !defined(CLUTTER_ENABLE_COMPOSITOR_API) && !defined(CLUTTER_COMPILATION)
36 #error "You need to define CLUTTER_ENABLE_COMPOSITOR_API before including clutter-evdev.h"
37 #endif
38
39 /**
40 * ClutterOpenDeviceCallback:
41 * @path: the device path
42 * @flags: flags to be passed to open
43 *
44 * This callback will be called when Clutter needs to access an input
45 * device. It should return an open file descriptor for the file at @path,
46 * or -1 if opening failed.
47 */
48 typedef int (*ClutterOpenDeviceCallback) (const char *path,
49 int flags,
50 gpointer user_data,
51 GError **error);
52 typedef void (*ClutterCloseDeviceCallback) (int fd,
53 gpointer user_data);
54
55 CLUTTER_AVAILABLE_IN_1_16
56 void clutter_evdev_set_device_callbacks (ClutterOpenDeviceCallback open_callback,
57 ClutterCloseDeviceCallback close_callback,
58 gpointer user_data);
59
60 CLUTTER_AVAILABLE_IN_1_10
61 void clutter_evdev_release_devices (void);
62 CLUTTER_AVAILABLE_IN_1_10
63 void clutter_evdev_reclaim_devices (void);
64
65 /**
66 * ClutterPointerConstrainCallback:
67 * @device: the core pointer device
68 * @time: the event time in milliseconds
69 * @x: (inout): the new X coordinate
70 * @y: (inout): the new Y coordinate
71 * @user_data: user data passed to this function
72 *
73 * This callback will be called for all pointer motion events, and should
74 * update (@x, @y) to constrain the pointer position appropriately.
75 * The subsequent motion event will use the updated values as the new coordinates.
76 * Note that the coordinates are not clamped to the stage size, and the callback
77 * must make sure that this happens before it returns.
78 * Also note that the event will be emitted even if the pointer is constrained
79 * to be in the same position.
80 *
81 * Since: 1.16
82 */
83 typedef void (*ClutterPointerConstrainCallback) (ClutterInputDevice *device,
84 guint32 time,
85 float prev_x,
86 float prev_y,
87 float *x,
88 float *y,
89 gpointer user_data);
90
91 CLUTTER_AVAILABLE_IN_1_16
92 void clutter_evdev_set_pointer_constrain_callback (ClutterDeviceManager *evdev,
93 ClutterPointerConstrainCallback callback,
94 gpointer user_data,
95 GDestroyNotify user_data_notify);
96
97 CLUTTER_AVAILABLE_IN_1_16
98 void clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev,
99 struct xkb_keymap *keymap);
100
101 CLUTTER_AVAILABLE_IN_1_18
102 struct xkb_keymap * clutter_evdev_get_keyboard_map (ClutterDeviceManager *evdev);
103
104 CLUTTER_AVAILABLE_IN_1_20
105 void clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev,
106 xkb_layout_index_t idx);
107
108 CLUTTER_AVAILABLE_IN_1_18
109 void clutter_evdev_set_keyboard_repeat (ClutterDeviceManager *evdev,
110 gboolean repeat,
111 guint32 delay,
112 guint32 interval);
113
114 typedef gboolean (* ClutterEvdevFilterFunc) (struct libinput_event *event,
115 gpointer data);
116
117 CLUTTER_AVAILABLE_IN_1_20
118 void clutter_evdev_add_filter (ClutterEvdevFilterFunc func,
119 gpointer data,
120 GDestroyNotify destroy_notify);
121 CLUTTER_AVAILABLE_IN_1_20
122 void clutter_evdev_remove_filter (ClutterEvdevFilterFunc func,
123 gpointer data);
124 CLUTTER_AVAILABLE_IN_1_20
125 struct libinput_device * clutter_evdev_input_device_get_libinput_device (ClutterInputDevice *device);
126
127 CLUTTER_AVAILABLE_IN_1_20
128 gint32 clutter_evdev_event_sequence_get_slot (const ClutterEventSequence *sequence);
129
130 CLUTTER_AVAILABLE_IN_1_20
131 void clutter_evdev_warp_pointer (ClutterInputDevice *pointer_device,
132 guint32 time_,
133 int x,
134 int y);
135
136 CLUTTER_AVAILABLE_IN_1_26
137 guint32 clutter_evdev_event_get_event_code (const ClutterEvent *event);
138
139 CLUTTER_AVAILABLE_IN_1_26
140 guint64 clutter_evdev_event_get_time_usec (const ClutterEvent *event);
141
142 CLUTTER_AVAILABLE_IN_1_26
143 gboolean clutter_evdev_event_get_relative_motion (const ClutterEvent *event,
144 double *dx,
145 double *dy,
146 double *dx_unaccel,
147 double *dy_unaccel);
148
149 G_END_DECLS
150
151 #endif /* __CLUTTER_EVDEV_H__ */