1/* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __GDK_DEVICE_H__
19#define __GDK_DEVICE_H__
20
21#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
22#error "Only <gdk/gdk.h> can be included directly."
23#endif
24
25#include <gdk/gdkversionmacros.h>
26#include <gdk/gdktypes.h>
27#include <gdk/gdkdevicetool.h>
28#include <gdk/gdkenums.h>
29
30
31G_BEGIN_DECLS
32
33#define GDK_TYPE_DEVICE (gdk_device_get_type ())
34#define GDK_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE, GdkDevice))
35#define GDK_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE))
36
37typedef struct _GdkTimeCoord GdkTimeCoord;
38
39/**
40 * GdkInputSource:
41 * @GDK_SOURCE_MOUSE: the device is a mouse. (This will be reported for the core
42 * pointer, even if it is something else, such as a trackball.)
43 * @GDK_SOURCE_PEN: the device is a stylus of a graphics tablet or similar device.
44 * @GDK_SOURCE_KEYBOARD: the device is a keyboard.
45 * @GDK_SOURCE_TOUCHSCREEN: the device is a direct-input touch device, such
46 * as a touchscreen or tablet
47 * @GDK_SOURCE_TOUCHPAD: the device is an indirect touch device, such
48 * as a touchpad
49 * @GDK_SOURCE_TRACKPOINT: the device is a trackpoint
50 * @GDK_SOURCE_TABLET_PAD: the device is a "pad", a collection of buttons,
51 * rings and strips found in drawing tablets
52 *
53 * An enumeration describing the type of an input device in general terms.
54 */
55typedef enum
56{
57 GDK_SOURCE_MOUSE,
58 GDK_SOURCE_PEN,
59 GDK_SOURCE_KEYBOARD,
60 GDK_SOURCE_TOUCHSCREEN,
61 GDK_SOURCE_TOUCHPAD,
62 GDK_SOURCE_TRACKPOINT,
63 GDK_SOURCE_TABLET_PAD
64} GdkInputSource;
65
66/**
67 * GdkTimeCoord:
68 * @time: The timestamp for this event
69 * @flags: Flags indicating what axes are present
70 * @axes: (array fixed-size=12): axis values
71 *
72 * A `GdkTimeCoord` stores a single event in a motion history.
73 */
74struct _GdkTimeCoord
75{
76 guint32 time;
77 GdkAxisFlags flags;
78 double axes[GDK_AXIS_LAST];
79};
80
81GDK_AVAILABLE_IN_ALL
82GType gdk_device_get_type (void) G_GNUC_CONST;
83
84GDK_AVAILABLE_IN_ALL
85const char * gdk_device_get_name (GdkDevice *device);
86GDK_AVAILABLE_IN_ALL
87const char * gdk_device_get_vendor_id (GdkDevice *device);
88GDK_AVAILABLE_IN_ALL
89const char * gdk_device_get_product_id (GdkDevice *device);
90
91GDK_AVAILABLE_IN_ALL
92GdkDisplay * gdk_device_get_display (GdkDevice *device);
93GDK_AVAILABLE_IN_ALL
94GdkSeat * gdk_device_get_seat (GdkDevice *device);
95GDK_AVAILABLE_IN_ALL
96GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
97
98GDK_AVAILABLE_IN_ALL
99GdkInputSource gdk_device_get_source (GdkDevice *device);
100GDK_AVAILABLE_IN_ALL
101gboolean gdk_device_get_has_cursor (GdkDevice *device);
102GDK_AVAILABLE_IN_ALL
103guint gdk_device_get_num_touches (GdkDevice *device);
104GDK_AVAILABLE_IN_ALL
105GdkModifierType gdk_device_get_modifier_state (GdkDevice *device);
106GDK_AVAILABLE_IN_ALL
107PangoDirection gdk_device_get_direction (GdkDevice *device);
108GDK_AVAILABLE_IN_ALL
109gboolean gdk_device_has_bidi_layouts (GdkDevice *device);
110GDK_AVAILABLE_IN_ALL
111gboolean gdk_device_get_caps_lock_state (GdkDevice *device);
112GDK_AVAILABLE_IN_ALL
113gboolean gdk_device_get_num_lock_state (GdkDevice *device);
114GDK_AVAILABLE_IN_ALL
115gboolean gdk_device_get_scroll_lock_state (GdkDevice *device);
116
117GDK_AVAILABLE_IN_ALL
118GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
119 double *win_x,
120 double *win_y);
121
122GDK_AVAILABLE_IN_4_2
123guint32 gdk_device_get_timestamp (GdkDevice *device);
124G_END_DECLS
125
126#endif /* __GDK_DEVICE_H__ */
127

source code of gtk/gdk/gdkdevice.h