]> Pileus Git - ~andy/gtk/blob - gdk/gdkinternals.h
Make gdkx.h the only installed header from gdk/x11. All structures in
[~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 } GdkDebugFlag;
72
73 #ifndef GDK_DISABLE_DEPRECATED
74
75 typedef struct _GdkFontPrivate         GdkFontPrivate;
76
77 struct _GdkFontPrivate
78 {
79   GdkFont font;
80   guint ref_count;
81 };
82
83 #endif /* GDK_DISABLE_DEPRECATED */
84
85 extern GList            *_gdk_default_filters;
86 extern GdkWindow        *_gdk_parent_root;
87 extern gint              _gdk_error_code;
88 extern gint              _gdk_error_warnings;
89
90 extern guint _gdk_debug_flags;
91
92 #ifdef G_ENABLE_DEBUG
93
94 #define GDK_NOTE(type,action)                G_STMT_START { \
95     if (_gdk_debug_flags & GDK_DEBUG_##type)                \
96        { action; };                          } G_STMT_END
97
98 #else /* !G_ENABLE_DEBUG */
99
100 #define GDK_NOTE(type,action)
101
102 #endif /* G_ENABLE_DEBUG */
103
104 /* Arg parsing */
105
106 typedef enum 
107 {
108   GDK_ARG_STRING,
109   GDK_ARG_INT,
110   GDK_ARG_BOOL,
111   GDK_ARG_NOBOOL,
112   GDK_ARG_CALLBACK
113 } GdkArgType;
114
115 typedef struct _GdkArgContext GdkArgContext;
116 typedef struct _GdkArgDesc GdkArgDesc;
117
118 typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
119
120 struct _GdkArgContext
121 {
122   GPtrArray *tables;
123   gpointer cb_data;
124 };
125
126 struct _GdkArgDesc
127 {
128   const char *name;
129   GdkArgType type;
130   gpointer location;
131   GdkArgFunc callback;
132 };
133
134 /* Event handling */
135
136 extern GdkEventFunc   _gdk_event_func;    /* Callback for events */
137 extern gpointer       _gdk_event_data;
138 extern GDestroyNotify _gdk_event_notify;
139
140 /* FIFO's for event queue, and for events put back using
141  * gdk_event_put().
142  */
143 extern GList *_gdk_queued_events;
144 extern GList *_gdk_queued_tail;
145
146 extern GdkDevice *_gdk_core_pointer;
147
148 GdkEvent* _gdk_event_new (void);
149
150 void      _gdk_events_init   (void);
151 void      _gdk_events_queue  (void);
152 GdkEvent* _gdk_event_unqueue (void);
153
154 GList* _gdk_event_queue_find_first  (void);
155 void   _gdk_event_queue_remove_link (GList    *node);
156 void   _gdk_event_queue_append      (GdkEvent *event);
157
158 void _gdk_event_button_generate (GdkEvent *event);
159
160 /*************************************
161  * Interfaces used by windowing code *
162  *************************************/
163
164 void       _gdk_window_destroy           (GdkWindow   *window,
165                                           gboolean     foreign_destroy);
166 void       _gdk_window_clear_update_area (GdkWindow   *window);
167       
168
169 /*****************************************
170  * Interfaces provided by windowing code *
171  *****************************************/
172
173 /* Font/string functions implemented in module-specific code */
174 gint _gdk_font_strlen (GdkFont *font, const char *str);
175 void _gdk_font_destroy (GdkFont *font);
176
177 void _gdk_colormap_real_destroy (GdkColormap *colormap);
178
179 void _gdk_cursor_destroy (GdkCursor *cursor);
180
181 extern GdkArgDesc _gdk_windowing_args[];
182 gboolean _gdk_windowing_init_check              (int         argc,
183                                                  char      **argv);
184 void     _gdk_windowing_window_get_offsets      (GdkWindow  *window,
185                                                  gint       *x_offset,
186                                                  gint       *y_offset);
187 void     _gdk_windowing_window_clear_area       (GdkWindow  *window,
188                                                  gint        x,
189                                                  gint        y,
190                                                  gint        width,
191                                                  gint        height);
192 void     _gdk_windowing_window_clear_area_e     (GdkWindow  *window,
193                                                  gint        x,
194                                                  gint        y,
195                                                  gint        width,
196                                                  gint        height);
197
198 GdkWindow* _gdk_windowing_window_at_pointer  (gint            *win_x,
199                                               gint            *win_y);
200 GdkWindow* _gdk_windowing_window_get_pointer (GdkWindow       *window,
201                                               gint            *x,
202                                               gint            *y,
203                                               GdkModifierType *mask);
204
205 #define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
206
207 /* Called before processing updates for a window. This gives the windowing
208  * layer a chance to save the region for later use in avoiding duplicate
209  * exposes. The return value indicates whether the function has a saved
210  * the region; if the result is TRUE, then the windowing layer is responsible
211  * for destroying the region later.
212  */
213 gboolean _gdk_windowing_window_queue_antiexpose (GdkWindow  *window,
214                                                  GdkRegion  *area);
215
216 /* Called to do the windowing system specific part of gdk_window_destroy(),
217  *
218  * window: The window being destroyed
219  * recursing: If TRUE, then this is being called because a parent
220  *            was destroyed. This generally means that the call to the windowing system
221  *            to destroy the window can be omitted, since it will be destroyed as a result
222  *            of the parent being destroyed. Unless @foreign_destroy
223  *            
224  * foreign_destroy: If TRUE, the window or a parent was destroyed by some external 
225  *            agency. The window has already been destroyed and no windowing
226  *            system calls should be made. (This may never happen for some
227  *            windowing systems.)
228  */
229 void _gdk_windowing_window_destroy (GdkWindow *window,
230                                     gboolean   recursing,
231                                     gboolean   foreign_destroy);
232
233 /* Implementation types */
234 GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
235 GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
236
237 /************************************
238  * Initialization and exit routines *
239  ************************************/
240
241 void _gdk_windowing_window_init (void);
242 void _gdk_visual_init (void);
243 void _gdk_dnd_init    (void);
244
245 void _gdk_windowing_image_init  (void);
246 void _gdk_image_exit  (void);
247
248 void _gdk_input_init  (void);
249 void _gdk_input_exit  (void);
250
251 void _gdk_windowing_exit (void);
252
253 #ifdef __cplusplus
254 }
255 #endif /* __cplusplus */
256
257 #endif /* __GDK_INTERNALS_H__ */