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