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)
53 #include <gdk/gdktypes.h>
55 #include <gdk/gdkcursor.h>
56 #include <gdk/gdkevents.h>
57 #include <gdk/gdkfont.h>
58 #include <gdk/gdkgc.h>
59 #include <gdk/gdkim.h>
60 #include <gdk/gdkimage.h>
61 #include <gdk/gdkregion.h>
62 #include <gdk/gdkvisual.h>
63 #include <gdk/gdkwindow.h>
65 #define GDK_DRAWABLE_TYPE(d) (((GdkDrawablePrivate *)d)->window_type)
66 #define GDK_IS_WINDOW(d) (GDK_DRAWABLE_TYPE(d) <= GDK_WINDOW_TEMP || \
67 GDK_DRAWABLE_TYPE(d) == GDK_WINDOW_FOREIGN)
68 #define GDK_IS_PIXMAP(d) (GDK_DRAWABLE_TYPE(d) == GDK_DRAWABLE_PIXMAP)
69 #define GDK_DRAWABLE_DESTROYED(d) (((GdkDrawablePrivate *)d)->destroyed)
71 #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
72 #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
74 /* HFONTs clash with HWNDs, so add dithering to HFONTs... (hack) */
75 #define HFONT_DITHER 43
76 #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup ((HANDLE) ((guint) xid + HFONT_DITHER)))
80 #endif /* __cplusplus */
82 /* Define corresponding Windows types for some X11 types, just for laziness.
86 typedef PALETTEENTRY XColor;
89 typedef HCURSOR Cursor;
90 typedef guint VisualID;
94 /* Define some of the X11 constants also here, again just for laziness */
96 /* Generic null resource */
102 /* Grabbing status */
103 #define GrabSuccess 0
104 #define AlreadyGrabbed 2
106 /* For CreateColormap */
111 #define NotifyNormal 0
114 /* Some structs are somewhat useful to emulate internally, just to
115 keep the code less #ifdefed. */
117 HPALETTE palette; /* Palette handle used when drawing. */
118 guint size; /* Number of entries in the palette. */
119 gboolean stale; /* 1 if palette needs to be realized,
122 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
123 gulong sizepalette; /* SIZEPALETTE if rc_palette */
124 } ColormapStruct, *Colormap;
134 unsigned long red_max;
135 unsigned long red_mult;
136 unsigned long green_max;
137 unsigned long green_mult;
138 unsigned long blue_max;
139 unsigned long blue_mult;
140 unsigned long base_pixel;
143 typedef struct _GdkDrawablePrivate GdkDrawablePrivate;
144 /* typedef struct _GdkDrawablePrivate GdkPixmapPrivate; */
145 typedef struct _GdkWindowPrivate GdkWindowPrivate;
146 typedef struct _GdkImagePrivate GdkImagePrivate;
147 typedef struct _GdkGCPrivate GdkGCPrivate;
148 typedef struct _GdkColormapPrivate GdkColormapPrivate;
149 typedef struct _GdkColorInfo GdkColorInfo;
150 typedef struct _GdkVisualPrivate GdkVisualPrivate;
151 typedef struct _GdkFontPrivate GdkFontPrivate;
152 typedef struct _GdkCursorPrivate GdkCursorPrivate;
153 typedef struct _GdkEventFilter GdkEventFilter;
154 typedef struct _GdkClientFilter GdkClientFilter;
155 typedef struct _GdkRegionPrivate GdkRegionPrivate;
157 struct _GdkDrawablePrivate
159 GdkDrawable drawable;
168 GdkColormap *colormap;
173 struct _GdkWindowPrivate
175 GdkDrawablePrivate drawable;
182 guint guffaw_gravity : 1;
184 /* We must keep the event mask here to filter them ourselves */
187 /* Values for bg_type */
188 #define GDK_WIN32_BG_NORMAL 0
189 #define GDK_WIN32_BG_PIXEL 1
190 #define GDK_WIN32_BG_PIXMAP 2
191 #define GDK_WIN32_BG_PARENT_RELATIVE 3
192 #define GDK_WIN32_BG_TRANSPARENT 4
194 /* We draw the background ourselves at WM_ERASEBKGND */
197 GdkPixmap *bg_pixmap;
201 /* Window size hints */
204 gint hint_min_width, hint_min_height;
205 gint hint_max_width, hint_max_height;
207 gint extension_events;
208 gboolean extension_events_selected;
214 struct _GdkImagePrivate
220 void (*image_put) (GdkDrawable *window,
235 /* A Windows Device Context (DC) is not equivalent to an X11
236 * GC. We can use a DC only in the window for which it was
237 * allocated, or (in the case of a memory DC) with the bitmap that
238 * has been selected into it. Thus, we have to release and
239 * reallocate a DC each time the GdkGC is used to paint into a new
240 * window or pixmap. We thus keep all the necessary values in the
241 * GdkGCPrivate struct.
243 GdkGCValuesMask values_mask;
252 GdkSubwindowMode subwindow_mode;
257 gint graphics_exposures;
260 HANDLE hwnd; /* If a DC is allocated, for which window
261 or what bitmap is selected into it */
267 GDK_COLOR_WRITEABLE = 1 << 0
272 GdkColorInfoFlags flags;
276 struct _GdkColormapPrivate
278 GdkColormap colormap;
285 time_t last_sync_time;
290 struct _GdkVisualPrivate
296 struct _GdkFontPrivate
299 /* XFontStruct *xfont; */
300 /* generic pointer point to XFontStruct or XFontSet */
301 /* in Win32 a HFONT */
306 struct _GdkCursorPrivate
312 struct _GdkEventFilter {
313 GdkFilterFunc function;
317 struct _GdkClientFilter {
319 GdkFilterFunc function;
323 struct _GdkRegionPrivate
330 GDK_DEBUG_MISC = 1 << 0,
331 GDK_DEBUG_EVENTS = 1 << 1,
332 GDK_DEBUG_DND = 1 << 2,
333 GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
334 GDK_DEBUG_XIM = 1 << 4,
335 GDK_DEBUG_SELECTION = 1 << 5
338 void gdk_events_init (void);
339 void gdk_window_init (void);
340 void gdk_visual_init (void);
341 void gdk_selection_init (void);
342 void gdk_dnd_init (void);
343 void gdk_dnd_exit (void);
344 void gdk_image_init (void);
345 void gdk_image_exit (void);
347 GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
348 GdkVisual* gdk_visual_lookup (Visual *xvisual);
350 void gdk_window_add_colormap_windows (GdkWindow *window);
351 void gdk_window_destroy_notify (GdkWindow *window);
353 void gdk_xid_table_insert (XID *xid,
355 void gdk_xid_table_remove (XID xid);
356 gpointer gdk_xid_table_lookup (XID xid);
358 /* Internal functions */
360 HDC gdk_gc_predraw (GdkDrawablePrivate *drawable_private,
361 GdkGCPrivate *gc_private);
362 void gdk_gc_postdraw (GdkDrawablePrivate *drawable_private,
363 GdkGCPrivate *gc_private);
364 HRGN BitmapToRegion (HBITMAP hBmp);
366 void gdk_sel_prop_store (GdkWindow *owner,
372 void gdk_event_queue_append (GdkEvent *event);
374 /* Please see gdkwindow.c for comments on how to use */
375 HWND gdk_window_xid_at(HWND base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
376 HWND gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
378 extern gint gdk_debug_level;
379 extern gint gdk_show_events;
380 extern gint gdk_stack_trace;
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;
391 extern gint gdk_event_func_from_window_proc;
394 extern HINSTANCE gdk_DLLInstance;
395 extern HINSTANCE gdk_ProgInstance;
397 extern UINT gdk_selection_notify_msg;
398 extern UINT gdk_selection_request_msg;
399 extern UINT gdk_selection_clear_msg;
400 extern GdkAtom gdk_clipboard_atom;
401 extern GdkAtom gdk_win32_dropfiles_atom;
402 extern GdkAtom gdk_ole2_dnd_atom;
404 extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
406 /* Debugging support */
408 #ifdef G_ENABLE_DEBUG
410 #define GDK_NOTE(type,action) G_STMT_START { \
411 if (gdk_debug_flags & GDK_DEBUG_##type) \
412 { action; }; } G_STMT_END
414 #else /* !G_ENABLE_DEBUG */
416 #define GDK_NOTE(type,action)
418 #endif /* G_ENABLE_DEBUG */
420 GDKVAR guint gdk_debug_flags;
422 /* Internal functions for debug output etc. */
424 char *gdk_color_to_string (GdkColor *);
428 #endif /* __cplusplus */
431 #endif /* __GDK_PRIVATE_H__ */