]> Pileus Git - ~andy/gtk/blob - gdk/gdkinternals.h
test the window state stuff
[~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 enum {
42   GDK_DEBUG_MISC          = 1 << 0,
43   GDK_DEBUG_EVENTS        = 1 << 1,
44   GDK_DEBUG_DND           = 1 << 2,
45   GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
46   GDK_DEBUG_XIM           = 1 << 4
47 } GdkDebugFlag;
48
49 extern gint              gdk_debug_level;
50 extern gboolean          gdk_show_events;
51 extern GList            *gdk_default_filters;
52
53 GDKVAR guint gdk_debug_flags;
54
55 #ifdef G_ENABLE_DEBUG
56
57 #define GDK_NOTE(type,action)                G_STMT_START { \
58     if (gdk_debug_flags & GDK_DEBUG_##type)                 \
59        { action; };                          } G_STMT_END
60
61 #else /* !G_ENABLE_DEBUG */
62
63 #define GDK_NOTE(type,action)
64
65 #endif /* G_ENABLE_DEBUG */
66
67 /* Arg parsing */
68
69 typedef enum 
70 {
71   GDK_ARG_STRING,
72   GDK_ARG_INT,
73   GDK_ARG_BOOL,
74   GDK_ARG_NOBOOL,
75   GDK_ARG_CALLBACK
76 } GdkArgType;
77
78 typedef struct _GdkArgContext GdkArgContext;
79 typedef struct _GdkArgDesc GdkArgDesc;
80
81 typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
82
83 struct _GdkArgContext
84 {
85   GPtrArray *tables;
86   gpointer cb_data;
87 };
88
89 struct _GdkArgDesc
90 {
91   const char *name;
92   GdkArgType type;
93   gpointer location;
94   GdkArgFunc callback;
95 };
96
97 /* Event handling */
98
99 extern GdkEventFunc   gdk_event_func;    /* Callback for events */
100 extern gpointer       gdk_event_data;
101 extern GDestroyNotify gdk_event_notify;
102
103 /* FIFO's for event queue, and for events put back using
104  * gdk_event_put().
105  */
106 extern GList *gdk_queued_events;
107 extern GList *gdk_queued_tail;
108
109 GdkEvent* gdk_event_new (void);
110
111 void      gdk_events_init   (void);
112 void      gdk_events_queue  (void);
113 GdkEvent* gdk_event_unqueue (void);
114
115 GList* gdk_event_queue_find_first  (void);
116 void   gdk_event_queue_remove_link (GList    *node);
117 void   gdk_event_queue_append      (GdkEvent *event);
118
119 void gdk_event_button_generate (GdkEvent *event);
120 void gdk_synthesize_window_state (GdkWindow     *window,
121                                   GdkWindowState unset_flags,
122                                   GdkWindowState set_flags);
123
124 /*************************************
125  * Interfaces used by windowing code *
126  *************************************/
127
128 #ifdef USE_XIM
129 /* XIM support */
130 gint   gdk_im_open               (void);
131 void   gdk_im_close              (void);
132 void   gdk_ic_cleanup            (void);
133 #endif /* USE_XIM */
134
135 void       _gdk_window_destroy           (GdkWindow   *window,
136                                           gboolean     foreign_destroy);
137 void       _gdk_window_clear_update_area (GdkWindow   *window);
138       
139
140 /*****************************************
141  * Interfaces provided by windowing code *
142  *****************************************/
143
144 /* Font/string functions implemented in module-specific code */
145 gint _gdk_font_strlen (GdkFont *font, const char *str);
146 void _gdk_font_destroy (GdkFont *font);
147
148 void _gdk_colormap_real_destroy (GdkColormap *colormap);
149
150 void _gdk_cursor_destroy (GdkCursor *cursor);
151
152 extern GdkArgDesc _gdk_windowing_args[];
153 gboolean _gdk_windowing_init_check              (int         argc,
154                                                  char      **argv);
155 void     _gdk_windowing_window_get_offsets      (GdkWindow  *window,
156                                                  gint       *x_offset,
157                                                  gint       *y_offset);
158 void     _gdk_windowing_window_clear_area       (GdkWindow  *window,
159                                                  gint        x,
160                                                  gint        y,
161                                                  gint        width,
162                                                  gint        height);
163 void     _gdk_windowing_window_clear_area_e     (GdkWindow  *window,
164                                                  gint        x,
165                                                  gint        y,
166                                                  gint        width,
167                                                  gint        height);
168
169 #define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
170
171 /* Called before processing updates for a window. This gives the windowing
172  * layer a chance to save the region for later use in avoiding duplicate
173  * exposes. The return value indicates whether the function has a saved
174  * the region; if the result is TRUE, then the windowing layer is responsible
175  * for destroying the region later.
176  */
177 gboolean _gdk_windowing_window_queue_antiexpose (GdkWindow  *window,
178                                                  GdkRegion  *area);
179
180 /* Called to do the windowing system specific part of gdk_window_destroy(),
181  *
182  * window: The window being destroyed
183  * recursing: If TRUE, then this is being called because a parent
184  *            was destroyed. This generally means that the call to the windowing system
185  *            to destroy the window can be omitted, since it will be destroyed as a result
186  *            of the parent being destroyed. Unless @foreign_destroy
187  *            
188  * foreign_destroy: If TRUE, the window or a parent was destroyed by some external 
189  *            agency. The window has already been destroyed and no windowing
190  *            system calls should be made. (This may never happen for some
191  *            windowing systems.)
192  */
193 void _gdk_windowing_window_destroy (GdkWindow *window,
194                                     gboolean   recursing,
195                                     gboolean   foreign_destroy);
196
197 /* Implementation types */
198 GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
199 GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
200
201 /************************************
202  * Initialization and exit routines *
203  ************************************/
204
205 void _gdk_windowing_window_init (void);
206 void gdk_visual_init (void);
207 void gdk_dnd_init    (void);
208
209 void _gdk_windowing_image_init  (void);
210 void gdk_image_exit  (void);
211
212 void gdk_input_init  (void);
213 void gdk_input_exit  (void);
214
215 void gdk_windowing_exit (void);
216
217 #ifdef __cplusplus
218 }
219 #endif /* __cplusplus */
220
221 #endif /* __GDK_INTERNALS_H__ */