gdkdevice.h 6.11 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* 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
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16
17
 */

18
19
20
#ifndef __GDK_DEVICE_H__
#define __GDK_DEVICE_H__

21
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
22
23
24
#error "Only <gdk/gdk.h> can be included directly."
#endif

25
#include <gdk/gdkversionmacros.h>
26
#include <gdk/gdktypes.h>
Matthias Clasen's avatar
Matthias Clasen committed
27
#include <gdk/gdkdevicetool.h>
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42


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.
William Jon McCann's avatar
William Jon McCann committed
43
 * @GDK_SOURCE_CURSOR: the device is a graphics tablet “puck” or similar device.
44
 * @GDK_SOURCE_KEYBOARD: the device is a keyboard.
45
46
47
48
 * @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.
49
50
 * @GDK_SOURCE_TRACKPOINT: the device is a trackpoint. This device type has been
 *     added in 3.22
51
52
53
 * @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.
54
55
56
57
58
59
60
61
 *
 * An enumeration describing the type of an input device in general terms.
 */
typedef enum
{
  GDK_SOURCE_MOUSE,
  GDK_SOURCE_PEN,
  GDK_SOURCE_CURSOR,
62
63
  GDK_SOURCE_KEYBOARD,
  GDK_SOURCE_TOUCHSCREEN,
64
  GDK_SOURCE_TOUCHPAD,
65
66
  GDK_SOURCE_TRACKPOINT,
  GDK_SOURCE_TABLET_PAD
67
68
69
70
} GdkInputSource;

/**
 * GdkDeviceType:
71
72
73
74
75
 * @GDK_DEVICE_TYPE_LOGICAL: Device is a logical device. There will
 *   be an associated focus indicator on the screen.
 * @GDK_DEVICE_TYPE_PHYSICAL: Device is a physical device.
 * @GDK_DEVICE_TYPE_FLOATING: Device is a physical device, currently
 *   not attached to any seat.
76
 *
77
 * Indicates the device type.
78
79
 */
typedef enum {
80
81
  GDK_DEVICE_TYPE_LOGICAL,
  GDK_DEVICE_TYPE_PHYSICAL,
82
83
84
85
86
87
88
  GDK_DEVICE_TYPE_FLOATING
} GdkDeviceType;


/**
 * GdkTimeCoord:
 * @time: The timestamp for this event.
Matthias Clasen's avatar
Matthias Clasen committed
89
90
 * @flags: Flags indicating what axes are present
 * @axes: axis values
91
 *
92
 * A #GdkTimeCoord stores a single event in a motion history.
93
94
95
96
 */
struct _GdkTimeCoord
{
  guint32 time;
Matthias Clasen's avatar
Matthias Clasen committed
97
98
  GdkAxisFlags flags;
  double axes[GDK_AXIS_LAST];
99
100
};

101
GDK_AVAILABLE_IN_ALL
102
GType                 gdk_device_get_type       (void) G_GNUC_CONST;
103

104
GDK_AVAILABLE_IN_ALL
105
const gchar *         gdk_device_get_name       (GdkDevice *device);
106
GDK_AVAILABLE_IN_ALL
107
108
109
gboolean              gdk_device_get_has_cursor (GdkDevice *device);

/* Functions to configure a device */
110
GDK_AVAILABLE_IN_ALL
111
GdkInputSource gdk_device_get_source (GdkDevice    *device);
112

113
GDK_AVAILABLE_IN_ALL
114
115
116
117
GdkAxisUse     gdk_device_get_axis_use  (GdkDevice         *device,
                                         guint              index_);


118
GDK_AVAILABLE_IN_ALL
119
void     gdk_device_get_state    (GdkDevice         *device,
120
                                  GdkSurface         *surface,
Matthias Clasen's avatar
Matthias Clasen committed
121
122
                                  gdouble           *axes,
                                  GdkModifierType   *mask);
123
GDK_AVAILABLE_IN_ALL
124
125
126
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
                                                 double    *win_x,
                                                 double    *win_y);
127

128
GDK_AVAILABLE_IN_ALL
129
gint     gdk_device_get_n_axes     (GdkDevice       *device);
130
GDK_AVAILABLE_IN_ALL
131
gboolean gdk_device_get_axis     (GdkDevice         *device,
Matthias Clasen's avatar
Matthias Clasen committed
132
133
134
                                  gdouble           *axes,
                                  GdkAxisUse         use,
                                  gdouble           *value);
135
GDK_AVAILABLE_IN_ALL
136
137
GdkDisplay * gdk_device_get_display (GdkDevice      *device);

138
GDK_AVAILABLE_IN_ALL
139
GdkDevice  * gdk_device_get_associated_device (GdkDevice     *device);
140
GDK_AVAILABLE_IN_ALL
141
GList *      gdk_device_list_physical_devices (GdkDevice     *device);
142

143
GDK_AVAILABLE_IN_ALL
144
145
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);

Matthias Clasen's avatar
Matthias Clasen committed
146
GDK_AVAILABLE_IN_ALL
147
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);
148

Matthias Clasen's avatar
Matthias Clasen committed
149
GDK_AVAILABLE_IN_ALL
150
const gchar *gdk_device_get_vendor_id       (GdkDevice *device);
Matthias Clasen's avatar
Matthias Clasen committed
151
GDK_AVAILABLE_IN_ALL
152
153
const gchar *gdk_device_get_product_id      (GdkDevice *device);

Matthias Clasen's avatar
Matthias Clasen committed
154
GDK_AVAILABLE_IN_ALL
155
156
GdkSeat     *gdk_device_get_seat            (GdkDevice *device);

Matthias Clasen's avatar
Matthias Clasen committed
157
GDK_AVAILABLE_IN_ALL
158
159
GdkAxisFlags gdk_device_get_axes            (GdkDevice *device);

Matthias Clasen's avatar
Matthias Clasen committed
160
161
162
163
164
165
GDK_AVAILABLE_IN_ALL
guint           gdk_device_get_num_touches  (GdkDevice *device);

GDK_AVAILABLE_IN_ALL
GdkDeviceTool * gdk_device_get_device_tool  (GdkDevice *device);

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
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);

184
185
186
G_END_DECLS

#endif /* __GDK_DEVICE_H__ */