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