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/gdkcursor.h>
54 #include <gdk/gdkevents.h>
55 #include <gdk/gdkfont.h>
56 #include <gdk/gdkgc.h>
57 #include <gdk/gdkim.h>
58 #include <gdk/gdkimage.h>
59 #include <gdk/gdkregion.h>
60 #include <gdk/gdkvisual.h>
61 #include <gdk/gdkwindow.h>
63 #include <gdk/gdktypes.h>
65 #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
66 #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
68 /* HFONTs clash with HWNDs, so add dithering to HFONTs... (hack) */
69 #define HFONT_DITHER 43
70 #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup ((HANDLE) ((guint) xid + HFONT_DITHER)))
74 #endif /* __cplusplus */
76 /* Define corresponding Windows types for some X11 types, just for laziness.
80 typedef PALETTEENTRY XColor;
83 typedef HCURSOR Cursor;
84 typedef guint VisualID;
88 /* Define some of the X11 constants also here, again just for laziness */
90 /* Generic null resource */
98 #define AlreadyGrabbed 2
100 /* For CreateColormap */
105 #define NotifyNormal 0
108 /* Some structs are somewhat useful to emulate internally, just to
109 keep the code less #ifdefed. */
111 HPALETTE palette; /* Palette handle used when drawing. */
112 guint size; /* Number of entries in the palette. */
113 gboolean stale; /* 1 if palette needs to be realized,
116 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
117 gulong sizepalette; /* SIZEPALETTE if rc_palette */
118 } ColormapStruct, *Colormap;
128 unsigned long red_max;
129 unsigned long red_mult;
130 unsigned long green_max;
131 unsigned long green_mult;
132 unsigned long blue_max;
133 unsigned long blue_mult;
134 unsigned long base_pixel;
137 typedef struct _GdkWindowPrivate GdkWindowPrivate;
138 typedef struct _GdkWindowPrivate GdkPixmapPrivate;
139 typedef struct _GdkImagePrivate GdkImagePrivate;
140 typedef struct _GdkGCPrivate GdkGCPrivate;
141 typedef struct _GdkColormapPrivate GdkColormapPrivate;
142 typedef struct _GdkColorInfo GdkColorInfo;
143 typedef struct _GdkVisualPrivate GdkVisualPrivate;
144 typedef struct _GdkFontPrivate GdkFontPrivate;
145 typedef struct _GdkCursorPrivate GdkCursorPrivate;
146 typedef struct _GdkEventFilter GdkEventFilter;
147 typedef struct _GdkClientFilter GdkClientFilter;
148 typedef struct _GdkRegionPrivate GdkRegionPrivate;
151 struct _GdkWindowPrivate
165 guint guffaw_gravity : 1;
167 /* We must keep the event mask here to filter them ourselves */
170 /* Values for bg_type */
171 #define GDK_WIN32_BG_NORMAL 0
172 #define GDK_WIN32_BG_PIXEL 1
173 #define GDK_WIN32_BG_PIXMAP 2
174 #define GDK_WIN32_BG_PARENT_RELATIVE 3
175 #define GDK_WIN32_BG_TRANSPARENT 4
177 /* We draw the background ourselves at WM_ERASEBKGND */
180 GdkPixmap *bg_pixmap;
184 /* Window size hints */
187 gint hint_min_width, hint_min_height;
188 gint hint_max_width, hint_max_height;
190 gint extension_events;
191 gboolean extension_events_selected;
194 GdkColormap *colormap;
198 struct _GdkImagePrivate
204 void (*image_put) (GdkDrawable *window,
219 /* A Windows Device Context (DC) is not equivalent to an X11
220 * GC. We can use a DC only in the window for which it was
221 * allocated, or (in the case of a memory DC) with the bitmap that
222 * has been selected into it. Thus, we have to release and
223 * reallocate a DC each time the GdkGC is used to paint into a new
224 * window or pixmap. We thus keep all the necessary values in the
225 * GdkGCPrivate struct.
227 GdkGCValuesMask values_mask;
236 GdkSubwindowMode subwindow_mode;
241 gint graphics_exposures;
244 HANDLE hwnd; /* If a DC is allocated, for which window
245 or what bitmap is selected into it */
251 GDK_COLOR_WRITEABLE = 1 << 0
256 GdkColorInfoFlags flags;
260 struct _GdkColormapPrivate
262 GdkColormap colormap;
269 time_t last_sync_time;
274 struct _GdkVisualPrivate
280 struct _GdkFontPrivate
283 /* XFontStruct *xfont; */
284 /* generic pointer point to XFontStruct or XFontSet */
285 /* in Win32 a HFONT */
290 struct _GdkCursorPrivate
296 struct _GdkEventFilter {
297 GdkFilterFunc function;
301 struct _GdkClientFilter {
303 GdkFilterFunc function;
309 typedef struct _GdkICPrivate GdkICPrivate;
315 GdkICAttributesType mask;
320 struct _GdkRegionPrivate
327 GDK_DEBUG_MISC = 1 << 0,
328 GDK_DEBUG_EVENTS = 1 << 1,
329 GDK_DEBUG_DND = 1 << 2,
330 GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
331 GDK_DEBUG_XIM = 1 << 4,
332 GDK_DEBUG_SELECTION = 1 << 5
335 void gdk_events_init (void);
336 void gdk_window_init (void);
337 void gdk_visual_init (void);
338 void gdk_selection_init (void);
339 void gdk_dnd_init (void);
340 void gdk_dnd_exit (void);
341 void gdk_image_init (void);
342 void gdk_image_exit (void);
344 GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
345 GdkVisual* gdk_visual_lookup (Visual *xvisual);
347 void gdk_window_add_colormap_windows (GdkWindow *window);
348 void gdk_window_destroy_notify (GdkWindow *window);
350 void gdk_xid_table_insert (XID *xid,
352 void gdk_xid_table_remove (XID xid);
353 gpointer gdk_xid_table_lookup (XID xid);
355 /* Internal functions */
357 HDC gdk_gc_predraw (GdkWindowPrivate *window_private,
358 GdkGCPrivate *gc_private);
359 void gdk_gc_postdraw (GdkWindowPrivate *window_private,
360 GdkGCPrivate *gc_private);
361 HRGN BitmapToRegion (HBITMAP hBmp);
363 void gdk_sel_prop_store (GdkWindow *owner,
369 void gdk_event_queue_append (GdkEvent *event);
371 /* Please see gdkwindow.c for comments on how to use */
372 HWND gdk_window_xid_at(HWND base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
373 HWND gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
375 extern gint gdk_debug_level;
376 extern gint gdk_show_events;
377 extern gint gdk_stack_trace;
378 extern gchar *gdk_display_name;
379 extern HWND gdk_root_window;
380 extern HWND gdk_leader_window;
381 GDKVAR GdkWindowPrivate gdk_root_parent;
382 GDKVAR Atom gdk_selection_property;
383 extern GdkWindow *selection_owner[];
384 GDKVAR gchar *gdk_progclass;
385 GDKVAR gint gdk_error_code;
386 GDKVAR gint gdk_error_warnings;
387 GDKVAR gint gdk_null_window_warnings;
388 extern GList *gdk_default_filters;
389 extern gint gdk_event_func_from_window_proc;
393 gint gdk_im_open (void);
394 void gdk_im_close (void);
395 void gdk_ic_cleanup (void);
397 extern GdkICPrivate *gdk_xim_ic; /* currently using IC */
398 extern GdkWindow *gdk_xim_window; /* currently using Window */
402 extern HINSTANCE gdk_DLLInstance;
403 extern HINSTANCE gdk_ProgInstance;
405 extern UINT gdk_selection_notify_msg;
406 extern UINT gdk_selection_request_msg;
407 extern UINT gdk_selection_clear_msg;
408 extern GdkAtom gdk_clipboard_atom;
409 extern GdkAtom gdk_win32_dropfiles_atom;
410 extern GdkAtom gdk_ole2_dnd_atom;
412 extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
414 /* Debugging support */
416 #ifdef G_ENABLE_DEBUG
418 #define GDK_NOTE(type,action) G_STMT_START { \
419 if (gdk_debug_flags & GDK_DEBUG_##type) \
420 { action; }; } G_STMT_END
422 #else /* !G_ENABLE_DEBUG */
424 #define GDK_NOTE(type,action)
426 #endif /* G_ENABLE_DEBUG */
428 GDKVAR guint gdk_debug_flags;
430 /* Internal functions for debug output etc. */
432 char *gdk_color_to_string (GdkColor *);
436 #endif /* __cplusplus */
439 #endif /* __GDK_PRIVATE_H__ */