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_PRIVATE_H__
19#define __GDK_DEVICE_PRIVATE_H__
20
21#include "gdkdevice.h"
22#include "gdkdevicetool.h"
23#include "gdkdevicemanager.h"
24#include "gdkevents.h"
25#include "gdkseat.h"
26
27G_BEGIN_DECLS
28
29#define GDK_DEVICE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE, GdkDeviceClass))
30#define GDK_IS_DEVICE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE))
31#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))
32
33typedef struct _GdkDeviceClass GdkDeviceClass;
34typedef struct _GdkDeviceKey GdkDeviceKey;
35
36struct _GdkDeviceKey
37{
38 guint keyval;
39 GdkModifierType modifiers;
40};
41
42struct _GdkDevice
43{
44 GObject parent_instance;
45
46 gchar *name;
47 GdkInputSource source;
48 GdkInputMode mode;
49 gboolean has_cursor;
50 gint num_keys;
51 GdkAxisFlags axis_flags;
52 GdkDeviceKey *keys;
53 GdkDeviceManager *manager;
54 GdkDisplay *display;
55 /* Paired master for master,
56 * associated master for slaves
57 */
58 GdkDevice *associated;
59 GList *slaves;
60 GdkDeviceType type;
61 GArray *axes;
62 guint num_touches;
63
64 gchar *vendor_id;
65 gchar *product_id;
66
67 GdkSeat *seat;
68 GdkDeviceTool *last_tool;
69};
70
71struct _GdkDeviceClass
72{
73 GObjectClass parent_class;
74
75 gboolean (* get_history) (GdkDevice *device,
76 GdkWindow *window,
77 guint32 start,
78 guint32 stop,
79 GdkTimeCoord ***events,
80 gint *n_events);
81
82 void (* get_state) (GdkDevice *device,
83 GdkWindow *window,
84 gdouble *axes,
85 GdkModifierType *mask);
86
87 void (* set_window_cursor) (GdkDevice *device,
88 GdkWindow *window,
89 GdkCursor *cursor);
90
91 void (* warp) (GdkDevice *device,
92 GdkScreen *screen,
93 gdouble x,
94 gdouble y);
95 void (* query_state) (GdkDevice *device,
96 GdkWindow *window,
97 GdkWindow **root_window,
98 GdkWindow **child_window,
99 gdouble *root_x,
100 gdouble *root_y,
101 gdouble *win_x,
102 gdouble *win_y,
103 GdkModifierType *mask);
104 GdkGrabStatus (* grab) (GdkDevice *device,
105 GdkWindow *window,
106 gboolean owner_events,
107 GdkEventMask event_mask,
108 GdkWindow *confine_to,
109 GdkCursor *cursor,
110 guint32 time_);
111 void (*ungrab) (GdkDevice *device,
112 guint32 time_);
113
114 GdkWindow * (* window_at_position) (GdkDevice *device,
115 double *win_x,
116 double *win_y,
117 GdkModifierType *mask,
118 gboolean get_toplevel);
119 void (* select_window_events) (GdkDevice *device,
120 GdkWindow *window,
121 GdkEventMask event_mask);
122};
123
124void _gdk_device_set_associated_device (GdkDevice *device,
125 GdkDevice *relative);
126
127void _gdk_device_reset_axes (GdkDevice *device);
128guint _gdk_device_add_axis (GdkDevice *device,
129 GdkAtom label_atom,
130 GdkAxisUse use,
131 gdouble min_value,
132 gdouble max_value,
133 gdouble resolution);
134void _gdk_device_get_axis_info (GdkDevice *device,
135 guint index,
136 GdkAtom *label_atom,
137 GdkAxisUse *use,
138 gdouble *min_value,
139 gdouble *max_value,
140 gdouble *resolution);
141
142void _gdk_device_set_keys (GdkDevice *device,
143 guint num_keys);
144
145gboolean _gdk_device_translate_window_coord (GdkDevice *device,
146 GdkWindow *window,
147 guint index,
148 gdouble value,
149 gdouble *axis_value);
150
151gboolean _gdk_device_translate_screen_coord (GdkDevice *device,
152 GdkWindow *window,
153 gdouble window_root_x,
154 gdouble window_root_y,
155 guint index,
156 gdouble value,
157 gdouble *axis_value);
158
159gboolean _gdk_device_translate_axis (GdkDevice *device,
160 guint index,
161 gdouble value,
162 gdouble *axis_value);
163
164GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
165 gint n_events);
166
167void _gdk_device_add_slave (GdkDevice *device,
168 GdkDevice *slave);
169void _gdk_device_remove_slave (GdkDevice *device,
170 GdkDevice *slave);
171void _gdk_device_query_state (GdkDevice *device,
172 GdkWindow *window,
173 GdkWindow **root_window,
174 GdkWindow **child_window,
175 gdouble *root_x,
176 gdouble *root_y,
177 gdouble *win_x,
178 gdouble *win_y,
179 GdkModifierType *mask);
180GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
181 gdouble *win_x,
182 gdouble *win_y,
183 GdkModifierType *mask,
184 gboolean get_toplevel);
185
186void gdk_device_set_seat (GdkDevice *device,
187 GdkSeat *seat);
188
189void gdk_device_update_tool (GdkDevice *device,
190 GdkDeviceTool *tool);
191
192GdkInputMode gdk_device_get_input_mode (GdkDevice *device);
193
194G_END_DECLS
195
196#endif /* __GDK_DEVICE_PRIVATE_H__ */
197