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