]> Pileus Git - ~andy/gtk/blob - gdk/gdkprivate.h
03b02f81c7ba95aa9004bf2d6baf8be3abd4e250
[~andy/gtk] / gdk / gdkprivate.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 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 Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 #ifndef __GDK_PRIVATE_H__
19 #define __GDK_PRIVATE_H__
20
21
22 #include <X11/Xlib.h>
23 #include <X11/Xutil.h>
24 #include <gdk/gdktypes.h>
25
26 #define DND_PROTOCOL_VERSION 0
27
28 #define gdk_window_lookup(xid)     ((GdkWindow*) gdk_xid_table_lookup (xid))
29 #define gdk_pixmap_lookup(xid)     ((GdkPixmap*) gdk_xid_table_lookup (xid))
30 #define gdk_font_lookup(xid)       ((GdkFont*) gdk_xid_table_lookup (xid))
31
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36
37
38 typedef struct _GdkWindowPrivate       GdkWindowPrivate;
39 typedef struct _GdkWindowPrivate       GdkPixmapPrivate;
40 typedef struct _GdkImagePrivate        GdkImagePrivate;
41 typedef struct _GdkGCPrivate           GdkGCPrivate;
42 typedef struct _GdkColormapPrivate     GdkColormapPrivate;
43 typedef struct _GdkVisualPrivate       GdkVisualPrivate;
44 typedef struct _GdkFontPrivate         GdkFontPrivate;
45 typedef struct _GdkCursorPrivate       GdkCursorPrivate;
46 typedef struct _GdkEventFilter         GdkEventFilter;
47 typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
48
49
50 struct _GdkWindowPrivate
51 {
52   GdkWindow window;
53   GdkWindow *parent;
54   Window xwindow;
55   Display *xdisplay;
56   gint16 x;
57   gint16 y;
58   guint16 width;
59   guint16 height;
60   guint8 resize_count;
61   guint8 ref_count;
62   guint8 window_type;
63   guint destroyed : 2;
64   guint dnd_drag_enabled : 1,
65     dnd_drag_datashow : 1,
66     dnd_drag_destructive_op : 1,
67     dnd_drag_accepted : 1,
68     dnd_drop_enabled : 1,
69     dnd_drop_destructive_op : 1;
70   GdkAtom dnd_drag_data_type, *dnd_drag_data_typesavail;
71   guint dnd_drag_data_numtypesavail;
72   /* We have to turn on MotionMask/EnterWindowMask/LeaveWindowMask
73      during drags, then set it back to what it was after */
74   glong dnd_drag_savedeventmask, dnd_drag_eventmask;
75   GdkAtom *dnd_drop_data_typesavail;
76   guint dnd_drop_data_numtypesavail;
77   /* need to allow custom drag/drop cursors */
78
79   gint extension_events;
80
81   GList *filters;
82 };
83
84 struct _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
102 struct _GdkGCPrivate
103 {
104   GdkGC gc;
105   GC xgc;
106   Display *xdisplay;
107 };
108
109 struct _GdkColormapPrivate
110 {
111   GdkColormap colormap;
112   Colormap xcolormap;
113   Display *xdisplay;
114   GdkVisual *visual;
115   gint private_val;
116   gint next_color;
117   gint ref_count;
118 };
119
120 struct _GdkVisualPrivate
121 {
122   GdkVisual visual;
123   Visual *xvisual;
124 };
125
126 struct _GdkFontPrivate
127 {
128   GdkFont font;
129   /* XFontStruct *xfont; */
130   /* generic pointer point to XFontStruct or XFontSet */
131   gpointer xfont;
132   Display *xdisplay;
133   gint ref_count;
134 };
135
136 struct _GdkCursorPrivate
137 {
138   GdkCursor cursor;
139   Cursor xcursor;
140   Display *xdisplay;
141 };
142
143 struct _GdkDndGlobals {
144   GdkAtom            gdk_XdeEnter, gdk_XdeLeave, gdk_XdeRequest;
145   GdkAtom            gdk_XdeDataAvailable, gdk_XdeDataShow, gdk_XdeCancel;
146   GdkAtom            gdk_XdeTypelist;
147   Cursor          gdk_cursor_dragdefault, gdk_cursor_dragok;
148   GdkWindow     **drag_startwindows;
149   guint           drag_numwindows;
150   guint8          drag_really;
151   GdkPoint        drag_dropcoords;
152 };
153 typedef struct _GdkDndGlobals GdkDndGlobals;
154
155 struct _GdkEventFilter {
156   GdkFilterFunc function;
157   gpointer data;
158 };
159
160 #ifdef USE_XIM
161
162 struct _GdkICPrivate
163 {
164   XIC xic;
165   GdkIMStyle style;
166 };
167
168 typedef struct _GdkICPrivate GdkICPrivate;
169
170 #endif /* USE_XIM */
171
172
173 struct _GdkColorContextPrivate
174 {
175   GdkColorContext color_context;
176   Display *xdisplay;
177   XStandardColormap std_cmap;
178 };
179
180
181 void gdk_window_init (void);
182 void gdk_visual_init (void);
183
184 void gdk_image_init  (void);
185 void gdk_image_exit (void);
186
187 GdkColormap* gdk_colormap_lookup (Colormap  xcolormap);
188 GdkVisual*   gdk_visual_lookup   (Visual   *xvisual);
189
190 void gdk_window_add_colormap_windows (GdkWindow *window);
191 void gdk_window_destroy_notify       (GdkWindow *window);
192
193 void     gdk_xid_table_insert (XID      *xid,
194                                gpointer  data);
195 void     gdk_xid_table_remove (XID       xid);
196 gpointer gdk_xid_table_lookup (XID       xid);
197
198
199 extern gint              gdk_debug_level;
200 extern gint              gdk_show_events;
201 extern gint              gdk_use_xshm;
202 extern gint              gdk_stack_trace;
203 extern gchar            *gdk_display_name;
204 extern Display          *gdk_display;
205 extern gint              gdk_screen;
206 extern Window            gdk_root_window;
207 extern Window            gdk_leader_window;
208 extern GdkWindowPrivate  gdk_root_parent;
209 extern Atom              gdk_wm_delete_window;
210 extern Atom              gdk_wm_take_focus;
211 extern Atom              gdk_wm_protocols;
212 extern Atom              gdk_wm_window_protocols[];
213 extern Atom              gdk_selection_property;
214 extern GdkDndGlobals     gdk_dnd;
215 extern GdkWindow        *selection_owner[];
216 extern gchar            *gdk_progname;
217 extern gchar            *gdk_progclass;
218 extern gint              gdk_error_code;
219 extern gint              gdk_error_warnings;
220
221
222 #ifdef __cplusplus
223 }
224 #endif /* __cplusplus */
225
226
227 #endif /* __GDK_PRIVATE_H__ */