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 Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #ifndef __GDK_TYPES_H__
19 #define __GDK_TYPES_H__
22 /* GDK uses "glib". (And so does GTK).
28 #define GDK_CURRENT_TIME 0L
29 #define GDK_PARENT_RELATIVE 1L
31 /* special deviceid for core pointer events */
32 #define GDK_CORE_POINTER 0xfedc
37 #endif /* __cplusplus */
40 /* Type definitions for the basic structures.
43 typedef gulong GdkAtom;
44 typedef struct _GdkColor GdkColor;
45 typedef struct _GdkColormap GdkColormap;
46 typedef struct _GdkVisual GdkVisual;
47 typedef struct _GdkWindowAttr GdkWindowAttr;
48 typedef struct _GdkWindow GdkWindow;
49 typedef struct _GdkWindow GdkPixmap;
50 typedef struct _GdkWindow GdkBitmap;
51 typedef struct _GdkWindow GdkDrawable;
52 typedef struct _GdkImage GdkImage;
53 typedef struct _GdkGCValues GdkGCValues;
54 typedef struct _GdkGC GdkGC;
55 typedef struct _GdkPoint GdkPoint;
56 typedef struct _GdkRectangle GdkRectangle;
57 typedef struct _GdkSegment GdkSegment;
58 typedef struct _GdkFont GdkFont;
59 typedef struct _GdkCursor GdkCursor;
60 typedef struct _GdkColorContextDither GdkColorContextDither;
61 typedef struct _GdkColorContext GdkColorContext;
63 typedef struct _GdkEventAny GdkEventAny;
64 typedef struct _GdkEventExpose GdkEventExpose;
65 typedef struct _GdkEventNoExpose GdkEventNoExpose;
66 typedef struct _GdkEventVisibility GdkEventVisibility;
67 typedef struct _GdkEventMotion GdkEventMotion;
68 typedef struct _GdkEventButton GdkEventButton;
69 typedef struct _GdkEventKey GdkEventKey;
70 typedef struct _GdkEventFocus GdkEventFocus;
71 typedef struct _GdkEventCrossing GdkEventCrossing;
72 typedef struct _GdkEventConfigure GdkEventConfigure;
73 typedef struct _GdkEventProperty GdkEventProperty;
74 typedef struct _GdkEventSelection GdkEventSelection;
75 typedef struct _GdkEventProximity GdkEventProximity;
76 typedef struct _GdkEventOther GdkEventOther;
77 typedef struct _GdkEventDragBegin GdkEventDragBegin;
78 typedef struct _GdkEventDragRequest GdkEventDragRequest;
79 typedef struct _GdkEventDropEnter GdkEventDropEnter;
80 typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
81 typedef struct _GdkEventDropLeave GdkEventDropLeave;
82 typedef struct _GdkEventClient GdkEventClient;
83 typedef union _GdkEvent GdkEvent;
84 typedef struct _GdkDeviceKey GdkDeviceKey;
85 typedef struct _GdkDeviceInfo GdkDeviceInfo;
86 typedef struct _GdkTimeCoord GdkTimeCoord;
87 typedef gint (*GdkEventFunc) (GdkEvent *event,
95 * Root: There is only 1 root window and it is initialized
96 * at startup. Creating a window of type GDK_WINDOW_ROOT
98 * Toplevel: Windows which interact with the window manager.
99 * Child: Windows which are children of some other type of window.
100 * (Any other type of window). Most windows are child windows.
101 * Dialog: A special kind of toplevel window which interacts with
102 * the window manager slightly differently than a regular
103 * toplevel window. Dialog windows should be used for any
105 * Pixmap: Pixmaps are really just another kind of window which
106 * doesn't actually appear on the screen. It can't have
107 * children, either and is really just a convenience so
108 * that the drawing functions can work on both windows
109 * and pixmaps transparently. (ie. You shouldn't pass a
110 * pixmap to any procedure which accepts a window with the
111 * exception of the drawing functions).
123 /* Classes of windows.
124 * InputOutput: Almost every window should be of this type. Such windows
125 * receive events and are also displayed on screen.
126 * InputOnly: Used only in special circumstances when events need to be
127 * stolen from another window or windows. Input only windows
128 * have no visible output, so they are handy for placing over
129 * top of a group of windows in order to grab the events (or
130 * filter the events) from those windows.
139 * Normal: Normal X image type. These are slow as they involve passing
140 * the entire image through the X connection each time a draw
141 * request is required.
142 * Shared: Shared memory X image type. These are fast as the X server
143 * and the program actually use the same piece of memory. They
144 * should be used with care though as there is the possibility
145 * for both the X server and the program to be reading/writing
146 * the image simultaneously and producing undesired results.
165 GDK_VISUAL_STATIC_GRAY,
166 GDK_VISUAL_GRAYSCALE,
167 GDK_VISUAL_STATIC_COLOR,
168 GDK_VISUAL_PSEUDO_COLOR,
169 GDK_VISUAL_TRUE_COLOR,
170 GDK_VISUAL_DIRECT_COLOR
174 * GDK_FONT_FONT: the font is an XFontStruct.
175 * GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
183 /* Window attribute mask values.
184 * GDK_WA_TITLE: The "title" field is valid.
185 * GDK_WA_X: The "x" field is valid.
186 * GDK_WA_Y: The "y" field is valid.
187 * GDK_WA_CURSOR: The "cursor" field is valid.
188 * GDK_WA_COLORMAP: The "colormap" field is valid.
189 * GDK_WA_VISUAL: The "visual" field is valid.
193 GDK_WA_TITLE = 1 << 1,
196 GDK_WA_CURSOR = 1 << 4,
197 GDK_WA_COLORMAP = 1 << 5,
198 GDK_WA_VISUAL = 1 << 6,
199 GDK_WA_WMCLASS = 1 << 7,
200 GDK_WA_NOREDIR = 1 << 8
201 } GdkWindowAttributesType;
203 /* Size restriction enumeration.
207 GDK_HINT_POS = 1 << 0,
208 GDK_HINT_MIN_SIZE = 1 << 1,
209 GDK_HINT_MAX_SIZE = 1 << 2
212 /* GC function types.
213 * Copy: Overwrites destination pixels with the source pixels.
214 * Invert: Inverts the destination pixels.
215 * Xor: Xor's the destination pixels with the source pixels.
246 GDK_LINE_ON_OFF_DASH,
280 #include <gdk/gdkcursors.h>
282 GDK_CURSOR_IS_PIXMAP = -1
286 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
287 GDK_FILTER_TRANSLATE, /* Translated event stored */
288 GDK_FILTER_REMOVE /* Terminate processing, removing event */
292 GDK_VISIBILITY_UNOBSCURED,
293 GDK_VISIBILITY_PARTIAL,
294 GDK_VISIBILITY_FULLY_OBSCURED
295 } GdkVisibilityState;
298 * Nothing: No event occurred.
299 * Delete: A window delete event was sent by the window manager.
300 * The specified window should be deleted.
301 * Destroy: A window has been destroyed.
302 * Expose: Part of a window has been uncovered.
303 * NoExpose: Same as expose, but no expose event was generated.
304 * VisibilityNotify: A window has become fully/partially/not obscured.
305 * MotionNotify: The mouse has moved.
306 * ButtonPress: A mouse button was pressed.
307 * ButtonRelease: A mouse button was release.
308 * KeyPress: A key was pressed.
309 * KeyRelease: A key was released.
310 * EnterNotify: A window was entered.
311 * LeaveNotify: A window was exited.
312 * FocusChange: The focus window has changed. (The focus window gets
314 * Resize: A window has been resized.
315 * Map: A window has been mapped. (It is now visible on the screen).
316 * Unmap: A window has been unmapped. (It is no longer visible on
325 GDK_MOTION_NOTIFY = 3,
326 GDK_BUTTON_PRESS = 4,
327 GDK_2BUTTON_PRESS = 5,
328 GDK_3BUTTON_PRESS = 6,
329 GDK_BUTTON_RELEASE = 7,
332 GDK_ENTER_NOTIFY = 10,
333 GDK_LEAVE_NOTIFY = 11,
334 GDK_FOCUS_CHANGE = 12,
338 GDK_PROPERTY_NOTIFY = 16,
339 GDK_SELECTION_CLEAR = 17,
340 GDK_SELECTION_REQUEST = 18,
341 GDK_SELECTION_NOTIFY = 19,
342 GDK_PROXIMITY_IN = 20,
343 GDK_PROXIMITY_OUT = 21,
345 GDK_DRAG_REQUEST = 23,
348 GDK_DROP_DATA_AVAIL = 26,
349 GDK_CLIENT_EVENT = 27,
350 GDK_VISIBILITY_NOTIFY = 28,
352 GDK_OTHER_EVENT = 9999 /* Deprecated, use filters instead */
355 /* Event masks. (Used to select what types of events a window
360 GDK_EXPOSURE_MASK = 1 << 1,
361 GDK_POINTER_MOTION_MASK = 1 << 2,
362 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
363 GDK_BUTTON_MOTION_MASK = 1 << 4,
364 GDK_BUTTON1_MOTION_MASK = 1 << 5,
365 GDK_BUTTON2_MOTION_MASK = 1 << 6,
366 GDK_BUTTON3_MOTION_MASK = 1 << 7,
367 GDK_BUTTON_PRESS_MASK = 1 << 8,
368 GDK_BUTTON_RELEASE_MASK = 1 << 9,
369 GDK_KEY_PRESS_MASK = 1 << 10,
370 GDK_KEY_RELEASE_MASK = 1 << 11,
371 GDK_ENTER_NOTIFY_MASK = 1 << 12,
372 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
373 GDK_FOCUS_CHANGE_MASK = 1 << 14,
374 GDK_STRUCTURE_MASK = 1 << 15,
375 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
376 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
377 GDK_PROXIMITY_IN_MASK = 1 << 18,
378 GDK_PROXIMITY_OUT_MASK = 1 << 19,
379 GDK_ALL_EVENTS_MASK = 0x07FFFF
382 /* Types of enter/leave notifications.
388 * Unknown: An unknown type of enter/leave event occurred.
392 GDK_NOTIFY_ANCESTOR = 0,
393 GDK_NOTIFY_VIRTUAL = 1,
394 GDK_NOTIFY_INFERIOR = 2,
395 GDK_NOTIFY_NONLINEAR = 3,
396 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
397 GDK_NOTIFY_UNKNOWN = 5
400 /* Types of modifiers.
404 GDK_SHIFT_MASK = 1 << 0,
405 GDK_LOCK_MASK = 1 << 1,
406 GDK_CONTROL_MASK = 1 << 2,
407 GDK_MOD1_MASK = 1 << 3,
408 GDK_MOD2_MASK = 1 << 4,
409 GDK_MOD3_MASK = 1 << 5,
410 GDK_MOD4_MASK = 1 << 6,
411 GDK_MOD5_MASK = 1 << 7,
412 GDK_BUTTON1_MASK = 1 << 8,
413 GDK_BUTTON2_MASK = 1 << 9,
414 GDK_BUTTON3_MASK = 1 << 10,
415 GDK_BUTTON4_MASK = 1 << 11,
416 GDK_BUTTON5_MASK = 1 << 12
421 GDK_CLIP_BY_CHILDREN = 0,
422 GDK_INCLUDE_INFERIORS = 1
427 GDK_INPUT_READ = 1 << 0,
428 GDK_INPUT_WRITE = 1 << 1,
429 GDK_INPUT_EXCEPTION = 1 << 2
436 GDK_ERROR_PARAM = -2,
449 GDK_GC_FOREGROUND = 1 << 0,
450 GDK_GC_BACKGROUND = 1 << 1,
451 GDK_GC_FONT = 1 << 2,
452 GDK_GC_FUNCTION = 1 << 3,
453 GDK_GC_FILL = 1 << 4,
454 GDK_GC_TILE = 1 << 5,
455 GDK_GC_STIPPLE = 1 << 6,
456 GDK_GC_CLIP_MASK = 1 << 7,
457 GDK_GC_SUBWINDOW = 1 << 8,
458 GDK_GC_TS_X_ORIGIN = 1 << 9,
459 GDK_GC_TS_Y_ORIGIN = 1 << 10,
460 GDK_GC_CLIP_X_ORIGIN = 1 << 11,
461 GDK_GC_CLIP_Y_ORIGIN = 1 << 12,
462 GDK_GC_EXPOSURES = 1 << 13,
463 GDK_GC_LINE_WIDTH = 1 << 14,
464 GDK_GC_LINE_STYLE = 1 << 15,
465 GDK_GC_CAP_STYLE = 1 << 16,
466 GDK_GC_JOIN_STYLE = 1 << 17
471 GDK_SELECTION_PRIMARY = 1,
472 GDK_SELECTION_SECONDARY = 2
477 GDK_PROPERTY_NEW_VALUE,
483 GDK_PROP_MODE_REPLACE,
484 GDK_PROP_MODE_PREPEND,
488 /* These definitions are for version 1 of the OffiX D&D protocol,
489 taken from <OffiX/DragAndDropTypes.h> */
492 GDK_DNDTYPE_NOTDND = -1,
493 GDK_DNDTYPE_UNKNOWN = 0,
494 GDK_DNDTYPE_RAWDATA = 1,
495 GDK_DNDTYPE_FILE = 2,
496 GDK_DNDTYPE_FILES = 3,
497 GDK_DNDTYPE_TEXT = 4,
499 GDK_DNDTYPE_LINK = 6,
502 GDK_DNDTYPE_MIME = 9,
506 /* Enums for XInput support */
534 /* The next two types define enums for predefined atoms relating
535 to selections. In general, one will need to use gdk_intern_atom */
539 GDK_TARGET_BITMAP = 5,
540 GDK_TARGET_COLORMAP = 7,
541 GDK_TARGET_DRAWABLE = 17,
542 GDK_TARGET_PIXMAP = 20,
543 GDK_TARGET_STRING = 31
548 GDK_SELECTION_TYPE_ATOM = 4,
549 GDK_SELECTION_TYPE_BITMAP = 5,
550 GDK_SELECTION_TYPE_COLORMAP = 7,
551 GDK_SELECTION_TYPE_DRAWABLE = 17,
552 GDK_SELECTION_TYPE_INTEGER = 19,
553 GDK_SELECTION_TYPE_PIXMAP = 20,
554 GDK_SELECTION_TYPE_WINDOW = 33,
555 GDK_SELECTION_TYPE_STRING = 31
560 GDK_EXTENSION_EVENTS_NONE,
561 GDK_EXTENSION_EVENTS_ALL,
562 GDK_EXTENSION_EVENTS_CURSOR
567 GdkIMPreeditArea = 0x0001L,
568 GdkIMPreeditCallbacks = 0x0002L,
569 GdkIMPreeditPosition = 0x0004L,
570 GdkIMPreeditNothing = 0x0008L,
571 GdkIMPreeditNone = 0x0010L,
572 GdkIMStatusArea = 0x0100L,
573 GdkIMStatusCallbacks = 0x0200L,
574 GdkIMStatusNothing = 0x0400L,
575 GdkIMStatusNone = 0x0800L
578 #define GdkIMPreeditMask \
579 ( GdkIMPreeditArea | GdkIMPreeditCallbacks | \
580 GdkIMPreeditPosition | GdkIMPreeditNothing | \
583 #define GdkIMStatusMask \
584 ( GdkIMStatusArea | GdkIMStatusCallbacks | \
585 GdkIMStatusNothing | GdkIMStatusNone )
587 typedef void (*GdkInputFunction) (gpointer data,
589 GdkInputCondition condition);
591 typedef void (*GdkDestroyNotify) (gpointer data);
593 /* Color Context modes.
595 * GDK_CC_MODE_UNDEFINED - unknown
596 * GDK_CC_MODE_BW - default B/W
597 * GDK_CC_MODE_STD_CMAP - has a standard colormap
598 * GDK_CC_MODE_TRUE - is a TrueColor/DirectColor visual
599 * GDK_CC_MODE_MY_GRAY - my grayramp
600 * GDK_CC_MODE_PALETTE - has a pre-allocated palette
605 GDK_CC_MODE_UNDEFINED,
607 GDK_CC_MODE_STD_CMAP,
611 } GdkColorContextMode;
614 * A color consists of red, green and blue values in the
615 * range 0-65535 and a pixel value. The pixel value is highly
616 * dependent on the depth and colormap which this color will
617 * be used to draw into. Therefore, sharing colors between
618 * colormaps is a bad idea.
628 /* The colormap type.
629 * Colormaps consist of 256 colors.
633 GdkColor colors[256];
637 * "type" is the type of visual this is (PseudoColor, TrueColor, etc).
638 * "depth" is the bit depth of this visual.
639 * "colormap_size" is the size of a colormap for this visual.
640 * "bits_per_rgb" is the number of significant bits per red, green and blue.
641 * The red, green and blue masks, shifts and precisions refer
642 * to value needed to calculate pixel values in TrueColor and DirectColor
643 * visuals. The "mask" is the significant bits within the pixel. The
644 * "shift" is the number of bits left we must shift a primary for it
645 * to be in position (according to the "mask"). "prec" refers to how
646 * much precision the pixel value contains for a particular primary.
652 GdkByteOrder byte_order;
669 struct _GdkWindowAttr
676 GdkWindowClass wclass;
678 GdkColormap *colormap;
679 GdkWindowType window_type;
682 gchar *wmclass_class;
683 gboolean override_redirect;
694 GdkVisual *visual; /* visual used to create the image */
695 GdkByteOrder byte_order;
699 guint16 bpp; /* bytes per pixel */
700 guint16 bpl; /* bytes per line */
709 GdkFunction function;
713 GdkPixmap *clip_mask;
714 GdkSubwindowMode subwindow_mode;
719 gint graphics_exposures;
721 GdkLineStyle line_style;
722 GdkCapStyle cap_style;
723 GdkJoinStyle join_style;
765 struct _GdkColorContextDither
767 gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */
768 gint fast_err[32][32][32]; /* internal RGB error information */
769 gint fast_erg[32][32][32];
770 gint fast_erb[32][32][32];
773 struct _GdkColorContext
776 GdkColormap *colormap;
778 gint num_colors; /* available no. of colors in colormap */
779 gint max_colors; /* maximum no. of colors */
780 gint num_allocated; /* no. of allocated colors */
782 GdkColorContextMode mode;
783 gint need_to_free_colormap;
784 GdkAtom std_cmap_atom;
786 gulong *clut; /* color look-up table */
787 GdkColor *cmap; /* colormap */
789 GHashTable *color_hash; /* hash table of allocated colors */
790 GdkColor *palette; /* preallocated palette */
791 gint num_palette; /* size of palette */
793 GdkColorContextDither *fast_dither; /* fast dither matrix */
822 /* Types for XInput support */
827 GdkModifierType modifiers;
830 struct _GdkDeviceInfo
834 GdkInputSource source;
836 gint has_cursor; /* TRUE if the X pointer follows device motion */
838 GdkAxisUse *axes; /* Specifies use for each axis */
853 /* Event filtering */
855 typedef void GdkXEvent; /* Can be cast to XEvent */
857 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
868 struct _GdkEventExpose
873 gint count; /* If non-zero, how many more events follow. */
876 struct _GdkEventNoExpose
880 /* XXX: does anyone need the X major_code or minor_code fields? */
883 struct _GdkEventVisibility
887 GdkVisibilityState state;
890 struct _GdkEventMotion
902 GdkInputSource source;
904 gdouble x_root, y_root;
907 struct _GdkEventButton
919 GdkInputSource source;
921 gdouble x_root, y_root;
935 struct _GdkEventCrossing
939 GdkWindow *subwindow;
940 GdkNotifyType detail;
943 struct _GdkEventFocus
950 struct _GdkEventConfigure
959 struct _GdkEventProperty
968 struct _GdkEventSelection
979 /* This event type will be used pretty rarely. It only is important
980 for XInput aware programs that are drawing their own cursor */
982 struct _GdkEventProximity
987 GdkInputSource source;
991 struct _GdkEventDragRequest
998 guint protocol_version:4;
1001 guint delete_data:1; /* Do *not* delete if link is sent, only
1008 guint8 isdrop; /* This gdk event can be generated by a couple of
1009 X events - this lets the app know whether the
1010 drop really occurred or we just set the data */
1012 GdkPoint drop_coords;
1016 struct _GdkEventDragBegin
1022 guint protocol_version:4;
1029 struct _GdkEventDropEnter
1036 guint protocol_version:4;
1038 guint extended_typelist:1;
1045 struct _GdkEventDropLeave
1052 guint protocol_version:4;
1059 struct _GdkEventDropDataAvailable
1066 guint protocol_version:4;
1072 gchar *data_type; /* MIME type */
1073 gulong data_numbytes;
1077 struct _GdkEventClient
1081 GdkAtom message_type;
1082 gushort data_format;
1090 struct _GdkEventOther
1101 GdkEventExpose expose;
1102 GdkEventNoExpose no_expose;
1103 GdkEventVisibility visibility;
1104 GdkEventMotion motion;
1105 GdkEventButton button;
1107 GdkEventCrossing crossing;
1108 GdkEventFocus focus_change;
1109 GdkEventConfigure configure;
1110 GdkEventProperty property;
1111 GdkEventSelection selection;
1112 GdkEventProximity proximity;
1113 GdkEventDragBegin dragbegin;
1114 GdkEventDragRequest dragrequest;
1115 GdkEventDropEnter dropenter;
1116 GdkEventDropLeave dropleave;
1117 GdkEventDropDataAvailable dropdataavailable;
1118 GdkEventClient client;
1119 GdkEventOther other;
1125 #endif /* __cplusplus */
1128 #endif /* __GDK_TYPES_H__ */