source: trunk/third/gtk/gdk/gdkprivate.h @ 17071

Revision 17071, 8.3 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17070, which included commits to RCS files with non-trunk default branches.
Line 
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 Library 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 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library 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-1999.  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#ifndef __GDK_PRIVATE_H__
28#define __GDK_PRIVATE_H__
29
30
31#include <X11/Xlib.h>
32#include <X11/Xutil.h>
33#include <gdk/gdktypes.h>
34
35#define gdk_window_lookup(xid)     ((GdkWindow*) gdk_xid_table_lookup (xid))
36#define gdk_pixmap_lookup(xid)     ((GdkPixmap*) gdk_xid_table_lookup (xid))
37#define gdk_font_lookup(xid)       ((GdkFont*) gdk_xid_table_lookup (xid))
38
39
40#ifdef __cplusplus
41extern "C" {
42#endif /* __cplusplus */
43
44
45typedef struct _GdkWindowPrivate       GdkWindowPrivate;
46typedef struct _GdkWindowPrivate       GdkPixmapPrivate;
47typedef struct _GdkImagePrivate        GdkImagePrivate;
48typedef struct _GdkGCPrivate           GdkGCPrivate;
49typedef struct _GdkColormapPrivate     GdkColormapPrivate;
50typedef struct _GdkColorInfo           GdkColorInfo;
51typedef struct _GdkVisualPrivate       GdkVisualPrivate;
52typedef struct _GdkFontPrivate         GdkFontPrivate;
53typedef struct _GdkCursorPrivate       GdkCursorPrivate;
54typedef struct _GdkEventFilter         GdkEventFilter;
55typedef struct _GdkClientFilter        GdkClientFilter;
56typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
57typedef struct _GdkRegionPrivate       GdkRegionPrivate;
58
59
60struct _GdkWindowPrivate
61{
62  GdkWindow window;
63  GdkWindow *parent;
64  Window xwindow;
65  Display *xdisplay;
66  gint16 x;
67  gint16 y;
68  guint16 width;
69  guint16 height;
70  guint8 resize_count;
71  guint8 window_type;
72  guint ref_count;
73  guint destroyed : 2;
74  guint mapped : 1;
75  guint guffaw_gravity : 1;
76
77  gint extension_events;
78
79  GList *filters;
80  GdkColormap *colormap;
81  GList *children;
82};
83
84struct _GdkImagePrivate
85{
86  GdkImage image;
87  XImage *ximage;
88  Display *xdisplay;
89  gpointer x_shm_info;
90
91  void (*image_put) (GdkDrawable *window,
92                     GdkGC       *gc,
93                     GdkImage    *image,
94                     gint         xsrc,
95                     gint         ysrc,
96                     gint         xdest,
97                     gint         ydest,
98                     gint         width,
99                     gint         height);
100};
101
102struct _GdkGCPrivate
103{
104  GdkGC gc;
105  GC xgc;
106  Display *xdisplay;
107  guint ref_count;
108};
109
110typedef enum {
111  GDK_COLOR_WRITEABLE = 1 << 0
112} GdkColorInfoFlags;
113
114struct _GdkColorInfo
115{
116  GdkColorInfoFlags flags;
117  guint ref_count;
118};
119
120struct _GdkColormapPrivate
121{
122  GdkColormap colormap;
123  Colormap xcolormap;
124  Display *xdisplay;
125  GdkVisual *visual;
126  gint private_val;
127
128  GHashTable *hash;
129  GdkColorInfo *info;
130  time_t last_sync_time;
131 
132  guint ref_count;
133};
134
135struct _GdkVisualPrivate
136{
137  GdkVisual visual;
138  Visual *xvisual;
139};
140
141struct _GdkFontPrivate
142{
143  GdkFont font;
144  /* XFontStruct *xfont; */
145  /* generic pointer point to XFontStruct or XFontSet */
146  gpointer xfont;
147  Display *xdisplay;
148  guint ref_count;
149
150  GSList *names;
151};
152
153struct _GdkCursorPrivate
154{
155  GdkCursor cursor;
156  Cursor xcursor;
157  Display *xdisplay;
158};
159
160struct _GdkDndCursorInfo {
161  Cursor          gdk_cursor_dragdefault, gdk_cursor_dragok;
162  GdkWindow      *drag_pm_default, *drag_pm_ok;
163  GdkPoint        default_hotspot, ok_hotspot;
164  GList *xids;
165};
166typedef struct _GdkDndCursorInfo GdkDndCursorInfo;
167
168struct _GdkDndGlobals {
169  GdkAtom            gdk_XdeEnter, gdk_XdeLeave, gdk_XdeRequest;
170  GdkAtom            gdk_XdeDataAvailable, gdk_XdeDataShow, gdk_XdeCancel;
171  GdkAtom            gdk_XdeTypelist;
172
173  GdkDndCursorInfo  *c;
174  GdkWindow     **drag_startwindows;
175  guint           drag_numwindows;
176  gboolean        drag_really, drag_perhaps, dnd_grabbed;
177  Window          dnd_drag_target;
178  GdkPoint        drag_dropcoords;
179
180  GdkPoint dnd_drag_start, dnd_drag_oldpos;
181  GdkRectangle dnd_drag_dropzone;
182  GdkWindowPrivate *real_sw;
183  Window dnd_drag_curwin;
184  Time last_drop_time; /* An incredible hack, sosumi miguel */
185};
186typedef struct _GdkDndGlobals GdkDndGlobals;
187
188struct _GdkEventFilter {
189  GdkFilterFunc function;
190  gpointer data;
191};
192
193struct _GdkClientFilter {
194  GdkAtom       type;
195  GdkFilterFunc function;
196  gpointer      data;
197};
198
199#ifdef USE_XIM
200
201typedef struct _GdkICPrivate GdkICPrivate;
202
203struct _GdkICPrivate
204{
205  XIC xic;
206  GdkICAttr *attr;
207  GdkICAttributesType mask;
208};
209
210#endif /* USE_XIM */
211
212struct _GdkColorContextPrivate
213{
214  GdkColorContext color_context;
215  Display *xdisplay;
216  XStandardColormap std_cmap;
217};
218
219struct _GdkRegionPrivate
220{
221  GdkRegion region;
222  Region xregion;
223};
224
225typedef enum {
226  GDK_DEBUG_MISC          = 1 << 0,
227  GDK_DEBUG_EVENTS        = 1 << 1,
228  GDK_DEBUG_DND           = 1 << 2,
229  GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
230  GDK_DEBUG_XIM           = 1 << 4
231} GdkDebugFlag;
232
233void gdk_events_init (void);
234void gdk_window_init (void);
235void gdk_visual_init (void);
236void gdk_dnd_init    (void);
237
238void gdk_image_init  (void);
239void gdk_image_exit (void);
240
241GdkColormap* gdk_colormap_lookup (Colormap  xcolormap);
242GdkVisual*   gdk_visual_lookup   (Visual   *xvisual);
243
244void gdk_window_add_colormap_windows (GdkWindow *window);
245void gdk_window_destroy_notify       (GdkWindow *window);
246
247void     gdk_xid_table_insert (XID      *xid,
248                               gpointer  data);
249void     gdk_xid_table_remove (XID       xid);
250gpointer gdk_xid_table_lookup (XID       xid);
251
252gint gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
253                      XEvent *event_send);
254
255/* If you pass x = y = -1, it queries the pointer
256   to find out where it currently is.
257   If you pass x = y = -2, it does anything necessary
258   to know that the drag is ending.
259*/
260void gdk_dnd_display_drag_cursor(gint x,
261                                 gint y,
262                                 gboolean drag_ok,
263                                 gboolean change_made);
264
265/* Please see gdkwindow.c for comments on how to use */
266Window gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
267Window gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
268
269extern gint              gdk_debug_level;
270extern gint              gdk_show_events;
271extern gint              gdk_use_xshm;
272extern gint              gdk_stack_trace;
273extern gchar            *gdk_display_name;
274extern Display          *gdk_display;
275extern gint              gdk_screen;
276extern Window            gdk_root_window;
277extern Window            gdk_leader_window;
278extern GdkWindowPrivate  gdk_root_parent;
279extern Atom              gdk_wm_delete_window;
280extern Atom              gdk_wm_take_focus;
281extern Atom              gdk_wm_protocols;
282extern Atom              gdk_wm_window_protocols[];
283extern Atom              gdk_selection_property;
284extern GdkDndGlobals     gdk_dnd;
285extern GdkWindow        *selection_owner[];
286extern gchar            *gdk_progclass;
287extern gint              gdk_error_code;
288extern gint              gdk_error_warnings;
289extern gint              gdk_null_window_warnings;
290extern GList            *gdk_default_filters;
291extern const int         gdk_nevent_masks;
292extern const int         gdk_event_mask_table[];
293
294extern GdkWindowPrivate *gdk_xgrab_window;  /* Window that currently holds the
295                                             * x pointer grab
296                                             */
297
298#ifdef USE_XIM
299/* XIM support */
300gint   gdk_im_open               (void);
301void   gdk_im_close              (void);
302void   gdk_ic_cleanup            (void);
303
304extern GdkICPrivate *gdk_xim_ic;                /* currently using IC */
305extern GdkWindow *gdk_xim_window;               /* currently using Window */
306#endif /* USE_XIM */
307
308/* Debugging support */
309
310#ifdef G_ENABLE_DEBUG
311
312#define GDK_NOTE(type,action)                G_STMT_START { \
313    if (gdk_debug_flags & GDK_DEBUG_##type)                 \
314       { action; };                          } G_STMT_END
315
316#else /* !G_ENABLE_DEBUG */
317
318#define GDK_NOTE(type,action)
319     
320#endif /* G_ENABLE_DEBUG */
321
322extern guint gdk_debug_flags;
323
324
325gboolean _gdk_font_wc_to_glyphs (GdkFont         *font,
326                                 const GdkWChar  *text,
327                                 gint             text_length,
328                                 gchar          **result,
329                                 gint            *result_length);
330gchar *_gdk_wcstombs_len      (const GdkWChar  *src,
331                               int              length);
332
333#ifdef __cplusplus
334}
335#endif /* __cplusplus */
336
337
338#endif /* __GDK_PRIVATE_H__ */
Note: See TracBrowser for help on using the repository browser.