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;
61 typedef struct _GdkEventAny GdkEventAny;
62 typedef struct _GdkEventExpose GdkEventExpose;
63 typedef struct _GdkEventMotion GdkEventMotion;
64 typedef struct _GdkEventButton GdkEventButton;
65 typedef struct _GdkEventKey GdkEventKey;
66 typedef struct _GdkEventFocus GdkEventFocus;
67 typedef struct _GdkEventCrossing GdkEventCrossing;
68 typedef struct _GdkEventConfigure GdkEventConfigure;
69 typedef struct _GdkEventProperty GdkEventProperty;
70 typedef struct _GdkEventSelection GdkEventSelection;
71 typedef struct _GdkEventProximity GdkEventProximity;
72 typedef struct _GdkEventOther GdkEventOther;
73 typedef struct _GdkEventDragBegin GdkEventDragBegin;
74 typedef struct _GdkEventDragRequest GdkEventDragRequest;
75 typedef struct _GdkEventDropEnter GdkEventDropEnter;
76 typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
77 typedef struct _GdkEventDropLeave GdkEventDropLeave;
78 typedef struct _GdkEventClient GdkEventClient;
79 typedef union _GdkEvent GdkEvent;
80 typedef struct _GdkDeviceInfo GdkDeviceInfo;
81 typedef struct _GdkTimeCoord GdkTimeCoord;
82 typedef gint (*GdkEventFunc) (GdkEvent *event,
91 * Root: There is only 1 root window and it is initialized
92 * at startup. Creating a window of type GDK_WINDOW_ROOT
94 * Toplevel: Windows which interact with the window manager.
95 * Child: Windows which are children of some other type of window.
96 * (Any other type of window). Most windows are child windows.
97 * Dialog: A special kind of toplevel window which interacts with
98 * the window manager slightly differently than a regular
99 * toplevel window. Dialog windows should be used for any
101 * Pixmap: Pixmaps are really just another kind of window which
102 * doesn't actually appear on the screen. It can't have
103 * children, either and is really just a convenience so
104 * that the drawing functions can work on both windows
105 * and pixmaps transparently. (ie. You shouldn't pass a
106 * pixmap to any procedure which accepts a window with the
107 * exception of the drawing functions).
119 /* Classes of windows.
120 * InputOutput: Almost every window should be of this type. Such windows
121 * receive events and are also displayed on screen.
122 * InputOnly: Used only in special circumstances when events need to be
123 * stolen from another window or windows. Input only windows
124 * have no visible output, so they are handy for placing over
125 * top of a group of windows in order to grab the events (or
126 * filter the events) from those windows.
135 * Normal: Normal X image type. These are slow as they involve passing
136 * the entire image through the X connection each time a draw
137 * request is required.
138 * Shared: Shared memory X image type. These are fast as the X server
139 * and the program actually use the same piece of memory. They
140 * should be used with care though as there is the possibility
141 * for both the X server and the program to be reading/writing
142 * the image simultaneously and producing undesired results.
161 GDK_VISUAL_STATIC_GRAY,
162 GDK_VISUAL_GRAYSCALE,
163 GDK_VISUAL_STATIC_COLOR,
164 GDK_VISUAL_PSEUDO_COLOR,
165 GDK_VISUAL_TRUE_COLOR,
166 GDK_VISUAL_DIRECT_COLOR
170 * GDK_FONT_FONT: the font is an XFontStruct.
171 * GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
179 /* Window attribute mask values.
180 * GDK_WA_TITLE: The "title" field is valid.
181 * GDK_WA_X: The "x" field is valid.
182 * GDK_WA_Y: The "y" field is valid.
183 * GDK_WA_CURSOR: The "cursor" field is valid.
184 * GDK_WA_COLORMAP: The "colormap" field is valid.
185 * GDK_WA_VISUAL: The "visual" field is valid.
189 GDK_WA_TITLE = 1 << 1,
192 GDK_WA_CURSOR = 1 << 4,
193 GDK_WA_COLORMAP = 1 << 5,
194 GDK_WA_VISUAL = 1 << 6,
195 GDK_WA_WMCLASS = 1 << 7
196 } GdkWindowAttributesType;
198 /* Size restriction enumeration.
202 GDK_HINT_POS = 1 << 0,
203 GDK_HINT_MIN_SIZE = 1 << 1,
204 GDK_HINT_MAX_SIZE = 1 << 2
207 /* GC function types.
208 * Copy: Overwrites destination pixels with the source pixels.
209 * Invert: Inverts the destination pixels.
210 * Xor: Xor's the destination pixels with the source pixels.
241 GDK_LINE_ON_OFF_DASH,
275 #include <gdk/gdkcursors.h>
280 * Nothing: No event occurred.
281 * Delete: A window delete event was sent by the window manager.
282 * The specified window should be deleted.
283 * Destroy: A window has been destroyed.
284 * Expose: Part of a window has been uncovered.
285 * MotionNotify: The mouse has moved.
286 * ButtonPress: A mouse button was pressed.
287 * ButtonRelease: A mouse button was release.
288 * KeyPress: A key was pressed.
289 * KeyRelease: A key was released.
290 * EnterNotify: A window was entered.
291 * LeaveNotify: A window was exited.
292 * FocusChange: The focus window has changed. (The focus window gets
294 * Resize: A window has been resized.
295 * Map: A window has been mapped. (It is now visible on the screen).
296 * Unmap: A window has been unmapped. (It is no longer visible on
305 GDK_MOTION_NOTIFY = 3,
306 GDK_BUTTON_PRESS = 4,
307 GDK_2BUTTON_PRESS = 5,
308 GDK_3BUTTON_PRESS = 6,
309 GDK_BUTTON_RELEASE = 7,
312 GDK_ENTER_NOTIFY = 10,
313 GDK_LEAVE_NOTIFY = 11,
314 GDK_FOCUS_CHANGE = 12,
318 GDK_PROPERTY_NOTIFY = 16,
319 GDK_SELECTION_CLEAR = 17,
320 GDK_SELECTION_REQUEST = 18,
321 GDK_SELECTION_NOTIFY = 19,
322 GDK_PROXIMITY_IN = 20,
323 GDK_PROXIMITY_OUT = 21,
325 GDK_DRAG_REQUEST = 23,
328 GDK_DROP_DATA_AVAIL = 26,
329 GDK_CLIENT_EVENT = 27,
330 GDK_OTHER_EVENT = 9999
333 /* Event masks. (Used to select what types of events a window
338 GDK_EXPOSURE_MASK = 1 << 1,
339 GDK_POINTER_MOTION_MASK = 1 << 2,
340 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
341 GDK_BUTTON_MOTION_MASK = 1 << 4,
342 GDK_BUTTON1_MOTION_MASK = 1 << 5,
343 GDK_BUTTON2_MOTION_MASK = 1 << 6,
344 GDK_BUTTON3_MOTION_MASK = 1 << 7,
345 GDK_BUTTON_PRESS_MASK = 1 << 8,
346 GDK_BUTTON_RELEASE_MASK = 1 << 9,
347 GDK_KEY_PRESS_MASK = 1 << 10,
348 GDK_KEY_RELEASE_MASK = 1 << 11,
349 GDK_ENTER_NOTIFY_MASK = 1 << 12,
350 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
351 GDK_FOCUS_CHANGE_MASK = 1 << 14,
352 GDK_STRUCTURE_MASK = 1 << 15,
353 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
354 GDK_PROXIMITY_IN_MASK = 1 << 17,
355 GDK_PROXIMITY_OUT_MASK = 1 << 18,
356 GDK_ALL_EVENTS_MASK = 0x07FFFF
359 /* Types of enter/leave notifications.
365 * Unknown: An unknown type of enter/leave event occurred.
369 GDK_NOTIFY_ANCESTOR = 0,
370 GDK_NOTIFY_VIRTUAL = 1,
371 GDK_NOTIFY_INFERIOR = 2,
372 GDK_NOTIFY_NONLINEAR = 3,
373 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
374 GDK_NOTIFY_UNKNOWN = 5
377 /* Types of modifiers.
381 GDK_SHIFT_MASK = 1 << 0,
382 GDK_LOCK_MASK = 1 << 1,
383 GDK_CONTROL_MASK = 1 << 2,
384 GDK_MOD1_MASK = 1 << 3,
385 GDK_MOD2_MASK = 1 << 4,
386 GDK_MOD3_MASK = 1 << 5,
387 GDK_MOD4_MASK = 1 << 6,
388 GDK_MOD5_MASK = 1 << 7,
389 GDK_BUTTON1_MASK = 1 << 8,
390 GDK_BUTTON2_MASK = 1 << 9,
391 GDK_BUTTON3_MASK = 1 << 10,
392 GDK_BUTTON4_MASK = 1 << 11,
393 GDK_BUTTON5_MASK = 1 << 12
398 GDK_CLIP_BY_CHILDREN = 0,
399 GDK_INCLUDE_INFERIORS = 1
404 GDK_INPUT_READ = 1 << 0,
405 GDK_INPUT_WRITE = 1 << 1,
406 GDK_INPUT_EXCEPTION = 1 << 2
413 GDK_ERROR_PARAM = -2,
426 GDK_GC_FOREGROUND = 1 << 0,
427 GDK_GC_BACKGROUND = 1 << 1,
428 GDK_GC_FONT = 1 << 2,
429 GDK_GC_FUNCTION = 1 << 3,
430 GDK_GC_FILL = 1 << 4,
431 GDK_GC_TILE = 1 << 5,
432 GDK_GC_STIPPLE = 1 << 6,
433 GDK_GC_CLIP_MASK = 1 << 7,
434 GDK_GC_SUBWINDOW = 1 << 8,
435 GDK_GC_TS_X_ORIGIN = 1 << 9,
436 GDK_GC_TS_Y_ORIGIN = 1 << 10,
437 GDK_GC_CLIP_X_ORIGIN = 1 << 11,
438 GDK_GC_CLIP_Y_ORIGIN = 1 << 12,
439 GDK_GC_EXPOSURES = 1 << 13,
440 GDK_GC_LINE_WIDTH = 1 << 14,
441 GDK_GC_LINE_STYLE = 1 << 15,
442 GDK_GC_CAP_STYLE = 1 << 16,
443 GDK_GC_JOIN_STYLE = 1 << 17
448 GDK_SELECTION_PRIMARY = 1,
449 GDK_SELECTION_SECONDARY = 2
454 GDK_PROPERTY_NEW_VALUE,
460 GDK_PROP_MODE_REPLACE,
461 GDK_PROP_MODE_PREPEND,
465 /* These definitions are for version 1 of the OffiX D&D protocol,
466 taken from <OffiX/DragAndDropTypes.h> */
469 GDK_DNDTYPE_NOTDND = -1,
470 GDK_DNDTYPE_UNKNOWN = 0,
471 GDK_DNDTYPE_RAWDATA = 1,
472 GDK_DNDTYPE_FILE = 2,
473 GDK_DNDTYPE_FILES = 3,
474 GDK_DNDTYPE_TEXT = 4,
476 GDK_DNDTYPE_LINK = 6,
479 GDK_DNDTYPE_MIME = 9,
483 /* Enums for XInput support */
511 /* The next two types define enums for predefined atoms relating
512 to selections. In general, one will need to use gdk_intern_atom */
516 GDK_TARGET_BITMAP = 5,
517 GDK_TARGET_COLORMAP = 7,
518 GDK_TARGET_DRAWABLE = 17,
519 GDK_TARGET_PIXMAP = 20,
520 GDK_TARGET_STRING = 31
525 GDK_SELECTION_TYPE_ATOM = 4,
526 GDK_SELECTION_TYPE_BITMAP = 5,
527 GDK_SELECTION_TYPE_COLORMAP = 7,
528 GDK_SELECTION_TYPE_DRAWABLE = 17,
529 GDK_SELECTION_TYPE_INTEGER = 19,
530 GDK_SELECTION_TYPE_PIXMAP = 20,
531 GDK_SELECTION_TYPE_WINDOW = 33,
532 GDK_SELECTION_TYPE_STRING = 31
537 GDK_EXTENSION_EVENTS_NONE,
538 GDK_EXTENSION_EVENTS_ALL,
539 GDK_EXTENSION_EVENTS_CURSOR
548 GdkIMPreeditArea = 0x0001L,
549 GdkIMPreeditCallbacks = 0x0002L,
550 GdkIMPreeditPosition = 0x0004L,
551 GdkIMPreeditNothing = 0x0008L,
552 GdkIMPreeditNone = 0x0010L,
553 GdkIMStatusArea = 0x0100L,
554 GdkIMStatusCallbacks = 0x0200L,
555 GdkIMStatusNothing = 0x0400L,
556 GdkIMStatusNone = 0x0800L
559 #define GdkIMPreeditMask \
560 ( GdkIMPreeditArea | GdkIMPreeditCallbacks | \
561 GdkIMPreeditPosition | GdkIMPreeditNothing | \
564 #define GdkIMStatusMask \
565 ( GdkIMStatusArea | GdkIMStatusCallbacks | \
566 GdkIMStatusNothing | GdkIMStatusNone )
570 typedef void (*GdkInputFunction) (gpointer data,
572 GdkInputCondition condition);
575 * A color consists of red, green and blue values in the
576 * range 0-65535 and a pixel value. The pixel value is highly
577 * dependent on the depth and colormap which this color will
578 * be used to draw into. Therefore, sharing colors between
579 * colormaps is a bad idea.
589 /* The colormap type.
590 * Colormaps consist of 256 colors.
594 GdkColor colors[256];
598 * "type" is the type of visual this is (PseudoColor, TrueColor, etc).
599 * "depth" is the bit depth of this visual.
600 * "colormap_size" is the size of a colormap for this visual.
601 * "bits_per_rgb" is the number of significant bits per red, green and blue.
602 * The red, green and blue masks, shifts and precisions refer
603 * to value needed to calculate pixel values in TrueColor and DirectColor
604 * visuals. The "mask" is the significant bits within the pixel. The
605 * "shift" is the number of bits left we must shift a primary for it
606 * to be in position (according to the "mask"). "prec" refers to how
607 * much precision the pixel value contains for a particular primary.
613 GdkByteOrder byte_order;
630 struct _GdkWindowAttr
637 GdkWindowClass wclass;
639 GdkColormap *colormap;
640 GdkWindowType window_type;
643 gchar *wmclass_class;
654 GdkVisual *visual; /* visual used to create the image */
655 GdkByteOrder byte_order;
659 guint16 bpp; /* bytes per pixel */
660 guint16 bpl; /* bytes per line */
669 GdkFunction function;
673 GdkPixmap *clip_mask;
674 GdkSubwindowMode subwindow_mode;
679 gint graphics_exposures;
681 GdkLineStyle line_style;
682 GdkCapStyle cap_style;
683 GdkJoinStyle join_style;
725 /* Types for XInput support */
727 struct _GdkDeviceInfo
731 GdkInputSource source;
733 gint has_cursor; /* TRUE if the X pointer follows device motion */
735 GdkAxisUse *axes; /* Specifies use for each axis */
755 struct _GdkEventExpose
760 gint count; /* If non-zero, how many more events follow. */
763 struct _GdkEventMotion
775 GdkInputSource source;
779 struct _GdkEventButton
791 GdkInputSource source;
806 struct _GdkEventCrossing
810 GdkWindow *subwindow;
811 GdkNotifyType detail;
814 struct _GdkEventFocus
821 struct _GdkEventConfigure
830 struct _GdkEventProperty
839 struct _GdkEventSelection
850 /* This event type will be used pretty rarely. It only is important
851 for XInput aware programs that are drawing their own cursor */
853 struct _GdkEventProximity
858 GdkInputSource source;
862 struct _GdkEventDragRequest
869 guint protocol_version:4;
872 guint delete_data:1; /* Do *not* delete if link is sent, only
879 guint8 isdrop; /* This gdk event can be generated by a couple of
880 X events - this lets the app know whether the
881 drop really occurred or we just set the data */
883 GdkPoint drop_coords;
887 struct _GdkEventDragBegin
893 guint protocol_version:4;
900 struct _GdkEventDropEnter
907 guint protocol_version:4;
909 guint extended_typelist:1;
916 struct _GdkEventDropLeave
923 guint protocol_version:4;
930 struct _GdkEventDropDataAvailable
937 guint protocol_version:4;
943 gchar *data_type; /* MIME type */
944 gulong data_numbytes;
948 struct _GdkEventClient
952 GdkAtom message_type;
961 typedef void GdkXEvent; /* Can be cast to XEvent */
963 struct _GdkEventOther
974 GdkEventExpose expose;
975 GdkEventMotion motion;
976 GdkEventButton button;
978 GdkEventCrossing crossing;
979 GdkEventFocus focus_change;
980 GdkEventConfigure configure;
981 GdkEventProperty property;
982 GdkEventSelection selection;
983 GdkEventProximity proximity;
984 GdkEventDragBegin dragbegin;
985 GdkEventDragRequest dragrequest;
986 GdkEventDropEnter dropenter;
987 GdkEventDropLeave dropleave;
988 GdkEventDropDataAvailable dropdataavailable;
989 GdkEventClient client;
996 #endif /* __cplusplus */
999 #endif /* __GDK_TYPES_H__ */