]> Pileus Git - ~andy/gtk/blob - gdk/gdkdeviceprivate.h
Detangle includes for device subclasses
[~andy/gtk] / gdk / gdkdeviceprivate.h
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GDK_DEVICE_PRIVATE_H__
21 #define __GDK_DEVICE_PRIVATE_H__
22
23 #include "gdkdevice.h"
24 #include "gdkdevicemanager.h"
25 #include "gdkevents.h"
26
27 G_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
33 typedef struct _GdkDeviceKey GdkDeviceKey;
34
35 struct _GdkDeviceKey
36 {
37   guint keyval;
38   GdkModifierType modifiers;
39 };
40
41 struct _GdkDevice
42 {
43   GObject parent_instance;
44
45   gchar *name;
46   GdkInputSource source;
47   GdkInputMode mode;
48   gboolean has_cursor;
49   gint num_keys;
50   GdkDeviceKey *keys;
51   GdkDeviceManager *manager;
52   GdkDisplay *display;
53   /* Paired master for master,
54    * associated master for slaves
55    */
56   GdkDevice *associated;
57   GList *slaves;
58   GdkDeviceType type;
59   GArray *axes;
60 };
61
62 struct _GdkDeviceClass
63 {
64   GObjectClass parent_class;
65
66   gboolean (* get_history)   (GdkDevice      *device,
67                               GdkWindow      *window,
68                               guint32         start,
69                               guint32         stop,
70                               GdkTimeCoord ***events,
71                               gint           *n_events);
72
73   void (* get_state)         (GdkDevice       *device,
74                               GdkWindow       *window,
75                               gdouble         *axes,
76                               GdkModifierType *mask);
77
78   void (* set_window_cursor) (GdkDevice *device,
79                               GdkWindow *window,
80                               GdkCursor *cursor);
81
82   void (* warp)              (GdkDevice  *device,
83                               GdkScreen  *screen,
84                               gint        x,
85                               gint        y);
86   gboolean (* query_state)   (GdkDevice       *device,
87                               GdkWindow       *window,
88                               GdkWindow      **root_window,
89                               GdkWindow      **child_window,
90                               gint             *root_x,
91                               gint             *root_y,
92                               gint             *win_x,
93                               gint             *win_y,
94                               GdkModifierType  *mask);
95   GdkGrabStatus (* grab)     (GdkDevice        *device,
96                               GdkWindow        *window,
97                               gboolean          owner_events,
98                               GdkEventMask      event_mask,
99                               GdkWindow        *confine_to,
100                               GdkCursor        *cursor,
101                               guint32           time_);
102   void          (*ungrab)    (GdkDevice        *device,
103                               guint32           time_);
104
105   GdkWindow * (* window_at_position) (GdkDevice       *device,
106                                       gint            *win_x,
107                                       gint            *win_y,
108                                       GdkModifierType *mask,
109                                       gboolean         get_toplevel);
110   void (* select_window_events)      (GdkDevice       *device,
111                                       GdkWindow       *window,
112                                       GdkEventMask     event_mask);
113 };
114
115 void  _gdk_device_set_associated_device (GdkDevice *device,
116                                          GdkDevice *relative);
117
118 void  _gdk_device_reset_axes (GdkDevice   *device);
119 guint _gdk_device_add_axis   (GdkDevice   *device,
120                               GdkAtom      label_atom,
121                               GdkAxisUse   use,
122                               gdouble      min_value,
123                               gdouble      max_value,
124                               gdouble      resolution);
125
126 void _gdk_device_set_keys    (GdkDevice   *device,
127                               guint        num_keys);
128
129 GdkAxisUse _gdk_device_get_axis_use (GdkDevice *device,
130                                      guint      index);
131
132 gboolean   _gdk_device_translate_window_coord (GdkDevice *device,
133                                                GdkWindow *window,
134                                                guint      index,
135                                                gdouble    value,
136                                                gdouble   *axis_value);
137
138 gboolean   _gdk_device_translate_screen_coord (GdkDevice *device,
139                                                GdkWindow *window,
140                                                gint       window_root_x,
141                                                gint       window_root_y,
142                                                guint      index,
143                                                gdouble    value,
144                                                gdouble   *axis_value);
145
146 gboolean   _gdk_device_translate_axis         (GdkDevice *device,
147                                                guint      index,
148                                                gdouble    value,
149                                                gdouble   *axis_value);
150
151 GdkTimeCoord ** _gdk_device_allocate_history  (GdkDevice *device,
152                                                gint       n_events);
153
154 void _gdk_device_add_slave (GdkDevice *device,
155                             GdkDevice *slave);
156 void _gdk_device_remove_slave (GdkDevice *device,
157                                GdkDevice *slave);
158 gboolean   _gdk_device_query_state            (GdkDevice        *device,
159                                                GdkWindow        *window,
160                                                GdkWindow       **root_window,
161                                                GdkWindow       **child_window,
162                                                gint             *root_x,
163                                                gint             *root_y,
164                                                gint             *win_x,
165                                                gint             *win_y,
166                                                GdkModifierType  *mask);
167 GdkWindow * _gdk_device_window_at_position    (GdkDevice        *device,
168                                                gint             *win_x,
169                                                gint             *win_y,
170                                                GdkModifierType  *mask,
171                                                gboolean          get_toplevel);
172
173 G_END_DECLS
174
175 #endif /* __GDK_DEVICE_PRIVATE_H__ */