1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_DEVICE_H__
#define __GDK_DEVICE_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE (gdk_device_get_type ())
#define GDK_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE, GdkDevice))
#define GDK_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE))
typedef struct _GdkTimeCoord GdkTimeCoord;
/**
* GdkInputSource:
* @GDK_SOURCE_MOUSE: the device is a mouse. (This will be reported for the core
* pointer, even if it is something else, such as a trackball.)
* @GDK_SOURCE_PEN: the device is a stylus of a graphics tablet or similar device.
* @GDK_SOURCE_ERASER: the device is an eraser. Typically, this would be the other end
* of a stylus on a graphics tablet.
* @GDK_SOURCE_CURSOR: the device is a graphics tablet “puck” or similar device.
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
* @GDK_SOURCE_TOUCHSCREEN: the device is a direct-input touch device, such
* as a touchscreen or tablet. This device type has been added in 3.4.
* @GDK_SOURCE_TOUCHPAD: the device is an indirect touch device, such
* as a touchpad. This device type has been added in 3.4.
* @GDK_SOURCE_TRACKPOINT: the device is a trackpoint. This device type has been
* added in 3.22
* @GDK_SOURCE_TABLET_PAD: the device is a "pad", a collection of buttons,
* rings and strips found in drawing tablets. This device type has been
* added in 3.22.
*
* An enumeration describing the type of an input device in general terms.
*/
typedef enum
{
GDK_SOURCE_MOUSE,
GDK_SOURCE_PEN,
GDK_SOURCE_ERASER,
GDK_SOURCE_CURSOR,
GDK_SOURCE_KEYBOARD,
GDK_SOURCE_TOUCHSCREEN,
GDK_SOURCE_TOUCHPAD,
GDK_SOURCE_TRACKPOINT,
GDK_SOURCE_TABLET_PAD
} GdkInputSource;
/**
* GdkDeviceType:
* @GDK_DEVICE_TYPE_MASTER: Device is a master (or virtual) device. There will
* be an associated focus indicator on the screen.
* @GDK_DEVICE_TYPE_SLAVE: Device is a slave (or physical) device.
* @GDK_DEVICE_TYPE_FLOATING: Device is a physical device, currently not attached to
* any seat.
*
* Indicates the device type.
*/
typedef enum {
GDK_DEVICE_TYPE_MASTER,
GDK_DEVICE_TYPE_SLAVE,
GDK_DEVICE_TYPE_FLOATING
} GdkDeviceType;
/* We don't allocate each coordinate this big, but we use it to
* be ANSI compliant and avoid accessing past the defined limits.
*/
#define GDK_MAX_TIMECOORD_AXES 128
/**
* GdkTimeCoord:
* @time: The timestamp for this event.
* @axes: the values of the device’s axes.
*
* A #GdkTimeCoord stores a single event in a motion history.
*/
struct _GdkTimeCoord
{
guint32 time;
gdouble axes[GDK_MAX_TIMECOORD_AXES];
};
GDK_AVAILABLE_IN_ALL
GType gdk_device_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
const gchar * gdk_device_get_name (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_has_cursor (GdkDevice *device);
/* Functions to configure a device */
GDK_AVAILABLE_IN_ALL
GdkInputSource gdk_device_get_source (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_keys (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_key (GdkDevice *device,
guint index_,
guint *keyval,
GdkModifierType *modifiers);
GDK_AVAILABLE_IN_ALL
void gdk_device_set_key (GdkDevice *device,
guint index_,
guint keyval,
GdkModifierType modifiers);
GDK_AVAILABLE_IN_ALL
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_);
GDK_AVAILABLE_IN_ALL
void gdk_device_set_axis_use (GdkDevice *device,
guint index_,
GdkAxisUse use);
GDK_AVAILABLE_IN_ALL
void gdk_device_get_state (GdkDevice *device,
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
double *win_x,
double *win_y);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_history (GdkDevice *device,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events);
GDK_AVAILABLE_IN_ALL
void gdk_device_free_history (GdkTimeCoord **events,
gint n_events);
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_axes (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
char ** gdk_device_get_axis_names (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_axis_value (GdkDevice *device,
gdouble *axes,
const char *axis_label,
gdouble *value);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_axis (GdkDevice *device,
gdouble *axes,
GdkAxisUse use,
gdouble *value);
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_device_get_display (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_device_get_associated_device (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GList * gdk_device_list_slave_devices (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const gchar *gdk_device_get_vendor_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const gchar *gdk_device_get_product_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSeat *gdk_device_get_seat (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkAxisFlags gdk_device_get_axes (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
guint gdk_device_get_num_touches (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_caps_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_num_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_scroll_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkModifierType gdk_device_get_modifier_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
PangoDirection gdk_device_get_direction (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_has_bidi_layouts (GdkDevice *device);
G_END_DECLS
#endif /* __GDK_DEVICE_H__ */
|