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 /* Make up for some minor mingw32 lossage */
36 /* PS_JOIN_MASK is missing from the mingw32 headers */
38 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
41 /* CLR_INVALID is missing */
43 #define CLR_INVALID CLR_NONE
46 /* Some charsets are missing */
48 #define JOHAB_CHARSET 130
50 #ifndef VIETNAMESE_CHARSET
51 #define VIETNAMESE_CHARSET 163
55 #define VK_OEM_PLUS 0xBB
60 #include <gdk/gdktypes.h>
62 #include <gdk/gdkcursor.h>
63 #include <gdk/gdkevents.h>
64 #include <gdk/gdkfont.h>
65 #include <gdk/gdkgc.h>
66 #include <gdk/gdkim.h>
67 #include <gdk/gdkimage.h>
68 #include <gdk/gdkregion.h>
69 #include <gdk/gdkvisual.h>
70 #include <gdk/gdkwindow.h>
72 #define GDK_DRAWABLE_TYPE(d) (((GdkDrawablePrivate *)d)->window_type)
73 #define GDK_IS_WINDOW(d) (GDK_DRAWABLE_TYPE(d) <= GDK_WINDOW_TEMP || \
74 GDK_DRAWABLE_TYPE(d) == GDK_WINDOW_FOREIGN)
75 #define GDK_IS_PIXMAP(d) (GDK_DRAWABLE_TYPE(d) == GDK_DRAWABLE_PIXMAP)
76 #define GDK_DRAWABLE_DESTROYED(d) (((GdkDrawablePrivate *)d)->destroyed)
78 #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
79 #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
83 #endif /* __cplusplus */
85 /* Define corresponding Windows types for some X11 types, just for laziness.
89 typedef PALETTEENTRY XColor;
92 typedef HCURSOR Cursor;
93 typedef guint VisualID;
97 /* Define some of the X11 constants also here, again just for laziness */
99 /* Generic null resource */
105 /* Grabbing status */
106 #define GrabSuccess 0
107 #define AlreadyGrabbed 2
109 /* For CreateColormap */
113 /* Some structs are somewhat useful to emulate internally, just to
114 keep the code less #ifdefed. */
116 HPALETTE palette; /* Palette handle used when drawing. */
117 guint size; /* Number of entries in the palette. */
118 gboolean stale; /* 1 if palette needs to be realized,
121 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
122 gulong sizepalette; /* SIZEPALETTE if rc_palette */
123 } ColormapStruct, *Colormap;
133 unsigned long red_max;
134 unsigned long red_mult;
135 unsigned long green_max;
136 unsigned long green_mult;
137 unsigned long blue_max;
138 unsigned long blue_mult;
139 unsigned long base_pixel;
142 typedef struct _GdkDrawablePrivate GdkDrawablePrivate;
143 /* typedef struct _GdkDrawablePrivate GdkPixmapPrivate; */
144 typedef struct _GdkWindowPrivate GdkWindowPrivate;
145 typedef struct _GdkImagePrivate GdkImagePrivate;
146 typedef struct _GdkGCPrivate GdkGCPrivate;
147 typedef struct _GdkColormapPrivate GdkColormapPrivate;
148 typedef struct _GdkColorInfo GdkColorInfo;
149 typedef struct _GdkVisualPrivate GdkVisualPrivate;
150 typedef struct _GdkFontPrivate GdkFontPrivate;
151 typedef struct _GdkCursorPrivate GdkCursorPrivate;
152 typedef struct _GdkEventFilter GdkEventFilter;
153 typedef struct _GdkClientFilter GdkClientFilter;
154 typedef struct _GdkRegionPrivate GdkRegionPrivate;
156 struct _GdkDrawablePrivate
158 GdkDrawable drawable;
167 GdkColormap *colormap;
172 struct _GdkWindowPrivate
174 GdkDrawablePrivate drawable;
181 guint guffaw_gravity : 1;
183 /* We must keep the event mask here to filter them ourselves */
186 /* Values for bg_type */
187 #define GDK_WIN32_BG_NORMAL 0
188 #define GDK_WIN32_BG_PIXEL 1
189 #define GDK_WIN32_BG_PIXMAP 2
190 #define GDK_WIN32_BG_PARENT_RELATIVE 3
191 #define GDK_WIN32_BG_TRANSPARENT 4
193 /* We draw the background ourselves at WM_ERASEBKGND */
196 GdkPixmap *bg_pixmap;
200 /* Window size hints */
203 gint hint_min_width, hint_min_height;
204 gint hint_max_width, hint_max_height;
206 gint extension_events;
207 gboolean extension_events_selected;
213 CHARSETINFO charset_info;
216 struct _GdkImagePrivate
222 void (*image_put) (GdkDrawable *window,
237 /* A Windows Device Context (DC) is not equivalent to an X11
238 * GC. We can use a DC only in the window for which it was
239 * allocated, or (in the case of a memory DC) with the bitmap that
240 * has been selected into it. Thus, we have to release and
241 * reallocate a DC each time the GdkGC is used to paint into a new
242 * window or pixmap. We thus keep all the necessary values in the
243 * GdkGCPrivate struct.
245 GdkGCValuesMask values_mask;
254 GdkSubwindowMode subwindow_mode;
259 gint graphics_exposures;
262 HANDLE hwnd; /* If a DC is allocated, for which window
263 or what bitmap is selected into it */
269 GDK_COLOR_WRITEABLE = 1 << 0
274 GdkColorInfoFlags flags;
278 struct _GdkColormapPrivate
280 GdkColormap colormap;
287 time_t last_sync_time;
292 struct _GdkVisualPrivate
305 } GdkWin32SingleFont;
307 struct _GdkFontPrivate
316 struct _GdkCursorPrivate
322 struct _GdkEventFilter {
323 GdkFilterFunc function;
327 struct _GdkClientFilter {
329 GdkFilterFunc function;
333 struct _GdkRegionPrivate
340 GDK_DEBUG_MISC = 1 << 0,
341 GDK_DEBUG_EVENTS = 1 << 1,
342 GDK_DEBUG_DND = 1 << 2,
343 GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
344 GDK_DEBUG_XIM = 1 << 4,
345 GDK_DEBUG_SELECTION = 1 << 5
348 void gdk_events_init (void);
349 void gdk_window_init (void);
350 void gdk_visual_init (void);
351 void gdk_selection_init (void);
352 void gdk_dnd_init (void);
353 void gdk_dnd_exit (void);
354 void gdk_image_init (void);
355 void gdk_image_exit (void);
357 GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
358 GdkVisual* gdk_visual_lookup (Visual *xvisual);
360 void gdk_window_add_colormap_windows (GdkWindow *window);
361 void gdk_window_destroy_notify (GdkWindow *window);
363 void gdk_xid_table_insert (XID *xid,
365 void gdk_xid_table_remove (XID xid);
366 gpointer gdk_xid_table_lookup (XID xid);
368 /* Internal functions */
370 HDC gdk_gc_predraw (GdkDrawablePrivate *drawable_private,
371 GdkGCPrivate *gc_private);
372 void gdk_gc_postdraw (GdkDrawablePrivate *drawable_private,
373 GdkGCPrivate *gc_private);
374 HRGN BitmapToRegion (HBITMAP hBmp);
376 void gdk_sel_prop_store (GdkWindow *owner,
382 void gdk_event_queue_append (GdkEvent *event);
384 gint gdk_nmbstowcs (GdkWChar *dest,
388 gint gdk_nmbstowchar_ts (wchar_t *dest,
393 void gdk_wchar_text_handle (GdkFont *font,
394 const wchar_t *wcstr,
396 void (*handler)(GdkWin32SingleFont *,
402 /* Please see gdkwindow.c for comments on how to use */
403 HWND gdk_window_xid_at(HWND base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
404 HWND gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
406 extern gint gdk_debug_level;
407 extern gint gdk_show_events;
408 extern gint gdk_stack_trace;
409 extern HWND gdk_root_window;
410 extern HWND gdk_leader_window;
411 GDKVAR GdkWindowPrivate *gdk_root_parent;
412 GDKVAR Atom gdk_selection_property;
413 GDKVAR gchar *gdk_progclass;
414 GDKVAR gint gdk_error_code;
415 GDKVAR gint gdk_error_warnings;
416 GDKVAR gint gdk_null_window_warnings;
417 extern gint gdk_event_func_from_window_proc;
420 extern HINSTANCE gdk_DLLInstance;
421 extern HINSTANCE gdk_ProgInstance;
423 extern UINT gdk_selection_notify_msg;
424 extern UINT gdk_selection_request_msg;
425 extern UINT gdk_selection_clear_msg;
426 extern GdkAtom gdk_clipboard_atom;
427 extern GdkAtom gdk_win32_dropfiles_atom;
428 extern GdkAtom gdk_ole2_dnd_atom;
430 extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
432 extern DWORD windows_version;
434 /* Debugging support */
436 #ifdef G_ENABLE_DEBUG
438 #define GDK_NOTE(type,action) G_STMT_START { \
439 if (gdk_debug_flags & GDK_DEBUG_##type) \
440 { action; }; } G_STMT_END
442 #else /* !G_ENABLE_DEBUG */
444 #define GDK_NOTE(type,action)
446 #endif /* G_ENABLE_DEBUG */
448 GDKVAR guint gdk_debug_flags;
450 /* Internal functions for debug output etc. */
452 char *gdk_color_to_string (GdkColor *);
456 #endif /* __cplusplus */
459 #endif /* __GDK_PRIVATE_H__ */