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 struct _GdkRegion GdkRegion;
88 typedef gint (*GdkEventFunc) (GdkEvent *event,
96 * Root: There is only 1 root window and it is initialized
97 * at startup. Creating a window of type GDK_WINDOW_ROOT
99 * Toplevel: Windows which interact with the window manager.
100 * Child: Windows which are children of some other type of window.
101 * (Any other type of window). Most windows are child windows.
102 * Dialog: A special kind of toplevel window which interacts with
103 * the window manager slightly differently than a regular
104 * toplevel window. Dialog windows should be used for any
106 * Pixmap: Pixmaps are really just another kind of window which
107 * doesn't actually appear on the screen. It can't have
108 * children, either and is really just a convenience so
109 * that the drawing functions can work on both windows
110 * and pixmaps transparently. (ie. You shouldn't pass a
111 * pixmap to any procedure which accepts a window with the
112 * exception of the drawing functions).
113 * Foreign: A window that actually belongs to another application
126 /* Classes of windows.
127 * InputOutput: Almost every window should be of this type. Such windows
128 * receive events and are also displayed on screen.
129 * InputOnly: Used only in special circumstances when events need to be
130 * stolen from another window or windows. Input only windows
131 * have no visible output, so they are handy for placing over
132 * top of a group of windows in order to grab the events (or
133 * filter the events) from those windows.
142 * Normal: Normal X image type. These are slow as they involve passing
143 * the entire image through the X connection each time a draw
144 * request is required.
145 * Shared: Shared memory X image type. These are fast as the X server
146 * and the program actually use the same piece of memory. They
147 * should be used with care though as there is the possibility
148 * for both the X server and the program to be reading/writing
149 * the image simultaneously and producing undesired results.
168 GDK_VISUAL_STATIC_GRAY,
169 GDK_VISUAL_GRAYSCALE,
170 GDK_VISUAL_STATIC_COLOR,
171 GDK_VISUAL_PSEUDO_COLOR,
172 GDK_VISUAL_TRUE_COLOR,
173 GDK_VISUAL_DIRECT_COLOR
177 * GDK_FONT_FONT: the font is an XFontStruct.
178 * GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
186 /* Window attribute mask values.
187 * GDK_WA_TITLE: The "title" field is valid.
188 * GDK_WA_X: The "x" field is valid.
189 * GDK_WA_Y: The "y" field is valid.
190 * GDK_WA_CURSOR: The "cursor" field is valid.
191 * GDK_WA_COLORMAP: The "colormap" field is valid.
192 * GDK_WA_VISUAL: The "visual" field is valid.
196 GDK_WA_TITLE = 1 << 1,
199 GDK_WA_CURSOR = 1 << 4,
200 GDK_WA_COLORMAP = 1 << 5,
201 GDK_WA_VISUAL = 1 << 6,
202 GDK_WA_WMCLASS = 1 << 7,
203 GDK_WA_NOREDIR = 1 << 8
204 } GdkWindowAttributesType;
206 /* Size restriction enumeration.
210 GDK_HINT_POS = 1 << 0,
211 GDK_HINT_MIN_SIZE = 1 << 1,
212 GDK_HINT_MAX_SIZE = 1 << 2
215 /* GC function types.
216 * Copy: Overwrites destination pixels with the source pixels.
217 * Invert: Inverts the destination pixels.
218 * Xor: Xor's the destination pixels with the source pixels.
249 GDK_LINE_ON_OFF_DASH,
283 #include <gdk/gdkcursors.h>
285 GDK_CURSOR_IS_PIXMAP = -1
289 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
290 GDK_FILTER_TRANSLATE, /* Translated event stored */
291 GDK_FILTER_REMOVE /* Terminate processing, removing event */
295 GDK_VISIBILITY_UNOBSCURED,
296 GDK_VISIBILITY_PARTIAL,
297 GDK_VISIBILITY_FULLY_OBSCURED
298 } GdkVisibilityState;
301 * Nothing: No event occurred.
302 * Delete: A window delete event was sent by the window manager.
303 * The specified window should be deleted.
304 * Destroy: A window has been destroyed.
305 * Expose: Part of a window has been uncovered.
306 * NoExpose: Same as expose, but no expose event was generated.
307 * VisibilityNotify: A window has become fully/partially/not obscured.
308 * MotionNotify: The mouse has moved.
309 * ButtonPress: A mouse button was pressed.
310 * ButtonRelease: A mouse button was release.
311 * KeyPress: A key was pressed.
312 * KeyRelease: A key was released.
313 * EnterNotify: A window was entered.
314 * LeaveNotify: A window was exited.
315 * FocusChange: The focus window has changed. (The focus window gets
317 * Resize: A window has been resized.
318 * Map: A window has been mapped. (It is now visible on the screen).
319 * Unmap: A window has been unmapped. (It is no longer visible on
328 GDK_MOTION_NOTIFY = 3,
329 GDK_BUTTON_PRESS = 4,
330 GDK_2BUTTON_PRESS = 5,
331 GDK_3BUTTON_PRESS = 6,
332 GDK_BUTTON_RELEASE = 7,
335 GDK_ENTER_NOTIFY = 10,
336 GDK_LEAVE_NOTIFY = 11,
337 GDK_FOCUS_CHANGE = 12,
341 GDK_PROPERTY_NOTIFY = 16,
342 GDK_SELECTION_CLEAR = 17,
343 GDK_SELECTION_REQUEST = 18,
344 GDK_SELECTION_NOTIFY = 19,
345 GDK_PROXIMITY_IN = 20,
346 GDK_PROXIMITY_OUT = 21,
348 GDK_DRAG_REQUEST = 23,
351 GDK_DROP_DATA_AVAIL = 26,
352 GDK_CLIENT_EVENT = 27,
353 GDK_VISIBILITY_NOTIFY = 28,
355 GDK_OTHER_EVENT = 9999 /* Deprecated, use filters instead */
358 /* Event masks. (Used to select what types of events a window
363 GDK_EXPOSURE_MASK = 1 << 1,
364 GDK_POINTER_MOTION_MASK = 1 << 2,
365 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
366 GDK_BUTTON_MOTION_MASK = 1 << 4,
367 GDK_BUTTON1_MOTION_MASK = 1 << 5,
368 GDK_BUTTON2_MOTION_MASK = 1 << 6,
369 GDK_BUTTON3_MOTION_MASK = 1 << 7,
370 GDK_BUTTON_PRESS_MASK = 1 << 8,
371 GDK_BUTTON_RELEASE_MASK = 1 << 9,
372 GDK_KEY_PRESS_MASK = 1 << 10,
373 GDK_KEY_RELEASE_MASK = 1 << 11,
374 GDK_ENTER_NOTIFY_MASK = 1 << 12,
375 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
376 GDK_FOCUS_CHANGE_MASK = 1 << 14,
377 GDK_STRUCTURE_MASK = 1 << 15,
378 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
379 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
380 GDK_PROXIMITY_IN_MASK = 1 << 18,
381 GDK_PROXIMITY_OUT_MASK = 1 << 19,
382 GDK_ALL_EVENTS_MASK = 0x07FFFF
385 /* Types of enter/leave notifications.
391 * Unknown: An unknown type of enter/leave event occurred.
395 GDK_NOTIFY_ANCESTOR = 0,
396 GDK_NOTIFY_VIRTUAL = 1,
397 GDK_NOTIFY_INFERIOR = 2,
398 GDK_NOTIFY_NONLINEAR = 3,
399 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
400 GDK_NOTIFY_UNKNOWN = 5
403 /* Types of modifiers.
407 GDK_SHIFT_MASK = 1 << 0,
408 GDK_LOCK_MASK = 1 << 1,
409 GDK_CONTROL_MASK = 1 << 2,
410 GDK_MOD1_MASK = 1 << 3,
411 GDK_MOD2_MASK = 1 << 4,
412 GDK_MOD3_MASK = 1 << 5,
413 GDK_MOD4_MASK = 1 << 6,
414 GDK_MOD5_MASK = 1 << 7,
415 GDK_BUTTON1_MASK = 1 << 8,
416 GDK_BUTTON2_MASK = 1 << 9,
417 GDK_BUTTON3_MASK = 1 << 10,
418 GDK_BUTTON4_MASK = 1 << 11,
419 GDK_BUTTON5_MASK = 1 << 12
424 GDK_CLIP_BY_CHILDREN = 0,
425 GDK_INCLUDE_INFERIORS = 1
430 GDK_INPUT_READ = 1 << 0,
431 GDK_INPUT_WRITE = 1 << 1,
432 GDK_INPUT_EXCEPTION = 1 << 2
439 GDK_ERROR_PARAM = -2,
452 GDK_GC_FOREGROUND = 1 << 0,
453 GDK_GC_BACKGROUND = 1 << 1,
454 GDK_GC_FONT = 1 << 2,
455 GDK_GC_FUNCTION = 1 << 3,
456 GDK_GC_FILL = 1 << 4,
457 GDK_GC_TILE = 1 << 5,
458 GDK_GC_STIPPLE = 1 << 6,
459 GDK_GC_CLIP_MASK = 1 << 7,
460 GDK_GC_SUBWINDOW = 1 << 8,
461 GDK_GC_TS_X_ORIGIN = 1 << 9,
462 GDK_GC_TS_Y_ORIGIN = 1 << 10,
463 GDK_GC_CLIP_X_ORIGIN = 1 << 11,
464 GDK_GC_CLIP_Y_ORIGIN = 1 << 12,
465 GDK_GC_EXPOSURES = 1 << 13,
466 GDK_GC_LINE_WIDTH = 1 << 14,
467 GDK_GC_LINE_STYLE = 1 << 15,
468 GDK_GC_CAP_STYLE = 1 << 16,
469 GDK_GC_JOIN_STYLE = 1 << 17
474 GDK_SELECTION_PRIMARY = 1,
475 GDK_SELECTION_SECONDARY = 2
480 GDK_PROPERTY_NEW_VALUE,
486 GDK_PROP_MODE_REPLACE,
487 GDK_PROP_MODE_PREPEND,
491 /* These definitions are for version 1 of the OffiX D&D protocol,
492 taken from <OffiX/DragAndDropTypes.h> */
495 GDK_DNDTYPE_NOTDND = -1,
496 GDK_DNDTYPE_UNKNOWN = 0,
497 GDK_DNDTYPE_RAWDATA = 1,
498 GDK_DNDTYPE_FILE = 2,
499 GDK_DNDTYPE_FILES = 3,
500 GDK_DNDTYPE_TEXT = 4,
502 GDK_DNDTYPE_LINK = 6,
505 GDK_DNDTYPE_MIME = 9,
509 /* Enums for XInput support */
537 /* The next two types define enums for predefined atoms relating
538 to selections. In general, one will need to use gdk_intern_atom */
542 GDK_TARGET_BITMAP = 5,
543 GDK_TARGET_COLORMAP = 7,
544 GDK_TARGET_DRAWABLE = 17,
545 GDK_TARGET_PIXMAP = 20,
546 GDK_TARGET_STRING = 31
551 GDK_SELECTION_TYPE_ATOM = 4,
552 GDK_SELECTION_TYPE_BITMAP = 5,
553 GDK_SELECTION_TYPE_COLORMAP = 7,
554 GDK_SELECTION_TYPE_DRAWABLE = 17,
555 GDK_SELECTION_TYPE_INTEGER = 19,
556 GDK_SELECTION_TYPE_PIXMAP = 20,
557 GDK_SELECTION_TYPE_WINDOW = 33,
558 GDK_SELECTION_TYPE_STRING = 31
563 GDK_EXTENSION_EVENTS_NONE,
564 GDK_EXTENSION_EVENTS_ALL,
565 GDK_EXTENSION_EVENTS_CURSOR
570 GdkIMPreeditArea = 0x0001L,
571 GdkIMPreeditCallbacks = 0x0002L,
572 GdkIMPreeditPosition = 0x0004L,
573 GdkIMPreeditNothing = 0x0008L,
574 GdkIMPreeditNone = 0x0010L,
575 GdkIMStatusArea = 0x0100L,
576 GdkIMStatusCallbacks = 0x0200L,
577 GdkIMStatusNothing = 0x0400L,
578 GdkIMStatusNone = 0x0800L
581 /* The next two enumeration values current match the
582 * Motif constants. If this is changed, the implementation
583 * of gdk_window_set_decorations/gdk_window_set_functions
584 * will need to change as well.
588 GDK_DECOR_ALL = 1 << 0,
589 GDK_DECOR_BORDER = 1 << 1,
590 GDK_DECOR_RESIZEH = 1 << 2,
591 GDK_DECOR_TITLE = 1 << 3,
592 GDK_DECOR_MENU = 1 << 4,
593 GDK_DECOR_MINIMIZE = 1 << 5,
594 GDK_DECOR_MAXIMIZE = 1 << 6
599 GDK_FUNC_ALL = 1 << 0,
600 GDK_FUNC_RESIZE = 1 << 1,
601 GDK_FUNC_MOVE = 1 << 2,
602 GDK_FUNC_MINIMIZE = 1 << 3,
603 GDK_FUNC_MAXIMIZE = 1 << 4,
604 GDK_FUNC_CLOSE = 1 << 5
607 #define GdkIMPreeditMask \
608 ( GdkIMPreeditArea | GdkIMPreeditCallbacks | \
609 GdkIMPreeditPosition | GdkIMPreeditNothing | \
612 #define GdkIMStatusMask \
613 ( GdkIMStatusArea | GdkIMStatusCallbacks | \
614 GdkIMStatusNothing | GdkIMStatusNone )
616 typedef void (*GdkInputFunction) (gpointer data,
618 GdkInputCondition condition);
620 typedef void (*GdkDestroyNotify) (gpointer data);
622 /* Color Context modes.
624 * GDK_CC_MODE_UNDEFINED - unknown
625 * GDK_CC_MODE_BW - default B/W
626 * GDK_CC_MODE_STD_CMAP - has a standard colormap
627 * GDK_CC_MODE_TRUE - is a TrueColor/DirectColor visual
628 * GDK_CC_MODE_MY_GRAY - my grayramp
629 * GDK_CC_MODE_PALETTE - has a pre-allocated palette
634 GDK_CC_MODE_UNDEFINED,
636 GDK_CC_MODE_STD_CMAP,
640 } GdkColorContextMode;
642 /* Types of overlapping between a rectangle and a region
643 * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region
644 * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region
645 * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region
650 GDK_OVERLAP_RECTANGLE_IN,
651 GDK_OVERLAP_RECTANGLE_OUT,
652 GDK_OVERLAP_RECTANGLE_PART
656 * A color consists of red, green and blue values in the
657 * range 0-65535 and a pixel value. The pixel value is highly
658 * dependent on the depth and colormap which this color will
659 * be used to draw into. Therefore, sharing colors between
660 * colormaps is a bad idea.
670 /* The colormap type.
671 * Colormaps consist of 256 colors.
675 GdkColor colors[256];
679 * "type" is the type of visual this is (PseudoColor, TrueColor, etc).
680 * "depth" is the bit depth of this visual.
681 * "colormap_size" is the size of a colormap for this visual.
682 * "bits_per_rgb" is the number of significant bits per red, green and blue.
683 * The red, green and blue masks, shifts and precisions refer
684 * to value needed to calculate pixel values in TrueColor and DirectColor
685 * visuals. The "mask" is the significant bits within the pixel. The
686 * "shift" is the number of bits left we must shift a primary for it
687 * to be in position (according to the "mask"). "prec" refers to how
688 * much precision the pixel value contains for a particular primary.
694 GdkByteOrder byte_order;
711 struct _GdkWindowAttr
718 GdkWindowClass wclass;
720 GdkColormap *colormap;
721 GdkWindowType window_type;
724 gchar *wmclass_class;
725 gboolean override_redirect;
736 GdkVisual *visual; /* visual used to create the image */
737 GdkByteOrder byte_order;
741 guint16 bpp; /* bytes per pixel */
742 guint16 bpl; /* bytes per line */
751 GdkFunction function;
755 GdkPixmap *clip_mask;
756 GdkSubwindowMode subwindow_mode;
761 gint graphics_exposures;
763 GdkLineStyle line_style;
764 GdkCapStyle cap_style;
765 GdkJoinStyle join_style;
807 struct _GdkColorContextDither
809 gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */
810 gint fast_err[32][32][32]; /* internal RGB error information */
811 gint fast_erg[32][32][32];
812 gint fast_erb[32][32][32];
815 struct _GdkColorContext
818 GdkColormap *colormap;
820 gint num_colors; /* available no. of colors in colormap */
821 gint max_colors; /* maximum no. of colors */
822 gint num_allocated; /* no. of allocated colors */
824 GdkColorContextMode mode;
825 gint need_to_free_colormap;
826 GdkAtom std_cmap_atom;
828 gulong *clut; /* color look-up table */
829 GdkColor *cmap; /* colormap */
831 GHashTable *color_hash; /* hash table of allocated colors */
832 GdkColor *palette; /* preallocated palette */
833 gint num_palette; /* size of palette */
835 GdkColorContextDither *fast_dither; /* fast dither matrix */
864 /* Types for XInput support */
869 GdkModifierType modifiers;
872 struct _GdkDeviceInfo
876 GdkInputSource source;
878 gint has_cursor; /* TRUE if the X pointer follows device motion */
880 GdkAxisUse *axes; /* Specifies use for each axis */
895 /* Event filtering */
897 typedef void GdkXEvent; /* Can be cast to XEvent */
899 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
910 struct _GdkEventExpose
916 gint count; /* If non-zero, how many more events follow. */
919 struct _GdkEventNoExpose
924 /* XXX: does anyone need the X major_code or minor_code fields? */
927 struct _GdkEventVisibility
932 GdkVisibilityState state;
935 struct _GdkEventMotion
948 GdkInputSource source;
950 gdouble x_root, y_root;
953 struct _GdkEventButton
966 GdkInputSource source;
968 gdouble x_root, y_root;
983 struct _GdkEventCrossing
988 GdkWindow *subwindow;
989 GdkNotifyType detail;
992 struct _GdkEventFocus
1000 struct _GdkEventConfigure
1010 struct _GdkEventProperty
1020 struct _GdkEventSelection
1032 /* This event type will be used pretty rarely. It only is important
1033 for XInput aware programs that are drawing their own cursor */
1035 struct _GdkEventProximity
1041 GdkInputSource source;
1045 struct _GdkEventDragRequest
1053 guint protocol_version:4;
1056 guint delete_data:1; /* Do *not* delete if link is sent, only
1063 guint8 isdrop; /* This gdk event can be generated by a couple of
1064 X events - this lets the app know whether the
1065 drop really occurred or we just set the data */
1067 GdkPoint drop_coords;
1072 struct _GdkEventDragBegin
1079 guint protocol_version:4;
1086 struct _GdkEventDropEnter
1094 guint protocol_version:4;
1096 guint extended_typelist:1;
1103 struct _GdkEventDropLeave
1111 guint protocol_version:4;
1118 struct _GdkEventDropDataAvailable
1126 guint protocol_version:4;
1132 gchar *data_type; /* MIME type */
1133 gulong data_numbytes;
1139 struct _GdkEventClient
1144 GdkAtom message_type;
1145 gushort data_format;
1153 struct _GdkEventOther
1165 GdkEventExpose expose;
1166 GdkEventNoExpose no_expose;
1167 GdkEventVisibility visibility;
1168 GdkEventMotion motion;
1169 GdkEventButton button;
1171 GdkEventCrossing crossing;
1172 GdkEventFocus focus_change;
1173 GdkEventConfigure configure;
1174 GdkEventProperty property;
1175 GdkEventSelection selection;
1176 GdkEventProximity proximity;
1177 GdkEventDragBegin dragbegin;
1178 GdkEventDragRequest dragrequest;
1179 GdkEventDropEnter dropenter;
1180 GdkEventDropLeave dropleave;
1181 GdkEventDropDataAvailable dropdataavailable;
1182 GdkEventClient client;
1183 GdkEventOther other;
1195 #endif /* __cplusplus */
1198 #endif /* __GDK_TYPES_H__ */