]> Pileus Git - ~andy/gtk/blob - gdk/gdkinternals.h
Private function to tell if we have RENDER extension.
[~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 #include <gdk/gdktypes.h>
30 #include <gdk/gdkprivate.h>
31
32 #ifndef __GDK_INTERNALS_H__
33 #define __GDK_INTERNALS_H__
34
35 /**********************
36  * General Facilities * 
37  **********************/
38
39 /* Debugging support */
40
41 typedef struct _GdkColorInfo           GdkColorInfo;
42 typedef struct _GdkEventFilter         GdkEventFilter;
43 typedef struct _GdkClientFilter        GdkClientFilter;
44
45 typedef enum {
46   GDK_COLOR_WRITEABLE = 1 << 0
47 } GdkColorInfoFlags;
48
49 struct _GdkColorInfo
50 {
51   GdkColorInfoFlags flags;
52   guint ref_count;
53 };
54
55 struct _GdkEventFilter {
56   GdkFilterFunc function;
57   gpointer data;
58 };
59
60 struct _GdkClientFilter {
61   GdkAtom       type;
62   GdkFilterFunc function;
63   gpointer      data;
64 };
65
66 typedef enum {
67   GDK_DEBUG_MISC          = 1 << 0,
68   GDK_DEBUG_EVENTS        = 1 << 1,
69   GDK_DEBUG_DND           = 1 << 2,
70   GDK_DEBUG_XIM           = 1 << 3,
71   GDK_DEBUG_NOGRABS       = 1 << 4,
72 } GdkDebugFlag;
73
74 #ifndef GDK_DISABLE_DEPRECATED
75
76 typedef struct _GdkFontPrivate         GdkFontPrivate;
77
78 struct _GdkFontPrivate
79 {
80   GdkFont font;
81   guint ref_count;
82 };
83
84 #endif /* GDK_DISABLE_DEPRECATED */
85
86 extern GList            *_gdk_default_filters;
87 extern GdkWindow        *_gdk_parent_root;
88 extern gint              _gdk_error_code;
89 extern gint              _gdk_error_warnings;
90
91 extern guint _gdk_debug_flags;
92
93 #ifdef G_ENABLE_DEBUG
94
95 #define GDK_NOTE(type,action)                G_STMT_START { \
96     if (_gdk_debug_flags & GDK_DEBUG_##type)                \
97        { action; };                          } G_STMT_END
98
99 #else /* !G_ENABLE_DEBUG */
100
101 #define GDK_NOTE(type,action)
102
103 #endif /* G_ENABLE_DEBUG */
104
105 /* Arg parsing */
106
107 typedef enum 
108 {
109   GDK_ARG_STRING,
110   GDK_ARG_INT,
111   GDK_ARG_BOOL,
112   GDK_ARG_NOBOOL,
113   GDK_ARG_CALLBACK
114 } GdkArgType;
115
116 typedef struct _GdkArgContext GdkArgContext;
117 typedef struct _GdkArgDesc GdkArgDesc;
118
119 typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
120
121 struct _GdkArgContext
122 {
123   GPtrArray *tables;
124   gpointer cb_data;
125 };
126
127 struct _GdkArgDesc
128 {
129   const char *name;
130   GdkArgType type;
131   gpointer location;
132   GdkArgFunc callback;
133 };
134
135 /* Event handling */
136
137 extern GdkEventFunc   _gdk_event_func;    /* Callback for events */
138 extern gpointer       _gdk_event_data;
139 extern GDestroyNotify _gdk_event_notify;
140
141 /* FIFO's for event queue, and for events put back using
142  * gdk_event_put().
143  */
144 extern GList *_gdk_queued_events;
145 extern GList *_gdk_queued_tail;
146
147 extern GdkDevice *_gdk_core_pointer;
148
149 GdkEvent* _gdk_event_new (void);
150
151 void      _gdk_events_init   (void);
152 void      _gdk_events_queue  (void);
153 GdkEvent* _gdk_event_unqueue (void);
154
155 GList* _gdk_event_queue_find_first  (void);
156 void   _gdk_event_queue_remove_link (GList    *node);
157 void   _gdk_event_queue_append      (GdkEvent *event);
158
159 void _gdk_event_button_generate (GdkEvent *event);
160
161 #define GDK_SCRATCH_IMAGE_WIDTH 256
162 #define GDK_SCRATCH_IMAGE_HEIGHT 64
163
164 GdkImage* _gdk_image_new_for_depth (GdkImageType  type,
165                                     GdkVisual    *visual,
166                                     gint          width,
167                                     gint          height,
168                                     gint          depth);
169 GdkImage *_gdk_image_get_scratch (gint  width,
170                                   gint  height,
171                                   gint  depth,
172                                   gint *x,
173                                   gint *y);
174
175 /* Will most likely be exported in the future
176  */
177 void _gdk_draw_pixbuf            (GdkDrawable  *drawable,
178                                   GdkGC        *gc,
179                                   GdkPixbuf    *pixbuf,
180                                   gint          src_x,
181                                   gint          src_y,
182                                   gint          dest_x,
183                                   gint          dest_y,
184                                   gint          width,
185                                   gint          height,
186                                   GdkRgbDither  dither,
187                                   gint          x_dither,
188                                   gint          y_dither);
189 GdkImage *_gdk_drawable_copy_to_image (GdkDrawable  *drawable,
190                                        GdkImage     *image,
191                                        gint          src_x,
192                                        gint          src_y,
193                                        gint          dest_x,
194                                        gint          dest_y,
195                                        gint          width,
196                                        gint          height);
197
198 /*************************************
199  * Interfaces used by windowing code *
200  *************************************/
201
202 void       _gdk_window_destroy           (GdkWindow   *window,
203                                           gboolean     foreign_destroy);
204 void       _gdk_window_clear_update_area (GdkWindow   *window);
205       
206
207 /*****************************************
208  * Interfaces provided by windowing code *
209  *****************************************/
210
211 /* Font/string functions implemented in module-specific code */
212 gint _gdk_font_strlen (GdkFont *font, const char *str);
213 void _gdk_font_destroy (GdkFont *font);
214
215 void _gdk_colormap_real_destroy (GdkColormap *colormap);
216
217 void _gdk_cursor_destroy (GdkCursor *cursor);
218
219 extern GdkArgDesc _gdk_windowing_args[];
220 gboolean _gdk_windowing_init_check              (int         argc,
221                                                  char      **argv);
222 void     _gdk_windowing_window_get_offsets      (GdkWindow  *window,
223                                                  gint       *x_offset,
224                                                  gint       *y_offset);
225 void     _gdk_windowing_window_clear_area       (GdkWindow  *window,
226                                                  gint        x,
227                                                  gint        y,
228                                                  gint        width,
229                                                  gint        height);
230 void     _gdk_windowing_window_clear_area_e     (GdkWindow  *window,
231                                                  gint        x,
232                                                  gint        y,
233                                                  gint        width,
234                                                  gint        height);
235
236 GdkWindow* _gdk_windowing_window_at_pointer  (GdkScreen       *screen,
237                                               gint            *win_x,
238                                               gint            *win_y);
239 GdkWindow* _gdk_windowing_window_get_pointer (GdkWindow       *window,
240                                               gint            *x,
241                                               gint            *y,
242                                               GdkModifierType *mask);
243
244 /* Return the number of bits-per-pixel for images of the specified depth.
245  * (Future: needs to be GdkDiplay specific.)
246  */
247 gint _gdk_windowing_get_bits_for_depth (gint depth);
248
249 #define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
250
251 /* Called before processing updates for a window. This gives the windowing
252  * layer a chance to save the region for later use in avoiding duplicate
253  * exposes. The return value indicates whether the function has a saved
254  * the region; if the result is TRUE, then the windowing layer is responsible
255  * for destroying the region later.
256  */
257 gboolean _gdk_windowing_window_queue_antiexpose (GdkWindow  *window,
258                                                  GdkRegion  *area);
259
260 /* Called to do the windowing system specific part of gdk_window_destroy(),
261  *
262  * window: The window being destroyed
263  * recursing: If TRUE, then this is being called because a parent
264  *            was destroyed. This generally means that the call to the windowing system
265  *            to destroy the window can be omitted, since it will be destroyed as a result
266  *            of the parent being destroyed. Unless @foreign_destroy
267  *            
268  * foreign_destroy: If TRUE, the window or a parent was destroyed by some external 
269  *            agency. The window has already been destroyed and no windowing
270  *            system calls should be made. (This may never happen for some
271  *            windowing systems.)
272  */
273 void _gdk_windowing_window_destroy (GdkWindow *window,
274                                     gboolean   recursing,
275                                     gboolean   foreign_destroy);
276
277 /* Implementation types */
278 GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
279 GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
280
281 /************************************
282  * Initialization and exit routines *
283  ************************************/
284
285 void _gdk_windowing_window_init (void);
286 void _gdk_visual_init (void);
287 void _gdk_dnd_init    (void);
288
289 void _gdk_windowing_image_init  (void);
290 void _gdk_image_exit  (void);
291
292 void _gdk_input_init  (void);
293 void _gdk_input_exit  (void);
294
295 void _gdk_windowing_exit (void);
296
297 #ifdef __cplusplus
298 }
299 #endif /* __cplusplus */
300
301 #endif /* __GDK_INTERNALS_H__ */