]> Pileus Git - ~andy/gtk/blob - gdk/gdkdeviceprivate.h
Explode gdkinternals.h into per-class private headers
[~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 _GdkDeviceClass GdkDeviceClass;
34
35 typedef struct _GdkDeviceKey GdkDeviceKey;
36
37 struct _GdkDeviceKey
38 {
39   guint keyval;
40   GdkModifierType modifiers;
41 };
42
43 struct _GdkDevice
44 {
45   GObject parent_instance;
46
47   gchar *name;
48   GdkInputSource source;
49   GdkInputMode mode;
50   gboolean has_cursor;
51   gint num_keys;
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 };
63
64 struct _GdkDeviceClass
65 {
66   GObjectClass parent_class;
67
68   gboolean (* get_history)   (GdkDevice      *device,
69                               GdkWindow      *window,
70                               guint32         start,
71                               guint32         stop,
72                               GdkTimeCoord ***events,
73                               gint           *n_events);
74
75   void (* get_state)         (GdkDevice       *device,
76                               GdkWindow       *window,
77                               gdouble         *axes,
78                               GdkModifierType *mask);
79
80   void (* set_window_cursor) (GdkDevice *device,
81                               GdkWindow *window,
82                               GdkCursor *cursor);
83
84   void (* warp)              (GdkDevice  *device,
85                               GdkScreen  *screen,
86                               gint        x,
87                               gint        y);
88   gboolean (* query_state)   (GdkDevice        *device,
89                               GdkWindow        *window,
90                               GdkWindow       **root_window,
91                               GdkWindow       **child_window,
92                               gint             *root_x,
93                               gint             *root_y,
94                               gint             *win_x,
95                               gint             *win_y,
96                               GdkModifierType  *mask);
97   GdkGrabStatus (* grab)     (GdkDevice        *device,
98                               GdkWindow        *window,
99                               gboolean          owner_events,
100                               GdkEventMask      event_mask,
101                               GdkWindow        *confine_to,
102                               GdkCursor        *cursor,
103                               guint32           time_);
104   void          (*ungrab)    (GdkDevice        *device,
105                               guint32           time_);
106
107   GdkWindow * (* window_at_position) (GdkDevice       *device,
108                                       gint            *win_x,
109                                       gint            *win_y,
110                                       GdkModifierType *mask,
111                                       gboolean         get_toplevel);
112   void (* select_window_events)      (GdkDevice       *device,
113                                       GdkWindow       *window,
114                                       GdkEventMask     event_mask);
115 };
116
117 void  _gdk_device_set_associated_device (GdkDevice *device,
118                                          GdkDevice *relative);
119
120 void  _gdk_device_reset_axes (GdkDevice   *device);
121 guint _gdk_device_add_axis   (GdkDevice   *device,
122                               GdkAtom      label_atom,
123                               GdkAxisUse   use,
124                               gdouble      min_value,
125                               gdouble      max_value,
126                               gdouble      resolution);
127
128 void _gdk_device_set_keys    (GdkDevice   *device,
129                               guint        num_keys);
130
131 GdkAxisUse _gdk_device_get_axis_use (GdkDevice *device,
132                                      guint      index);
133
134 gboolean   _gdk_device_translate_window_coord (GdkDevice *device,
135                                                GdkWindow *window,
136                                                guint      index,
137                                                gdouble    value,
138                                                gdouble   *axis_value);
139
140 gboolean   _gdk_device_translate_screen_coord (GdkDevice *device,
141                                                GdkWindow *window,
142                                                gint       window_root_x,
143                                                gint       window_root_y,
144                                                guint      index,
145                                                gdouble    value,
146                                                gdouble   *axis_value);
147
148 gboolean   _gdk_device_translate_axis         (GdkDevice *device,
149                                                guint      index,
150                                                gdouble    value,
151                                                gdouble   *axis_value);
152
153 GdkTimeCoord ** _gdk_device_allocate_history  (GdkDevice *device,
154                                                gint       n_events);
155
156 void _gdk_device_add_slave (GdkDevice *device,
157                             GdkDevice *slave);
158 void _gdk_device_remove_slave (GdkDevice *device,
159                                GdkDevice *slave);
160
161 G_END_DECLS
162
163 #endif /* __GDK_DEVICE_PRIVATE_H__ */