]> Pileus Git - ~andy/gtk/blob - gdk/gdkinternals.h
Remove unused get_offsets functions from headers
[~andy/gtk] / gdk / gdkinternals.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 /* Uninstalled header defining types and functions internal to GDK */
28
29 #ifndef __GDK_INTERNALS_H__
30 #define __GDK_INTERNALS_H__
31
32 #include <gio/gio.h>
33 #include "gdkwindowimpl.h"
34 #include "gdkdisplay.h"
35 #include "gdkprivate.h"
36
37 G_BEGIN_DECLS
38
39 /**********************
40  * General Facilities * 
41  **********************/
42
43 /* Debugging support */
44
45 typedef struct _GdkColorInfo           GdkColorInfo;
46 typedef struct _GdkEventFilter         GdkEventFilter;
47 typedef struct _GdkClientFilter        GdkClientFilter;
48
49 typedef enum {
50   GDK_COLOR_WRITEABLE = 1 << 0
51 } GdkColorInfoFlags;
52
53 struct _GdkColorInfo
54 {
55   GdkColorInfoFlags flags;
56   guint ref_count;
57 };
58
59 typedef enum {
60   GDK_EVENT_FILTER_REMOVED = 1 << 0
61 } GdkEventFilterFlags;
62
63 struct _GdkEventFilter {
64   GdkFilterFunc function;
65   gpointer data;
66   GdkEventFilterFlags flags;
67   guint ref_count;
68 };
69
70 struct _GdkClientFilter {
71   GdkAtom       type;
72   GdkFilterFunc function;
73   gpointer      data;
74 };
75
76 typedef enum {
77   GDK_DEBUG_MISC          = 1 << 0,
78   GDK_DEBUG_EVENTS        = 1 << 1,
79   GDK_DEBUG_DND           = 1 << 2,
80   GDK_DEBUG_XIM           = 1 << 3,
81   GDK_DEBUG_NOGRABS       = 1 << 4,
82   GDK_DEBUG_COLORMAP      = 1 << 5,
83   GDK_DEBUG_INPUT         = 1 << 6,
84   GDK_DEBUG_CURSOR        = 1 << 7,
85   GDK_DEBUG_MULTIHEAD     = 1 << 8,
86   GDK_DEBUG_XINERAMA      = 1 << 9,
87   GDK_DEBUG_DRAW          = 1 <<10,
88   GDK_DEBUG_EVENTLOOP     = 1 <<11
89 } GdkDebugFlag;
90
91 extern GList            *_gdk_default_filters;
92 extern GdkWindow        *_gdk_parent_root;
93
94 extern guint _gdk_debug_flags;
95 extern gboolean _gdk_native_windows;
96
97 #ifdef G_ENABLE_DEBUG
98
99 #define GDK_NOTE(type,action)                G_STMT_START { \
100     if (_gdk_debug_flags & GDK_DEBUG_##type)                \
101        { action; };                          } G_STMT_END
102
103 #else /* !G_ENABLE_DEBUG */
104
105 #define GDK_NOTE(type,action)
106
107 #endif /* G_ENABLE_DEBUG */
108
109 /* Arg parsing */
110
111 typedef enum 
112 {
113   GDK_ARG_STRING,
114   GDK_ARG_INT,
115   GDK_ARG_BOOL,
116   GDK_ARG_NOBOOL,
117   GDK_ARG_CALLBACK
118 } GdkArgType;
119
120 typedef struct _GdkArgContext GdkArgContext;
121 typedef struct _GdkArgDesc GdkArgDesc;
122
123 typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
124
125 struct _GdkArgContext
126 {
127   GPtrArray *tables;
128   gpointer cb_data;
129 };
130
131 struct _GdkArgDesc
132 {
133   const char *name;
134   GdkArgType type;
135   gpointer location;
136   GdkArgFunc callback;
137 };
138
139 /* Event handling */
140
141 typedef struct _GdkEventPrivate GdkEventPrivate;
142
143 typedef enum
144 {
145   /* Following flag is set for events on the event queue during
146    * translation and cleared afterwards.
147    */
148   GDK_EVENT_PENDING = 1 << 0
149 } GdkEventFlags;
150
151 struct _GdkEventPrivate
152 {
153   GdkEvent   event;
154   guint      flags;
155   GdkScreen *screen;
156   gpointer   windowing_data;
157   GdkDevice *device;
158   GdkDevice *source_device;
159 };
160
161 typedef struct _GdkWindowPaint GdkWindowPaint;
162
163 struct _GdkWindow
164 {
165   GObject parent_instance;
166
167   GdkWindowImpl *impl; /* window-system-specific delegate object */  
168   
169   GdkWindow *parent;
170   GdkVisual *visual;
171
172   gpointer user_data;
173
174   gint x;
175   gint y;
176   
177   gint extension_events;
178
179   GList *filters;
180   GList *children;
181
182   cairo_pattern_t *background;
183   
184   GSList *paint_stack;
185   
186   cairo_region_t *update_area;
187   guint update_freeze_count;
188   
189   guint8 window_type;
190   guint8 depth;
191   guint8 resize_count;
192
193   GdkWindowState state;
194   
195   guint guffaw_gravity : 1;
196   guint input_only : 1;
197   guint modal_hint : 1;
198   guint composited : 1;
199   
200   guint destroyed : 2;
201
202   guint accept_focus : 1;
203   guint focus_on_map : 1;
204   guint shaped : 1;
205   guint support_multidevice : 1;
206   
207   GdkEventMask event_mask;
208
209   guint update_and_descendants_freeze_count;
210
211   /* The GdkWindow that has the impl, ref:ed if another window.
212    * This ref is required to keep the wrapper of the impl window alive
213    * for as long as any GdkWindow references the impl. */
214   GdkWindow *impl_window; 
215   int abs_x, abs_y; /* Absolute offset in impl */
216   gint width, height;
217   guint32 clip_tag;
218   cairo_region_t *clip_region; /* Clip region (wrt toplevel) in window coords */
219   cairo_region_t *clip_region_with_children; /* Clip region in window coords */
220   GdkCursor *cursor;
221   GHashTable *device_cursor;
222   gint8 toplevel_window_type;
223   guint synthesize_crossing_event_queued : 1;
224   guint effective_visibility : 2;
225   guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
226   guint native_visibility : 2; /* the native visibility of a impl windows */
227   guint viewable : 1; /* mapped and all parents mapped */
228   guint applied_shape : 1;
229
230   guint num_offscreen_children;
231   GdkWindowPaint *implicit_paint;
232
233   GList *outstanding_moves;
234
235   cairo_region_t *shape;
236   cairo_region_t *input_shape;
237   
238   cairo_surface_t *cairo_surface;
239
240   GList *devices_inside;
241   GHashTable *device_events;
242
243   GHashTable *source_event_masks;
244   gulong device_added_handler_id;
245   gulong device_changed_handler_id;
246 };
247
248 #define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
249 #define GDK_WINDOW_DESTROYED(d) (GDK_WINDOW (d)->destroyed)
250
251 extern gchar     *_gdk_display_name;
252 extern gint       _gdk_screen_number;
253 extern gchar     *_gdk_display_arg_name;
254 extern gboolean   _gdk_disable_multidevice;
255
256 GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
257
258 void _gdk_event_filter_unref        (GdkWindow      *window,
259                                      GdkEventFilter *filter);
260
261 void   _gdk_event_emit               (GdkEvent   *event);
262 GList* _gdk_event_queue_find_first   (GdkDisplay *display);
263 void   _gdk_event_queue_remove_link  (GdkDisplay *display,
264                                       GList      *node);
265 GList* _gdk_event_queue_prepend      (GdkDisplay *display,
266                                       GdkEvent   *event);
267 GList* _gdk_event_queue_append       (GdkDisplay *display,
268                                       GdkEvent   *event);
269 GList* _gdk_event_queue_insert_after (GdkDisplay *display,
270                                       GdkEvent   *after_event,
271                                       GdkEvent   *event);
272 GList* _gdk_event_queue_insert_before(GdkDisplay *display,
273                                       GdkEvent   *after_event,
274                                       GdkEvent   *event);
275 void   _gdk_event_button_generate    (GdkDisplay *display,
276                                       GdkEvent   *event);
277
278 void _gdk_windowing_event_data_copy (const GdkEvent *src,
279                                      GdkEvent       *dst);
280 void _gdk_windowing_event_data_free (GdkEvent       *event);
281
282 void gdk_synthesize_window_state (GdkWindow     *window,
283                                   GdkWindowState unset_flags,
284                                   GdkWindowState set_flags);
285
286 GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
287
288 gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
289                                      GdkRectangle *extents);
290
291 /*************************************
292  * Interfaces used by windowing code *
293  *************************************/
294
295 cairo_surface_t *
296            _gdk_window_ref_cairo_surface (GdkWindow *window);
297
298 void       _gdk_window_impl_new          (GdkWindow      *window,
299                                           GdkWindow      *real_parent,
300                                           GdkScreen      *screen,
301                                           GdkEventMask    event_mask,
302                                           GdkWindowAttr  *attributes,
303                                           gint            attributes_mask);
304 void       _gdk_window_destroy           (GdkWindow      *window,
305                                           gboolean        foreign_destroy);
306 void       _gdk_window_clear_update_area (GdkWindow      *window);
307 void       _gdk_window_update_size       (GdkWindow      *window);
308 gboolean   _gdk_window_update_viewable   (GdkWindow      *window);
309
310 void       _gdk_window_process_updates_recurse (GdkWindow *window,
311                                                 cairo_region_t *expose_region);
312
313 void       _gdk_screen_close             (GdkScreen      *screen);
314
315 const char *_gdk_get_sm_client_id (void);
316
317 /*****************************************
318  * Interfaces provided by windowing code *
319  *****************************************/
320
321 /* Font/string functions implemented in module-specific code */
322
323 void _gdk_cursor_destroy (GdkCursor *cursor);
324
325 extern const GOptionEntry _gdk_windowing_args[];
326 gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
327                                                 gint         screen_number);
328
329 void _gdk_windowing_got_event                (GdkDisplay       *display,
330                                               GList            *event_link,
331                                               GdkEvent         *event,
332                                               gulong            serial);
333
334 #define GDK_WINDOW_IS_MAPPED(window) (((window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
335
336 #define GDK_TYPE_PAINTABLE            (_gdk_paintable_get_type ())
337 #define GDK_PAINTABLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PAINTABLE, GdkPaintable))
338 #define GDK_IS_PAINTABLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
339 #define GDK_PAINTABLE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_PAINTABLE, GdkPaintableIface))
340
341 typedef struct _GdkPaintable        GdkPaintable;
342 typedef struct _GdkPaintableIface   GdkPaintableIface;
343
344 struct _GdkPaintableIface
345 {
346   GTypeInterface g_iface;
347   
348   void (* begin_paint_region)       (GdkPaintable    *paintable,
349                                      GdkWindow       *window,
350                                      const cairo_region_t *region);
351   void (* end_paint)                (GdkPaintable    *paintable);
352 };
353
354 GType _gdk_paintable_get_type (void) G_GNUC_CONST;
355
356 void _gdk_window_invalidate_for_expose (GdkWindow       *window,
357                                         cairo_region_t       *region);
358
359 GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
360                                        int x, int y);
361 GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
362                                             double x, double y,
363                                             double *found_x,
364                                             double *found_y);
365
366 void _gdk_window_add_damage (GdkWindow *toplevel,
367                              cairo_region_t *damaged_region);
368
369 GdkEvent * _gdk_make_event (GdkWindow    *window,
370                             GdkEventType  type,
371                             GdkEvent     *event_in_queue,
372                             gboolean      before_event);
373 gboolean _gdk_window_event_parent_of (GdkWindow *parent,
374                                       GdkWindow *child);
375
376 void _gdk_synthesize_crossing_events (GdkDisplay                 *display,
377                                       GdkWindow                  *src,
378                                       GdkWindow                  *dest,
379                                       GdkDevice                  *device,
380                                       GdkDevice                  *source_device,
381                                       GdkCrossingMode             mode,
382                                       gint                        toplevel_x,
383                                       gint                        toplevel_y,
384                                       GdkModifierType             mask,
385                                       guint32                     time_,
386                                       GdkEvent                   *event_in_queue,
387                                       gulong                      serial,
388                                       gboolean                    non_linear);
389 void _gdk_display_set_window_under_pointer (GdkDisplay *display,
390                                             GdkDevice  *device,
391                                             GdkWindow  *window);
392
393
394 void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
395
396 cairo_region_t *_gdk_window_calculate_full_clip_region    (GdkWindow     *window,
397                                                       GdkWindow     *base_window,
398                                                       gboolean       do_children,
399                                                       gint          *base_x_offset,
400                                                       gint          *base_y_offset);
401 gboolean    _gdk_window_has_impl (GdkWindow *window);
402 GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
403
404 /*****************************
405  * offscreen window routines *
406  *****************************/
407 GType gdk_offscreen_window_get_type (void);
408 void       _gdk_offscreen_window_new                 (GdkWindow     *window,
409                                                       GdkWindowAttr *attributes,
410                                                       gint           attributes_mask);
411 cairo_surface_t * _gdk_offscreen_window_create_surface (GdkWindow *window,
412                                                         gint       width,
413                                                         gint       height);
414
415
416 G_END_DECLS
417
418 #endif /* __GDK_INTERNALS_H__ */