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