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 Lesser 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser 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-2000. 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_WIN32_H__
28 #define __GDK_PRIVATE_WIN32_H__
35 #define _WIN32_WINNT WINVER
38 #include <gdk/gdkprivate.h>
39 #include <gdk/win32/gdkwindow-win32.h>
40 #include <gdk/win32/gdkpixmap-win32.h>
42 #include "gdkinternals.h"
46 /* Make up for some minor w32api or MSVC6 header lossage */
49 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
53 #define FS_VIETNAMESE 0x100
57 #define WM_GETOBJECT 0x3D
59 #ifndef WM_NCXBUTTONDOWN
60 #define WM_NCXBUTTONDOWN 0xAB
62 #ifndef WM_NCXBUTTONUP
63 #define WM_NCXBUTTONUP 0xAC
65 #ifndef WM_NCXBUTTONDBLCLK
66 #define WM_NCXBUTTONDBLCLK 0xAD
68 #ifndef WM_CHANGEUISTATE
69 #define WM_CHANGEUISTATE 0x127
71 #ifndef WM_UPDATEUISTATE
72 #define WM_UPDATEUISTATE 0x128
74 #ifndef WM_QUERYUISTATE
75 #define WM_QUERYUISTATE 0x129
77 #ifndef WM_XBUTTONDOWN
78 #define WM_XBUTTONDOWN 0x20B
81 #define WM_XBUTTONUP 0x20C
83 #ifndef WM_XBUTTONDBLCLK
84 #define WM_XBUTTONDBLCLK 0x20D
86 #ifndef WM_NCMOUSEHOVER
87 #define WM_NCMOUSEHOVER 0x2A0
89 #ifndef WM_NCMOUSELEAVE
90 #define WM_NCMOUSELEAVE 0x2A2
93 #define WM_APPCOMMAND 0x319
101 /* Define some combinations of GdkDebugFlags */
102 #define GDK_DEBUG_EVENTS_OR_COLORMAP (GDK_DEBUG_EVENTS|GDK_DEBUG_COLORMAP)
103 #define GDK_DEBUG_EVENTS_OR_INPUT (GDK_DEBUG_EVENTS|GDK_DEBUG_INPUT)
104 #define GDK_DEBUG_PIXMAP_OR_COLORMAP (GDK_DEBUG_PIXMAP|GDK_DEBUG_COLORMAP)
105 #define GDK_DEBUG_MISC_OR_COLORMAP (GDK_DEBUG_MISC|GDK_DEBUG_COLORMAP)
106 #define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS)
108 //#define GDK_WINDOW_SCREEN(win) (_gdk_screen)
109 GdkScreen *GDK_WINDOW_SCREEN(GObject *win);
111 #define GDK_WINDOW_IS_WIN32(win) (GDK_IS_WINDOW_IMPL_WIN32 (((GdkWindowObject *)win)->impl))
113 typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
114 typedef struct _GdkCursorPrivate GdkCursorPrivate;
115 typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
117 struct _GdkCursorPrivate
123 struct _GdkWin32SingleFont
131 struct _GdkVisualClass
133 GObjectClass parent_class;
138 GDK_WIN32_PE_AVAILABLE,
140 } GdkWin32PalEntryState;
142 struct _GdkColormapPrivateWin32
145 gint current_size; /* Current size of hpal */
146 GdkWin32PalEntryState *use;
153 GType _gdk_gc_win32_get_type (void);
155 gulong _gdk_win32_get_next_tick (gulong suggested_tick);
157 void _gdk_window_init_position (GdkWindow *window);
158 void _gdk_window_move_resize_child (GdkWindow *window,
164 /* GdkWindowImpl methods */
165 void _gdk_win32_window_scroll (GdkWindow *window,
168 void _gdk_win32_window_move_region (GdkWindow *window,
169 const cairo_region_t *region,
172 void _gdk_win32_windowing_window_get_offsets (GdkWindow *window,
177 void _gdk_win32_selection_init (void);
178 void _gdk_win32_dnd_exit (void);
180 void gdk_win32_handle_table_insert (HANDLE *handle,
182 void gdk_win32_handle_table_remove (HANDLE handle);
184 void _gdk_win32_blit (gboolean use_fg_bg,
185 GdkDrawableImplWin32 *drawable,
195 COLORREF _gdk_win32_colormap_color (GdkColormap *colormap,
198 HRGN _gdk_win32_bitmap_to_hrgn (GdkPixmap *bitmap);
200 HRGN _gdk_win32_cairo_region_to_hrgn (const cairo_region_t *region,
204 cairo_region_t *_gdk_win32_hrgn_to_region (HRGN hrgn);
206 void _gdk_win32_adjust_client_rect (GdkWindow *window,
209 void _gdk_selection_property_delete (GdkWindow *);
211 void _gdk_dropfiles_store (gchar *data);
213 void _gdk_push_modal_window (GdkWindow *window);
214 void _gdk_remove_modal_window (GdkWindow *window);
215 GdkWindow *_gdk_modal_current (void);
218 #ifdef G_ENABLE_DEBUG
219 gchar *_gdk_win32_color_to_string (const GdkColor *color);
220 void _gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
222 void _gdk_win32_print_system_palette (void);
223 void _gdk_win32_print_hpalette (HPALETTE hpal);
224 void _gdk_win32_print_dc (HDC hdc);
226 gchar *_gdk_win32_cap_style_to_string (GdkCapStyle cap_style);
227 gchar *_gdk_win32_fill_style_to_string (GdkFill fill);
228 gchar *_gdk_win32_function_to_string (GdkFunction function);
229 gchar *_gdk_win32_join_style_to_string (GdkJoinStyle join_style);
230 gchar *_gdk_win32_line_style_to_string (GdkLineStyle line_style);
231 gchar *_gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol);
232 gchar *_gdk_win32_gcvalues_mask_to_string (GdkGCValuesMask mask);
233 gchar *_gdk_win32_window_state_to_string (GdkWindowState state);
234 gchar *_gdk_win32_window_style_to_string (LONG style);
235 gchar *_gdk_win32_window_exstyle_to_string (LONG style);
236 gchar *_gdk_win32_window_pos_bits_to_string (UINT flags);
237 gchar *_gdk_win32_drag_action_to_string (GdkDragAction actions);
238 gchar *_gdk_win32_drawable_description (GdkDrawable *d);
240 gchar *_gdk_win32_rop2_to_string (int rop2);
241 gchar *_gdk_win32_lbstyle_to_string (UINT brush_style);
242 gchar *_gdk_win32_pstype_to_string (DWORD pen_style);
243 gchar *_gdk_win32_psstyle_to_string (DWORD pen_style);
244 gchar *_gdk_win32_psendcap_to_string (DWORD pen_style);
245 gchar *_gdk_win32_psjoin_to_string (DWORD pen_style);
246 gchar *_gdk_win32_message_to_string (UINT msg);
247 gchar *_gdk_win32_key_to_string (LONG lParam);
248 gchar *_gdk_win32_cf_to_string (UINT format);
249 gchar *_gdk_win32_data_to_string (const guchar*data,
251 gchar *_gdk_win32_rect_to_string (const RECT *rect);
253 gchar *_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect);
254 gchar *_gdk_win32_cairo_region_to_string (const cairo_region_t *box);
256 void _gdk_win32_print_event (const GdkEvent *event);
260 gchar *_gdk_win32_last_error_string (void);
261 void _gdk_win32_api_failed (const gchar *where,
263 void _gdk_other_api_failed (const gchar *where,
266 #define WIN32_API_FAILED(api) _gdk_win32_api_failed (G_STRLOC , api)
267 #define WIN32_GDI_FAILED(api) WIN32_API_FAILED (api)
268 #define OTHER_API_FAILED(api) _gdk_other_api_failed (G_STRLOC, api)
270 /* These two macros call a GDI or other Win32 API and if the return
271 * value is zero or NULL, print a warning message. The majority of GDI
272 * calls return zero or NULL on failure. The value of the macros is nonzero
273 * if the call succeeded, zero otherwise.
276 #define GDI_CALL(api, arglist) (api arglist ? 1 : (WIN32_GDI_FAILED (#api), 0))
277 #define API_CALL(api, arglist) (api arglist ? 1 : (WIN32_API_FAILED (#api), 0))
279 extern LRESULT CALLBACK _gdk_win32_window_procedure (HWND, UINT, WPARAM, LPARAM);
281 extern GdkWindow *_gdk_root;
283 extern GdkDisplay *_gdk_display;
284 extern GdkScreen *_gdk_screen;
286 extern gint _gdk_num_monitors;
287 typedef struct _GdkWin32Monitor GdkWin32Monitor;
288 struct _GdkWin32Monitor
291 gint width_mm, height_mm;
294 extern GdkWin32Monitor *_gdk_monitors;
296 /* Offsets to add to Windows coordinates (which are relative to the
297 * primary monitor's origin, and thus might be negative for monitors
298 * to the left and/or above the primary monitor) to get GDK
299 * coordinates, which should be non-negative on the whole screen.
301 extern gint _gdk_offset_x, _gdk_offset_y;
303 extern HDC _gdk_display_hdc;
304 extern HINSTANCE _gdk_dll_hinstance;
305 extern HINSTANCE _gdk_app_hmodule;
307 /* These are thread specific, but GDK/win32 works OK only when invoked
308 * from a single thread anyway.
310 extern HKL _gdk_input_locale;
311 extern gboolean _gdk_input_locale_is_ime;
312 extern UINT _gdk_input_codepage;
314 extern guint _gdk_keymap_serial;
315 extern gboolean _gdk_keyboard_has_altgr;
316 extern guint _scancode_rshift;
318 /* GdkAtoms: properties, targets and types */
319 extern GdkAtom _gdk_selection;
320 extern GdkAtom _wm_transient_for;
321 extern GdkAtom _targets;
322 extern GdkAtom _delete;
323 extern GdkAtom _save_targets;
324 extern GdkAtom _utf8_string;
325 extern GdkAtom _text;
326 extern GdkAtom _compound_text;
327 extern GdkAtom _text_uri_list;
328 extern GdkAtom _text_html;
329 extern GdkAtom _image_png;
330 extern GdkAtom _image_jpeg;
331 extern GdkAtom _image_bmp;
332 extern GdkAtom _image_gif;
335 extern GdkAtom _local_dnd;
336 extern GdkAtom _gdk_win32_dropfiles;
337 extern GdkAtom _gdk_ole2_dnd;
339 /* Clipboard formats */
341 extern UINT _cf_jfif;
344 extern UINT _cf_html_format;
345 extern UINT _cf_text_html;
347 /* OLE-based DND state */
350 GDK_WIN32_DND_PENDING,
351 GDK_WIN32_DND_DROPPED,
352 GDK_WIN32_DND_FAILED,
353 GDK_WIN32_DND_DRAGGING,
356 extern GdkWin32DndState _dnd_target_state;
357 extern GdkWin32DndState _dnd_source_state;
359 void _gdk_win32_dnd_do_dragdrop (void);
360 void _gdk_win32_ole2_dnd_property_change (GdkAtom type,
365 void _gdk_win32_begin_modal_call (void);
366 void _gdk_win32_end_modal_call (void);
370 extern gboolean _gdk_input_ignore_wintab;
371 extern gint _gdk_max_colors;
373 #define GDK_WIN32_COLORMAP_DATA(cmap) ((GdkColormapPrivateWin32 *) GDK_COLORMAP (cmap)->windowing_data)
375 /* TRUE while a modal sizing, moving, or dnd operation is in progress */
376 extern gboolean _modal_operation_in_progress;
378 /* TRUE when we are emptying the clipboard ourselves */
379 extern gboolean _ignore_destroy_clipboard;
381 /* Mapping from registered clipboard format id (native) to
382 * corresponding GdkAtom
384 extern GHashTable *_format_atom_table;
386 /* Hold the result of a delayed rendering */
387 extern HGLOBAL _delayed_rendering_data;
389 HGLOBAL _gdk_win32_selection_convert_to_dib (HGLOBAL hdata,
392 /* Convert a pixbuf to an HICON (or HCURSOR). Supports alpha under
393 * Windows XP, thresholds alpha otherwise.
395 HICON _gdk_win32_pixbuf_to_hicon (GdkPixbuf *pixbuf);
396 HICON _gdk_win32_pixbuf_to_hcursor (GdkPixbuf *pixbuf,
399 gboolean _gdk_win32_pixbuf_to_hicon_supports_alpha (void);
402 void _gdk_windowing_window_init (GdkScreen *screen);
403 void _gdk_root_window_size_init (void);
404 void _gdk_monitor_init(void);
405 void _gdk_visual_init (void);
406 void _gdk_dnd_init (void);
407 void _gdk_events_init (void);
408 void _gdk_input_init (GdkDisplay *display);
410 #endif /* __GDK_PRIVATE_WIN32_H__ */