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,
87 * Root: There is only 1 root window and it is initialized
88 * at startup. Creating a window of type GDK_WINDOW_ROOT
90 * Toplevel: Windows which interact with the window manager.
91 * Child: Windows which are children of some other type of window.
92 * (Any other type of window). Most windows are child windows.
93 * Dialog: A special kind of toplevel window which interacts with
94 * the window manager slightly differently than a regular
95 * toplevel window. Dialog windows should be used for any
97 * Pixmap: Pixmaps are really just another kind of window which
98 * doesn't actually appear on the screen. It can't have
99 * children, either and is really just a convenience so
100 * that the drawing functions can work on both windows
101 * and pixmaps transparently. (ie. You shouldn't pass a
102 * pixmap to any procedure which accepts a window with the
103 * exception of the drawing functions).
115 /* Classes of windows.
116 * InputOutput: Almost every window should be of this type. Such windows
117 * receive events and are also displayed on screen.
118 * InputOnly: Used only in special circumstances when events need to be
119 * stolen from another window or windows. Input only windows
120 * have no visible output, so they are handy for placing over
121 * top of a group of windows in order to grab the events (or
122 * filter the events) from those windows.
131 * Normal: Normal X image type. These are slow as they involve passing
132 * the entire image through the X connection each time a draw
133 * request is required.
134 * Shared: Shared memory X image type. These are fast as the X server
135 * and the program actually use the same piece of memory. They
136 * should be used with care though as there is the possibility
137 * for both the X server and the program to be reading/writing
138 * the image simultaneously and producing undesired results.
157 GDK_VISUAL_STATIC_GRAY,
158 GDK_VISUAL_GRAYSCALE,
159 GDK_VISUAL_STATIC_COLOR,
160 GDK_VISUAL_PSEUDO_COLOR,
161 GDK_VISUAL_TRUE_COLOR,
162 GDK_VISUAL_DIRECT_COLOR
166 * GDK_FONT_FONT: the font is an XFontStruct.
167 * GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
175 /* Window attribute mask values.
176 * GDK_WA_TITLE: The "title" field is valid.
177 * GDK_WA_X: The "x" field is valid.
178 * GDK_WA_Y: The "y" field is valid.
179 * GDK_WA_CURSOR: The "cursor" field is valid.
180 * GDK_WA_COLORMAP: The "colormap" field is valid.
181 * GDK_WA_VISUAL: The "visual" field is valid.
185 GDK_WA_TITLE = 1 << 1,
188 GDK_WA_CURSOR = 1 << 4,
189 GDK_WA_COLORMAP = 1 << 5,
190 GDK_WA_VISUAL = 1 << 6,
191 GDK_WA_WMCLASS = 1 << 7
192 } GdkWindowAttributesType;
194 /* Size restriction enumeration.
198 GDK_HINT_POS = 1 << 0,
199 GDK_HINT_MIN_SIZE = 1 << 1,
200 GDK_HINT_MAX_SIZE = 1 << 2
203 /* GC function types.
204 * Copy: Overwrites destination pixels with the source pixels.
205 * Invert: Inverts the destination pixels.
206 * Xor: Xor's the destination pixels with the source pixels.
237 GDK_LINE_ON_OFF_DASH,
271 #include <gdk/gdkcursors.h>
276 * Nothing: No event occurred.
277 * Delete: A window delete event was sent by the window manager.
278 * The specified window should be deleted.
279 * Destroy: A window has been destroyed.
280 * Expose: Part of a window has been uncovered.
281 * MotionNotify: The mouse has moved.
282 * ButtonPress: A mouse button was pressed.
283 * ButtonRelease: A mouse button was release.
284 * KeyPress: A key was pressed.
285 * KeyRelease: A key was released.
286 * EnterNotify: A window was entered.
287 * LeaveNotify: A window was exited.
288 * FocusChange: The focus window has changed. (The focus window gets
290 * Resize: A window has been resized.
291 * Map: A window has been mapped. (It is now visible on the screen).
292 * Unmap: A window has been unmapped. (It is no longer visible on
301 GDK_MOTION_NOTIFY = 3,
302 GDK_BUTTON_PRESS = 4,
303 GDK_2BUTTON_PRESS = 5,
304 GDK_3BUTTON_PRESS = 6,
305 GDK_BUTTON_RELEASE = 7,
308 GDK_ENTER_NOTIFY = 10,
309 GDK_LEAVE_NOTIFY = 11,
310 GDK_FOCUS_CHANGE = 12,
314 GDK_PROPERTY_NOTIFY = 16,
315 GDK_SELECTION_CLEAR = 17,
316 GDK_SELECTION_REQUEST = 18,
317 GDK_SELECTION_NOTIFY = 19,
318 GDK_PROXIMITY_IN = 20,
319 GDK_PROXIMITY_OUT = 21,
321 GDK_DRAG_REQUEST = 23,
324 GDK_DROP_DATA_AVAIL = 26,
325 GDK_CLIENT_EVENT = 27,
326 GDK_OTHER_EVENT = 9999
329 /* Event masks. (Used to select what types of events a window
334 GDK_EXPOSURE_MASK = 1 << 1,
335 GDK_POINTER_MOTION_MASK = 1 << 2,
336 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
337 GDK_BUTTON_MOTION_MASK = 1 << 4,
338 GDK_BUTTON1_MOTION_MASK = 1 << 5,
339 GDK_BUTTON2_MOTION_MASK = 1 << 6,
340 GDK_BUTTON3_MOTION_MASK = 1 << 7,
341 GDK_BUTTON_PRESS_MASK = 1 << 8,
342 GDK_BUTTON_RELEASE_MASK = 1 << 9,
343 GDK_KEY_PRESS_MASK = 1 << 10,
344 GDK_KEY_RELEASE_MASK = 1 << 11,
345 GDK_ENTER_NOTIFY_MASK = 1 << 12,
346 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
347 GDK_FOCUS_CHANGE_MASK = 1 << 14,
348 GDK_STRUCTURE_MASK = 1 << 15,
349 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
350 GDK_PROXIMITY_IN_MASK = 1 << 17,
351 GDK_PROXIMITY_OUT_MASK = 1 << 18,
352 GDK_ALL_EVENTS_MASK = 0x07FFFF
355 /* Types of enter/leave notifications.
361 * Unknown: An unknown type of enter/leave event occurred.
365 GDK_NOTIFY_ANCESTOR = 0,
366 GDK_NOTIFY_VIRTUAL = 1,
367 GDK_NOTIFY_INFERIOR = 2,
368 GDK_NOTIFY_NONLINEAR = 3,
369 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
370 GDK_NOTIFY_UNKNOWN = 5
373 /* Types of modifiers.
377 GDK_SHIFT_MASK = 1 << 0,
378 GDK_LOCK_MASK = 1 << 1,
379 GDK_CONTROL_MASK = 1 << 2,
380 GDK_MOD1_MASK = 1 << 3,
381 GDK_MOD2_MASK = 1 << 4,
382 GDK_MOD3_MASK = 1 << 5,
383 GDK_MOD4_MASK = 1 << 6,
384 GDK_MOD5_MASK = 1 << 7,
385 GDK_BUTTON1_MASK = 1 << 8,
386 GDK_BUTTON2_MASK = 1 << 9,
387 GDK_BUTTON3_MASK = 1 << 10,
388 GDK_BUTTON4_MASK = 1 << 11,
389 GDK_BUTTON5_MASK = 1 << 12
394 GDK_CLIP_BY_CHILDREN = 0,
395 GDK_INCLUDE_INFERIORS = 1
400 GDK_INPUT_READ = 1 << 0,
401 GDK_INPUT_WRITE = 1 << 1,
402 GDK_INPUT_EXCEPTION = 1 << 2
409 GDK_ERROR_PARAM = -2,
422 GDK_GC_FOREGROUND = 1 << 0,
423 GDK_GC_BACKGROUND = 1 << 1,
424 GDK_GC_FONT = 1 << 2,
425 GDK_GC_FUNCTION = 1 << 3,
426 GDK_GC_FILL = 1 << 4,
427 GDK_GC_TILE = 1 << 5,
428 GDK_GC_STIPPLE = 1 << 6,
429 GDK_GC_CLIP_MASK = 1 << 7,
430 GDK_GC_SUBWINDOW = 1 << 8,
431 GDK_GC_TS_X_ORIGIN = 1 << 9,
432 GDK_GC_TS_Y_ORIGIN = 1 << 10,
433 GDK_GC_CLIP_X_ORIGIN = 1 << 11,
434 GDK_GC_CLIP_Y_ORIGIN = 1 << 12,
435 GDK_GC_EXPOSURES = 1 << 13,
436 GDK_GC_LINE_WIDTH = 1 << 14,
437 GDK_GC_LINE_STYLE = 1 << 15,
438 GDK_GC_CAP_STYLE = 1 << 16,
439 GDK_GC_JOIN_STYLE = 1 << 17
444 GDK_SELECTION_PRIMARY = 1,
445 GDK_SELECTION_SECONDARY = 2
450 GDK_PROPERTY_NEW_VALUE,
456 GDK_PROP_MODE_REPLACE,
457 GDK_PROP_MODE_PREPEND,
461 /* These definitions are for version 1 of the OffiX D&D protocol,
462 taken from <OffiX/DragAndDropTypes.h> */
465 GDK_DNDTYPE_NOTDND = -1,
466 GDK_DNDTYPE_UNKNOWN = 0,
467 GDK_DNDTYPE_RAWDATA = 1,
468 GDK_DNDTYPE_FILE = 2,
469 GDK_DNDTYPE_FILES = 3,
470 GDK_DNDTYPE_TEXT = 4,
472 GDK_DNDTYPE_LINK = 6,
475 GDK_DNDTYPE_MIME = 9,
479 /* Enums for XInput support */
507 /* The next two types define enums for predefined atoms relating
508 to selections. In general, one will need to use gdk_intern_atom */
512 GDK_TARGET_BITMAP = 5,
513 GDK_TARGET_COLORMAP = 7,
514 GDK_TARGET_DRAWABLE = 17,
515 GDK_TARGET_PIXMAP = 20,
516 GDK_TARGET_STRING = 31
521 GDK_SELECTION_TYPE_ATOM = 4,
522 GDK_SELECTION_TYPE_BITMAP = 5,
523 GDK_SELECTION_TYPE_COLORMAP = 7,
524 GDK_SELECTION_TYPE_DRAWABLE = 17,
525 GDK_SELECTION_TYPE_INTEGER = 19,
526 GDK_SELECTION_TYPE_PIXMAP = 20,
527 GDK_SELECTION_TYPE_WINDOW = 33,
528 GDK_SELECTION_TYPE_STRING = 31
533 GDK_EXTENSION_EVENTS_NONE,
534 GDK_EXTENSION_EVENTS_ALL,
535 GDK_EXTENSION_EVENTS_CURSOR
538 typedef void (*GdkInputFunction) (gpointer data,
540 GdkInputCondition condition);
543 * A color consists of red, green and blue values in the
544 * range 0-65535 and a pixel value. The pixel value is highly
545 * dependent on the depth and colormap which this color will
546 * be used to draw into. Therefore, sharing colors between
547 * colormaps is a bad idea.
557 /* The colormap type.
558 * Colormaps consist of 256 colors.
562 GdkColor colors[256];
566 * "type" is the type of visual this is (PseudoColor, TrueColor, etc).
567 * "depth" is the bit depth of this visual.
568 * "colormap_size" is the size of a colormap for this visual.
569 * "bits_per_rgb" is the number of significant bits per red, green and blue.
570 * The red, green and blue masks, shifts and precisions refer
571 * to value needed to calculate pixel values in TrueColor and DirectColor
572 * visuals. The "mask" is the significant bits within the pixel. The
573 * "shift" is the number of bits left we must shift a primary for it
574 * to be in position (according to the "mask"). "prec" refers to how
575 * much precision the pixel value contains for a particular primary.
581 GdkByteOrder byte_order;
598 struct _GdkWindowAttr
605 GdkWindowClass wclass;
607 GdkColormap *colormap;
608 GdkWindowType window_type;
611 gchar *wmclass_class;
622 GdkVisual *visual; /* visual used to create the image */
623 GdkByteOrder byte_order;
627 guint16 bpp; /* bytes per pixel */
628 guint16 bpl; /* bytes per line */
637 GdkFunction function;
641 GdkPixmap *clip_mask;
642 GdkSubwindowMode subwindow_mode;
647 gint graphics_exposures;
649 GdkLineStyle line_style;
650 GdkCapStyle cap_style;
651 GdkJoinStyle join_style;
693 /* Types for XInput support */
695 struct _GdkDeviceInfo
699 GdkInputSource source;
701 gint has_cursor; /* TRUE if the X pointer follows device motion */
703 GdkAxisUse *axes; /* Specifies use for each axis */
723 struct _GdkEventExpose
728 gint count; /* If non-zero, how many more events follow. */
731 struct _GdkEventMotion
743 GdkInputSource source;
747 struct _GdkEventButton
759 GdkInputSource source;
772 struct _GdkEventCrossing
776 GdkWindow *subwindow;
777 GdkNotifyType detail;
780 struct _GdkEventFocus
787 struct _GdkEventConfigure
796 struct _GdkEventProperty
805 struct _GdkEventSelection
816 /* This event type will be used pretty rarely. It only is important
817 for XInput aware programs that are drawing their own cursor */
819 struct _GdkEventProximity
824 GdkInputSource source;
828 struct _GdkEventDragRequest
835 guint protocol_version:4;
838 guint delete_data:1; /* Do *not* delete if link is sent, only
845 guint8 isdrop; /* This gdk event can be generated by a couple of
846 X events - this lets the app know whether the
847 drop really occurred or we just set the data */
849 GdkPoint drop_coords;
853 struct _GdkEventDragBegin
859 guint protocol_version:4;
866 struct _GdkEventDropEnter
873 guint protocol_version:4;
875 guint extended_typelist:1;
882 struct _GdkEventDropLeave
889 guint protocol_version:4;
896 struct _GdkEventDropDataAvailable
903 guint protocol_version:4;
909 gchar *data_type; /* MIME type */
910 gulong data_numbytes;
914 struct _GdkEventClient
918 GdkAtom message_type;
931 struct _GdkEventOther
942 GdkEventExpose expose;
943 GdkEventMotion motion;
944 GdkEventButton button;
946 GdkEventCrossing crossing;
947 GdkEventFocus focus_change;
948 GdkEventConfigure configure;
949 GdkEventProperty property;
950 GdkEventSelection selection;
951 GdkEventProximity proximity;
952 GdkEventDragBegin dragbegin;
953 GdkEventDragRequest dragrequest;
954 GdkEventDropEnter dropenter;
955 GdkEventDropLeave dropleave;
956 GdkEventDropDataAvailable dropdataavailable;
957 GdkEventClient client;
964 #endif /* __cplusplus */
967 #endif /* __GDK_TYPES_H__ */