1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
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/.
27 #ifndef __GDK_PRIVATE_H__
28 #define __GDK_PRIVATE_H__
30 #define STRICT /* We want strict type checks */
34 #include <gdk/gdktypes.h>
36 /* Define corresponding Windows types for some X11 types, just for laziness.
42 typedef PALETTEENTRY XColor;
45 typedef HCURSOR Cursor;
46 typedef guint VisualID;
50 /* Define some of the X11 constants also here, again just for laziness */
52 /* Generic null resource */
60 #define AlreadyGrabbed 2
62 /* For CreateColormap */
67 #define NotifyNormal 0
70 /* Some structs are somewhat useful to emulate internally, just to
71 keep the code less #ifdefed. */
73 HPALETTE palette; /* Palette handle used when drawing. */
74 guint size; /* Number of entries in the palette. */
75 gboolean stale; /* 1 if palette needs to be realized,
78 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
79 gulong sizepalette; /* SIZEPALETTE if rc_palette */
80 } ColormapStruct, *Colormap;
90 unsigned long red_max;
91 unsigned long red_mult;
92 unsigned long green_max;
93 unsigned long green_mult;
94 unsigned long blue_max;
95 unsigned long blue_mult;
96 unsigned long base_pixel;
99 extern LRESULT CALLBACK
100 gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
102 #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
103 #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
105 /* HFONTs clash with HWNDs, so add dithering to HFONTs... (hack) */
106 #define HFONT_DITHER 43
107 #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup ((HANDLE) ((guint) xid + HFONT_DITHER)))
111 #endif /* __cplusplus */
114 typedef struct _GdkWindowPrivate GdkWindowPrivate;
115 typedef struct _GdkWindowPrivate GdkPixmapPrivate;
116 typedef struct _GdkImagePrivate GdkImagePrivate;
117 typedef struct _GdkGCPrivate GdkGCPrivate;
118 typedef struct _GdkColormapPrivate GdkColormapPrivate;
119 typedef struct _GdkColorInfo GdkColorInfo;
120 typedef struct _GdkVisualPrivate GdkVisualPrivate;
121 typedef struct _GdkFontPrivate GdkFontPrivate;
122 typedef struct _GdkCursorPrivate GdkCursorPrivate;
123 typedef struct _GdkEventFilter GdkEventFilter;
124 typedef struct _GdkClientFilter GdkClientFilter;
125 typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
126 typedef struct _GdkRegionPrivate GdkRegionPrivate;
129 struct _GdkWindowPrivate
143 guint guffaw_gravity : 1;
145 /* We must keep the event mask here to filter them ourselves */
148 /* Values for bg_type */
149 #define GDK_WIN32_BG_NORMAL 0
150 #define GDK_WIN32_BG_PIXEL 1
151 #define GDK_WIN32_BG_PIXMAP 2
152 #define GDK_WIN32_BG_PARENT_RELATIVE 3
153 #define GDK_WIN32_BG_TRANSPARENT 4
155 /* We draw the background ourselves at WM_ERASEBKGND */
158 GdkPixmap *bg_pixmap;
162 /* Window size hints */
165 gint hint_min_width, hint_min_height;
166 gint hint_max_width, hint_max_height;
168 gint extension_events;
169 gboolean extension_events_selected;
172 GdkColormap *colormap;
176 struct _GdkImagePrivate
182 void (*image_put) (GdkDrawable *window,
197 /* A Windows Device Context (DC) is not equivalent to an X11
198 * GC. We can use a DC only in the window for which it was
199 * allocated, or (in the case of a memory DC) with the bitmap that
200 * has been selected into it. Thus, we have to release and
201 * reallocate a DC each time the GdkGC is used to paint into a new
202 * window or pixmap. We thus keep all the necessary values in the
203 * GdkGCPrivate struct.
205 GdkGCValuesMask values_mask;
214 GdkSubwindowMode subwindow_mode;
219 gint graphics_exposures;
222 HANDLE hwnd; /* If a DC is allocated, for which window
223 or what bitmap is selected into it */
229 GDK_COLOR_WRITEABLE = 1 << 0
234 GdkColorInfoFlags flags;
238 struct _GdkColormapPrivate
240 GdkColormap colormap;
247 time_t last_sync_time;
252 struct _GdkVisualPrivate
258 struct _GdkFontPrivate
261 /* XFontStruct *xfont; */
262 /* generic pointer point to XFontStruct or XFontSet */
263 /* in Win32 a HFONT */
268 struct _GdkCursorPrivate
274 struct _GdkEventFilter {
275 GdkFilterFunc function;
279 struct _GdkClientFilter {
281 GdkFilterFunc function;
287 typedef struct _GdkICPrivate GdkICPrivate;
293 GdkICAttributesType mask;
298 struct _GdkColorContextPrivate
300 GdkColorContext color_context;
301 XStandardColormap std_cmap;
304 struct _GdkRegionPrivate
311 GDK_DEBUG_MISC = 1 << 0,
312 GDK_DEBUG_EVENTS = 1 << 1,
313 GDK_DEBUG_DND = 1 << 2,
314 GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
315 GDK_DEBUG_XIM = 1 << 4,
316 GDK_DEBUG_SELECTION = 1 << 5
319 void gdk_events_init (void);
320 void gdk_window_init (void);
321 void gdk_visual_init (void);
322 void gdk_selection_init (void);
323 void gdk_dnd_init (void);
324 void gdk_dnd_exit (void);
325 void gdk_image_init (void);
326 void gdk_image_exit (void);
328 GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
329 GdkVisual* gdk_visual_lookup (Visual *xvisual);
331 void gdk_window_add_colormap_windows (GdkWindow *window);
332 void gdk_window_destroy_notify (GdkWindow *window);
334 void gdk_xid_table_insert (XID *xid,
336 void gdk_xid_table_remove (XID xid);
337 gpointer gdk_xid_table_lookup (XID xid);
339 /* Internal functions */
341 HDC gdk_gc_predraw (GdkWindowPrivate *window_private,
342 GdkGCPrivate *gc_private);
343 void gdk_gc_postdraw (GdkWindowPrivate *window_private,
344 GdkGCPrivate *gc_private);
345 HRGN BitmapToRegion (HBITMAP hBmp);
347 void gdk_sel_prop_store (GdkWindow *owner,
353 void gdk_event_queue_append (GdkEvent *event);
355 /* Please see gdkwindow.c for comments on how to use */
356 HWND gdk_window_xid_at(HWND base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
357 HWND gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
359 extern gint gdk_debug_level;
360 extern gint gdk_show_events;
361 extern gint gdk_stack_trace;
362 extern gchar *gdk_display_name;
363 extern HWND gdk_root_window;
364 extern HWND gdk_leader_window;
365 GDKVAR GdkWindowPrivate gdk_root_parent;
366 GDKVAR Atom gdk_selection_property;
367 extern GdkWindow *selection_owner[];
368 GDKVAR gchar *gdk_progclass;
369 GDKVAR gint gdk_error_code;
370 GDKVAR gint gdk_error_warnings;
371 GDKVAR gint gdk_null_window_warnings;
372 extern GList *gdk_default_filters;
376 gint gdk_im_open (void);
377 void gdk_im_close (void);
378 void gdk_ic_cleanup (void);
380 extern GdkICPrivate *gdk_xim_ic; /* currently using IC */
381 extern GdkWindow *gdk_xim_window; /* currently using Window */
385 extern HINSTANCE gdk_DLLInstance;
386 extern HINSTANCE gdk_ProgInstance;
388 extern UINT gdk_selection_notify_msg;
389 extern UINT gdk_selection_request_msg;
390 extern UINT gdk_selection_clear_msg;
391 extern GdkAtom gdk_clipboard_atom;
392 extern GdkAtom gdk_win32_dropfiles_atom;
393 extern GdkAtom gdk_ole2_dnd_atom;
395 /* Debugging support */
397 #ifdef G_ENABLE_DEBUG
399 #define GDK_NOTE(type,action) G_STMT_START { \
400 if (gdk_debug_flags & GDK_DEBUG_##type) \
401 { action; }; } G_STMT_END
403 #else /* !G_ENABLE_DEBUG */
405 #define GDK_NOTE(type,action)
407 #endif /* G_ENABLE_DEBUG */
409 GDKVAR guint gdk_debug_flags;
411 /* Internal functions for debug output etc. */
413 char *gdk_color_to_string (GdkColor *);
417 #endif /* __cplusplus */
420 #endif /* __GDK_PRIVATE_H__ */