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 */
33 /* Make up for some minor mingw32 lossage */
35 /* PS_JOIN_MASK is missing from the mingw32 headers */
37 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
40 /* CLR_INVALID is missing */
42 #define CLR_INVALID CLR_NONE
45 /* MB_CUR_MAX is missing */
47 extern int *__imp___mb_cur_max;
48 #define MB_CUR_MAX (*__imp___mb_cur_max)
52 #include <gdk/gdktypes.h>
54 /* Define corresponding Windows types for some X11 types, just for laziness.
60 typedef PALETTEENTRY XColor;
63 typedef HCURSOR Cursor;
64 typedef guint VisualID;
68 /* Define some of the X11 constants also here, again just for laziness */
70 /* Generic null resource */
78 #define AlreadyGrabbed 2
80 /* For CreateColormap */
85 #define NotifyNormal 0
88 /* Some structs are somewhat useful to emulate internally, just to
89 keep the code less #ifdefed. */
91 HPALETTE palette; /* Palette handle used when drawing. */
92 guint size; /* Number of entries in the palette. */
93 gboolean stale; /* 1 if palette needs to be realized,
96 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
97 gulong sizepalette; /* SIZEPALETTE if rc_palette */
98 } ColormapStruct, *Colormap;
108 unsigned long red_max;
109 unsigned long red_mult;
110 unsigned long green_max;
111 unsigned long green_mult;
112 unsigned long blue_max;
113 unsigned long blue_mult;
114 unsigned long base_pixel;
117 extern LRESULT CALLBACK
118 gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
120 #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
121 #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
123 /* HFONTs clash with HWNDs, so add dithering to HFONTs... (hack) */
124 #define HFONT_DITHER 43
125 #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup ((HANDLE) ((guint) xid + HFONT_DITHER)))
129 #endif /* __cplusplus */
132 typedef struct _GdkWindowPrivate GdkWindowPrivate;
133 typedef struct _GdkWindowPrivate GdkPixmapPrivate;
134 typedef struct _GdkImagePrivate GdkImagePrivate;
135 typedef struct _GdkGCPrivate GdkGCPrivate;
136 typedef struct _GdkColormapPrivate GdkColormapPrivate;
137 typedef struct _GdkColorInfo GdkColorInfo;
138 typedef struct _GdkVisualPrivate GdkVisualPrivate;
139 typedef struct _GdkFontPrivate GdkFontPrivate;
140 typedef struct _GdkCursorPrivate GdkCursorPrivate;
141 typedef struct _GdkEventFilter GdkEventFilter;
142 typedef struct _GdkClientFilter GdkClientFilter;
143 typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
144 typedef struct _GdkRegionPrivate GdkRegionPrivate;
147 struct _GdkWindowPrivate
161 guint guffaw_gravity : 1;
163 /* We must keep the event mask here to filter them ourselves */
166 /* Values for bg_type */
167 #define GDK_WIN32_BG_NORMAL 0
168 #define GDK_WIN32_BG_PIXEL 1
169 #define GDK_WIN32_BG_PIXMAP 2
170 #define GDK_WIN32_BG_PARENT_RELATIVE 3
171 #define GDK_WIN32_BG_TRANSPARENT 4
173 /* We draw the background ourselves at WM_ERASEBKGND */
176 GdkPixmap *bg_pixmap;
180 /* Window size hints */
183 gint hint_min_width, hint_min_height;
184 gint hint_max_width, hint_max_height;
186 gint extension_events;
187 gboolean extension_events_selected;
190 GdkColormap *colormap;
194 struct _GdkImagePrivate
200 void (*image_put) (GdkDrawable *window,
215 /* A Windows Device Context (DC) is not equivalent to an X11
216 * GC. We can use a DC only in the window for which it was
217 * allocated, or (in the case of a memory DC) with the bitmap that
218 * has been selected into it. Thus, we have to release and
219 * reallocate a DC each time the GdkGC is used to paint into a new
220 * window or pixmap. We thus keep all the necessary values in the
221 * GdkGCPrivate struct.
223 GdkGCValuesMask values_mask;
232 GdkSubwindowMode subwindow_mode;
237 gint graphics_exposures;
240 HANDLE hwnd; /* If a DC is allocated, for which window
241 or what bitmap is selected into it */
247 GDK_COLOR_WRITEABLE = 1 << 0
252 GdkColorInfoFlags flags;
256 struct _GdkColormapPrivate
258 GdkColormap colormap;
265 time_t last_sync_time;
270 struct _GdkVisualPrivate
276 struct _GdkFontPrivate
279 /* XFontStruct *xfont; */
280 /* generic pointer point to XFontStruct or XFontSet */
281 /* in Win32 a HFONT */
286 struct _GdkCursorPrivate
292 struct _GdkEventFilter {
293 GdkFilterFunc function;
297 struct _GdkClientFilter {
299 GdkFilterFunc function;
305 typedef struct _GdkICPrivate GdkICPrivate;
311 GdkICAttributesType mask;
316 struct _GdkColorContextPrivate
318 GdkColorContext color_context;
319 XStandardColormap std_cmap;
322 struct _GdkRegionPrivate
329 GDK_DEBUG_MISC = 1 << 0,
330 GDK_DEBUG_EVENTS = 1 << 1,
331 GDK_DEBUG_DND = 1 << 2,
332 GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
333 GDK_DEBUG_XIM = 1 << 4,
334 GDK_DEBUG_SELECTION = 1 << 5
337 void gdk_events_init (void);
338 void gdk_window_init (void);
339 void gdk_visual_init (void);
340 void gdk_selection_init (void);
341 void gdk_dnd_init (void);
342 void gdk_dnd_exit (void);
343 void gdk_image_init (void);
344 void gdk_image_exit (void);
346 GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
347 GdkVisual* gdk_visual_lookup (Visual *xvisual);
349 void gdk_window_add_colormap_windows (GdkWindow *window);
350 void gdk_window_destroy_notify (GdkWindow *window);
352 void gdk_xid_table_insert (XID *xid,
354 void gdk_xid_table_remove (XID xid);
355 gpointer gdk_xid_table_lookup (XID xid);
357 /* Internal functions */
359 HDC gdk_gc_predraw (GdkWindowPrivate *window_private,
360 GdkGCPrivate *gc_private);
361 void gdk_gc_postdraw (GdkWindowPrivate *window_private,
362 GdkGCPrivate *gc_private);
363 HRGN BitmapToRegion (HBITMAP hBmp);
365 void gdk_sel_prop_store (GdkWindow *owner,
371 void gdk_event_queue_append (GdkEvent *event);
373 /* Please see gdkwindow.c for comments on how to use */
374 HWND gdk_window_xid_at(HWND base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
375 HWND gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
377 extern gint gdk_debug_level;
378 extern gint gdk_show_events;
379 extern gint gdk_stack_trace;
380 extern gchar *gdk_display_name;
381 extern HWND gdk_root_window;
382 extern HWND gdk_leader_window;
383 GDKVAR GdkWindowPrivate gdk_root_parent;
384 GDKVAR Atom gdk_selection_property;
385 extern GdkWindow *selection_owner[];
386 GDKVAR gchar *gdk_progclass;
387 GDKVAR gint gdk_error_code;
388 GDKVAR gint gdk_error_warnings;
389 GDKVAR gint gdk_null_window_warnings;
390 extern GList *gdk_default_filters;
394 gint gdk_im_open (void);
395 void gdk_im_close (void);
396 void gdk_ic_cleanup (void);
398 extern GdkICPrivate *gdk_xim_ic; /* currently using IC */
399 extern GdkWindow *gdk_xim_window; /* currently using Window */
403 extern HINSTANCE gdk_DLLInstance;
404 extern HINSTANCE gdk_ProgInstance;
406 extern UINT gdk_selection_notify_msg;
407 extern UINT gdk_selection_request_msg;
408 extern UINT gdk_selection_clear_msg;
409 extern GdkAtom gdk_clipboard_atom;
410 extern GdkAtom gdk_win32_dropfiles_atom;
411 extern GdkAtom gdk_ole2_dnd_atom;
413 /* Debugging support */
415 #ifdef G_ENABLE_DEBUG
417 #define GDK_NOTE(type,action) G_STMT_START { \
418 if (gdk_debug_flags & GDK_DEBUG_##type) \
419 { action; }; } G_STMT_END
421 #else /* !G_ENABLE_DEBUG */
423 #define GDK_NOTE(type,action)
425 #endif /* G_ENABLE_DEBUG */
427 GDKVAR guint gdk_debug_flags;
429 /* Internal functions for debug output etc. */
431 char *gdk_color_to_string (GdkColor *);
435 #endif /* __cplusplus */
438 #endif /* __GDK_PRIVATE_H__ */