gdkprivate.h 7.01 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1
2
3
4
5
6
7
8
9
10
/* GDK - The GIMP Drawing Kit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
Elliot Lee's avatar
Elliot Lee committed
12
13
14
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
15
16
17
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
Elliot Lee's avatar
Elliot Lee committed
18
 */
19
20
21
22
23
24
25
26

/*
 * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
 */

Elliot Lee's avatar
Elliot Lee committed
27
28
29
30
#ifndef __GDK_PRIVATE_H__
#define __GDK_PRIVATE_H__

#include <gdk/gdktypes.h>
Owen Taylor's avatar
Started    
Owen Taylor committed
31
32
33
34
35
36
37
38
39
#include <gdk/gdkevents.h>
#include <gdk/gdkfont.h>
#include <gdk/gdkgc.h>
#include <gdk/gdkim.h>
#include <gdk/gdkimage.h>
#include <gdk/gdkregion.h>
#include <gdk/gdkvisual.h>
#include <gdk/gdkwindow.h>

Elliot Lee's avatar
Elliot Lee committed
40
41
42
43
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

44
45
46
47
48
#define GDK_DRAWABLE_TYPE(d) (((GdkDrawablePrivate *)d)->window_type)
#define GDK_IS_WINDOW(d) (GDK_DRAWABLE_TYPE(d) <= GDK_WINDOW_TEMP || \
                          GDK_DRAWABLE_TYPE(d) == GDK_WINDOW_FOREIGN)
#define GDK_IS_PIXMAP(d) (GDK_DRAWABLE_TYPE(d) == GDK_DRAWABLE_PIXMAP)
#define GDK_DRAWABLE_DESTROYED(d) (((GdkDrawablePrivate *)d)->destroyed)
Elliot Lee's avatar
Elliot Lee committed
49

50
51
52
53
54
55
#define gdk_window_lookup(xid)	   ((GdkWindow*) gdk_xid_table_lookup (xid))
#define gdk_pixmap_lookup(xid)	   ((GdkPixmap*) gdk_xid_table_lookup (xid))
#define gdk_font_lookup(xid)	   ((GdkFont*) gdk_xid_table_lookup (xid))

typedef struct _GdkDrawablePrivate     GdkDrawablePrivate;
/* typedef struct _GdkDrawablePrivate     GdkPixmapPrivate; */
56
typedef struct _GdkWindowPrivate       GdkWindowPrivate;
57
typedef struct _GdkImageClass	       GdkImageClass;
58
59
typedef struct _GdkImagePrivate	       GdkImagePrivate;
typedef struct _GdkGCPrivate	       GdkGCPrivate;
60
typedef struct _GdkColormapPrivate     GdkColormapPrivate;
61
typedef struct _GdkColorInfo           GdkColorInfo;
62
63
typedef struct _GdkFontPrivate	       GdkFontPrivate;
typedef struct _GdkEventFilter	       GdkEventFilter;
64
typedef struct _GdkClientFilter	       GdkClientFilter;
Elliot Lee's avatar
Elliot Lee committed
65

66
67
68
struct _GdkDrawablePrivate
{
  GdkDrawable drawable;
69
70
  GdkDrawableClass *klass;
  gpointer klass_data;
71
72
73
74
75
76
77
78
79
80
81

  guint8 window_type;
  guint ref_count;

  guint16 width;
  guint16 height;

  GdkColormap *colormap;

  guint destroyed : 2;
};
Elliot Lee's avatar
Elliot Lee committed
82
83
84

struct _GdkWindowPrivate
{
85
86
  GdkDrawablePrivate drawable;
  
Elliot Lee's avatar
Elliot Lee committed
87
88
89
90
  GdkWindow *parent;
  gint16 x;
  gint16 y;
  guint8 resize_count;
91
  guint mapped : 1;
92
  guint guffaw_gravity : 1;
Elliot Lee's avatar
Elliot Lee committed
93
94

  gint extension_events;
95
96

  GList *filters;
rhlabs's avatar
rhlabs committed
97
  GList *children;
Elliot Lee's avatar
Elliot Lee committed
98
99
};

100
struct _GdkImageClass 
Elliot Lee's avatar
Elliot Lee committed
101
{
102
103
104
  void (*destroy)   (GdkImage    *image);
  void (*image_put) (GdkImage	 *image,
		     GdkDrawable *window,
105
106
107
108
109
110
111
		     GdkGC	 *gc,
		     gint	  xsrc,
		     gint	  ysrc,
		     gint	  xdest,
		     gint	  ydest,
		     gint	  width,
		     gint	  height);
Elliot Lee's avatar
Elliot Lee committed
112
113
};

114
115
116
117
118
119
120
121
122
123
124
125
126
127
struct _GdkImagePrivate
{
  GdkImage image;

  guint ref_count;
  GdkImageClass *klass;
};

struct _GdkFontPrivate
{
  GdkFont font;
  guint ref_count;
};

Elliot Lee's avatar
Elliot Lee committed
128
129
struct _GdkGCPrivate
{
130
  guint ref_count;
131
132
  GdkGCClass *klass;
  gpointer klass_data;
Elliot Lee's avatar
Elliot Lee committed
133
134
};

135
136
137
138
139
140
141
142
143
144
typedef enum {
  GDK_COLOR_WRITEABLE = 1 << 0
} GdkColorInfoFlags;

struct _GdkColorInfo
{
  GdkColorInfoFlags flags;
  guint ref_count;
};

Elliot Lee's avatar
Elliot Lee committed
145
146
147
148
struct _GdkColormapPrivate
{
  GdkColormap colormap;
  GdkVisual *visual;
149

150
  guint ref_count;
Elliot Lee's avatar
Elliot Lee committed
151
152
};

153
154
155
156
struct _GdkEventFilter {
  GdkFilterFunc function;
  gpointer data;
};
157

158
159
160
161
162
163
struct _GdkClientFilter {
  GdkAtom       type;
  GdkFilterFunc function;
  gpointer      data;
};

164
165
166
167
168
169
170
171
172
typedef enum 
{
  GDK_ARG_STRING,
  GDK_ARG_INT,
  GDK_ARG_BOOL,
  GDK_ARG_NOBOOL,
  GDK_ARG_CALLBACK
} GdkArgType;

173

174
175
typedef struct _GdkArgContext GdkArgContext;
typedef struct _GdkArgDesc GdkArgDesc;
176

177
178
179
typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);

struct _GdkArgContext
180
{
181
182
  GPtrArray *tables;
  gpointer cb_data;
183
};
184

185
struct _GdkArgDesc
186
{
187
188
189
190
  const char *name;
  GdkArgType type;
  gpointer location;
  GdkArgFunc callback;
191
192
};

193

194
typedef enum {
195
196
197
198
199
200
  GDK_DEBUG_MISC          = 1 << 0,
  GDK_DEBUG_EVENTS        = 1 << 1,
  GDK_DEBUG_DND           = 1 << 2,
  GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
  GDK_DEBUG_XIM           = 1 << 4
} GdkDebugFlag;
201

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
void gdk_event_button_generate (GdkEvent *event);

/* FIFO's for event queue, and for events put back using
 * gdk_event_put().
 */
extern GList *gdk_queued_events;
extern GList *gdk_queued_tail;

extern GdkEventFunc   gdk_event_func;    /* Callback for events */
extern gpointer       gdk_event_data;
extern GDestroyNotify gdk_event_notify;

GdkEvent* gdk_event_new (void);

void      gdk_events_init   (void);
void      gdk_events_queue  (void);
GdkEvent* gdk_event_unqueue (void);

GList* gdk_event_queue_find_first  (void);
void   gdk_event_queue_remove_link (GList    *node);
void   gdk_event_queue_append      (GdkEvent *event);

Elliot Lee's avatar
Elliot Lee committed
224
225
void gdk_window_init (void);
void gdk_visual_init (void);
226
void gdk_dnd_init    (void);
Elliot Lee's avatar
Elliot Lee committed
227
228

void gdk_image_init  (void);
229
void gdk_image_exit  (void);
Elliot Lee's avatar
Elliot Lee committed
230

231
232
233
234
void gdk_input_init  (void);
void gdk_input_exit  (void);

void gdk_windowing_exit (void);
Elliot Lee's avatar
Elliot Lee committed
235
236

void gdk_window_add_colormap_windows (GdkWindow *window);
237
void gdk_window_destroy_notify	     (GdkWindow *window);
Elliot Lee's avatar
Elliot Lee committed
238

239
240
241
242
243
244
245
246
247
248
/* If you pass x = y = -1, it queries the pointer
   to find out where it currently is.
   If you pass x = y = -2, it does anything necessary
   to know that the drag is ending.
*/
void gdk_dnd_display_drag_cursor(gint x,
				 gint y,
				 gboolean drag_ok,
				 gboolean change_made);

249
extern gint		 gdk_debug_level;
250
extern gboolean		 gdk_show_events;
251
extern gint		 gdk_screen;
252
GDKVAR GdkWindow  	*gdk_parent_root;
253
254
GDKVAR gint		 gdk_error_code;
GDKVAR gint		 gdk_error_warnings;
255
extern GList            *gdk_default_filters;
256

257
258
259
260
261
262
263
264
265
266
267
268
GdkWindow* _gdk_window_alloc (void);

/* Font/string functions implemented in module-specific code */
gint _gdk_font_strlen (GdkFont *font, const char *str);
void _gdk_font_destroy (GdkFont *font);

void _gdk_colormap_real_destroy (GdkColormap *colormap);

/* Initialization */

extern GdkArgDesc _gdk_windowing_args[];
gboolean _gdk_windowing_init_check (int argc, char **argv);
Owen Taylor's avatar
Owen Taylor committed
269

270
271
272
273
274
#ifdef USE_XIM
/* XIM support */
gint   gdk_im_open		 (void);
void   gdk_im_close		 (void);
void   gdk_ic_cleanup		 (void);
275
#endif /* USE_XIM */
276

277
278
279
280
/* Debugging support */

#ifdef G_ENABLE_DEBUG

281
282
283
#define GDK_NOTE(type,action)		     G_STMT_START { \
    if (gdk_debug_flags & GDK_DEBUG_##type)		    \
       { action; };			     } G_STMT_END
284
285
286
287
288
289
290

#else /* !G_ENABLE_DEBUG */

#define GDK_NOTE(type,action)
      
#endif /* G_ENABLE_DEBUG */

291
GDKVAR guint gdk_debug_flags;
292

Elliot Lee's avatar
Elliot Lee committed
293
294
295
296
297
298
299

#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __GDK_PRIVATE_H__ */