]> Pileus Git - ~andy/gtk/blob - gdk/gdktypes.h
Minor cleanups.
[~andy/gtk] / gdk / gdktypes.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
17  */
18 #ifndef __GDK_TYPES_H__
19 #define __GDK_TYPES_H__
20
21
22 /* GDK uses "glib". (And so does GTK).
23  */
24 #include <glib.h>
25
26
27 #define GDK_NONE             0L
28 #define GDK_CURRENT_TIME     0L
29 #define GDK_PARENT_RELATIVE  1L
30
31 /* special deviceid for core pointer events */
32 #define GDK_CORE_POINTER 0xfedc
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38
39
40 /* Type definitions for the basic structures.
41  */
42
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;
62
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,
88                               gpointer  data);
89
90 typedef void*                     GdkIC;
91 typedef void*                     GdkIM;
92
93
94 /* Types of windows.
95  *   Root: There is only 1 root window and it is initialized
96  *         at startup. Creating a window of type GDK_WINDOW_ROOT
97  *         is an error.
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
104  *           transient window.
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).
112  */
113 typedef enum
114 {
115   GDK_WINDOW_ROOT,
116   GDK_WINDOW_TOPLEVEL,
117   GDK_WINDOW_CHILD,
118   GDK_WINDOW_DIALOG,
119   GDK_WINDOW_TEMP,
120   GDK_WINDOW_PIXMAP
121 } GdkWindowType;
122
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.
131  */
132 typedef enum
133 {
134   GDK_INPUT_OUTPUT,
135   GDK_INPUT_ONLY
136 } GdkWindowClass;
137
138 /* Types of images.
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.
147  */
148 typedef enum
149 {
150   GDK_IMAGE_NORMAL,
151   GDK_IMAGE_SHARED,
152   GDK_IMAGE_FASTEST
153 } GdkImageType;
154
155 /* Types of visuals.
156  *   StaticGray:
157  *   Grayscale:
158  *   StaticColor:
159  *   PseudoColor:
160  *   TrueColor:
161  *   DirectColor:
162  */
163 typedef enum
164 {
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
171 } GdkVisualType;
172
173 /* Types of font.
174  *   GDK_FONT_FONT: the font is an XFontStruct.
175  *   GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
176  */
177 typedef enum
178 {
179   GDK_FONT_FONT,
180   GDK_FONT_FONTSET
181 } GdkFontType;
182
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.
190  */
191 typedef enum
192 {
193   GDK_WA_TITLE    = 1 << 1,
194   GDK_WA_X        = 1 << 2,
195   GDK_WA_Y        = 1 << 3,
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;
202
203 /* Size restriction enumeration.
204  */
205 typedef enum
206 {
207   GDK_HINT_POS       = 1 << 0,
208   GDK_HINT_MIN_SIZE  = 1 << 1,
209   GDK_HINT_MAX_SIZE  = 1 << 2
210 } GdkWindowHints;
211
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.
216  */
217 typedef enum
218 {
219   GDK_COPY,
220   GDK_INVERT,
221   GDK_XOR
222 } GdkFunction;
223
224 /* GC fill types.
225  *  Solid:
226  *  Tiled:
227  *  Stippled:
228  *  OpaqueStippled:
229  */
230 typedef enum
231 {
232   GDK_SOLID,
233   GDK_TILED,
234   GDK_STIPPLED,
235   GDK_OPAQUE_STIPPLED
236 } GdkFill;
237
238 /* GC line styles
239  *  Solid:
240  *  OnOffDash:
241  *  DoubleDash:
242  */
243 typedef enum
244 {
245   GDK_LINE_SOLID,
246   GDK_LINE_ON_OFF_DASH,
247   GDK_LINE_DOUBLE_DASH
248 } GdkLineStyle;
249
250 /* GC cap styles
251  *  CapNotLast:
252  *  CapButt:
253  *  CapRound:
254  *  CapProjecting:
255  */
256 typedef enum
257 {
258   GDK_CAP_NOT_LAST,
259   GDK_CAP_BUTT,
260   GDK_CAP_ROUND,
261   GDK_CAP_PROJECTING
262 } GdkCapStyle;
263
264 /* GC join styles
265  *  JoinMiter:
266  *  JoinRound:
267  *  JoinBevel:
268  */
269 typedef enum
270 {
271   GDK_JOIN_MITER,
272   GDK_JOIN_ROUND,
273   GDK_JOIN_BEVEL
274 } GdkJoinStyle;
275
276 /* Cursor types.
277  */
278 typedef enum
279 {
280 #include <gdk/gdkcursors.h>
281   GDK_LAST_CURSOR,
282   GDK_CURSOR_IS_PIXMAP = -1
283 } GdkCursorType;
284
285 typedef enum {
286   GDK_FILTER_CONTINUE,    /* Event not handled, continue processesing */
287   GDK_FILTER_TRANSLATE,   /* Translated event stored */
288   GDK_FILTER_REMOVE       /* Terminate processing, removing event */
289 } GdkFilterReturn;
290
291 typedef enum {
292   GDK_VISIBILITY_UNOBSCURED,
293   GDK_VISIBILITY_PARTIAL,
294   GDK_VISIBILITY_FULLY_OBSCURED
295 } GdkVisibilityState;
296
297 /* Event types.
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
313  *                keyboard events).
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
317  *          the screen).
318  */
319 typedef enum
320 {
321   GDK_NOTHING           = -1,
322   GDK_DELETE            = 0,
323   GDK_DESTROY           = 1,
324   GDK_EXPOSE            = 2,
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,
330   GDK_KEY_PRESS         = 8,
331   GDK_KEY_RELEASE       = 9,
332   GDK_ENTER_NOTIFY      = 10,
333   GDK_LEAVE_NOTIFY      = 11,
334   GDK_FOCUS_CHANGE      = 12,
335   GDK_CONFIGURE         = 13,
336   GDK_MAP               = 14,
337   GDK_UNMAP             = 15,
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,
344   GDK_DRAG_BEGIN        = 22,
345   GDK_DRAG_REQUEST      = 23,
346   GDK_DROP_ENTER        = 24,
347   GDK_DROP_LEAVE        = 25,
348   GDK_DROP_DATA_AVAIL   = 26,
349   GDK_CLIENT_EVENT      = 27,
350   GDK_VISIBILITY_NOTIFY = 28,
351   GDK_NO_EXPOSE         = 29,
352   GDK_OTHER_EVENT       = 9999  /* Deprecated, use filters instead */
353 } GdkEventType;
354
355 /* Event masks. (Used to select what types of events a window
356  *  will receive).
357  */
358 typedef enum
359 {
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
380 } GdkEventMask;
381
382 /* Types of enter/leave notifications.
383  *   Ancestor:
384  *   Virtual:
385  *   Inferior:
386  *   Nonlinear:
387  *   NonlinearVirtual:
388  *   Unknown: An unknown type of enter/leave event occurred.
389  */
390 typedef enum
391 {
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
398 } GdkNotifyType;
399
400 /* Types of modifiers.
401  */
402 typedef enum
403 {
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
417 } GdkModifierType;
418
419 typedef enum
420 {
421   GDK_CLIP_BY_CHILDREN  = 0,
422   GDK_INCLUDE_INFERIORS = 1
423 } GdkSubwindowMode;
424
425 typedef enum
426 {
427   GDK_INPUT_READ       = 1 << 0,
428   GDK_INPUT_WRITE      = 1 << 1,
429   GDK_INPUT_EXCEPTION  = 1 << 2
430 } GdkInputCondition;
431
432 typedef enum
433 {
434   GDK_OK          = 0,
435   GDK_ERROR       = -1,
436   GDK_ERROR_PARAM = -2,
437   GDK_ERROR_FILE  = -3,
438   GDK_ERROR_MEM   = -4
439 } GdkStatus;
440
441 typedef enum
442 {
443   GDK_LSB_FIRST,
444   GDK_MSB_FIRST
445 } GdkByteOrder;
446
447 typedef enum
448 {
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
467 } GdkGCValuesMask;
468
469 typedef enum
470 {
471   GDK_SELECTION_PRIMARY = 1,
472   GDK_SELECTION_SECONDARY = 2
473 } GdkSelection;
474
475 typedef enum
476 {
477   GDK_PROPERTY_NEW_VALUE,
478   GDK_PROPERTY_DELETE
479 } GdkPropertyState;
480
481 typedef enum
482 {
483   GDK_PROP_MODE_REPLACE,
484   GDK_PROP_MODE_PREPEND,
485   GDK_PROP_MODE_APPEND
486 } GdkPropMode;
487
488 /* These definitions are for version 1 of the OffiX D&D protocol,
489    taken from <OffiX/DragAndDropTypes.h> */
490 typedef enum
491 {
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,
498   GDK_DNDTYPE_DIR = 5,
499   GDK_DNDTYPE_LINK = 6,
500   GDK_DNDTYPE_EXE = 7,
501   GDK_DNDTYPE_URL = 8,
502   GDK_DNDTYPE_MIME = 9,
503   GDK_DNDTYPE_END = 10
504 } GdkDndType;
505
506 /* Enums for XInput support */
507
508 typedef enum
509 {
510   GDK_SOURCE_MOUSE,
511   GDK_SOURCE_PEN,
512   GDK_SOURCE_ERASER,
513   GDK_SOURCE_CURSOR
514 } GdkInputSource;
515
516 typedef enum
517 {
518   GDK_MODE_DISABLED,
519   GDK_MODE_SCREEN,
520   GDK_MODE_WINDOW
521 } GdkInputMode;
522
523 typedef enum
524 {
525   GDK_AXIS_IGNORE,
526   GDK_AXIS_X,
527   GDK_AXIS_Y,
528   GDK_AXIS_PRESSURE,
529   GDK_AXIS_XTILT,
530   GDK_AXIS_YTILT,
531   GDK_AXIS_LAST
532 } GdkAxisUse;
533
534 /* The next two types define enums for predefined atoms relating
535    to selections. In general, one will need to use gdk_intern_atom */
536
537 typedef enum
538 {
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
544 } GdkTarget;
545
546 typedef enum
547 {
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
556 } GdkSelectionType;
557
558 typedef enum
559 {
560   GDK_EXTENSION_EVENTS_NONE,
561   GDK_EXTENSION_EVENTS_ALL,
562   GDK_EXTENSION_EVENTS_CURSOR
563 } GdkExtensionMode;
564
565 typedef enum
566 {
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
576 } GdkIMStyle;
577
578 #define GdkIMPreeditMask \
579         ( GdkIMPreeditArea     | GdkIMPreeditCallbacks | \
580           GdkIMPreeditPosition | GdkIMPreeditNothing | \
581           GdkIMPreeditNone )
582
583 #define GdkIMStatusMask \
584         ( GdkIMStatusArea | GdkIMStatusCallbacks | \
585           GdkIMStatusNothing | GdkIMStatusNone )
586
587 typedef void (*GdkInputFunction) (gpointer          data,
588                                   gint              source,
589                                   GdkInputCondition condition);
590
591 typedef void (*GdkDestroyNotify) (gpointer data);
592
593 /* Color Context modes.
594  *
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
601  */ 
602
603 typedef enum
604 {
605   GDK_CC_MODE_UNDEFINED,
606   GDK_CC_MODE_BW,
607   GDK_CC_MODE_STD_CMAP,
608   GDK_CC_MODE_TRUE,
609   GDK_CC_MODE_MY_GRAY,
610   GDK_CC_MODE_PALETTE
611 } GdkColorContextMode;
612
613 /* The color type.
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.
619  */
620 struct _GdkColor
621 {
622   gulong  pixel;
623   gushort red;
624   gushort green;
625   gushort blue;
626 };
627
628 /* The colormap type.
629  *   Colormaps consist of 256 colors.
630  */
631 struct _GdkColormap
632 {
633   GdkColor colors[256];
634 };
635
636 /* The visual type.
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.
647  */
648 struct _GdkVisual
649 {
650   GdkVisualType type;
651   gint depth;
652   GdkByteOrder byte_order;
653   gint colormap_size;
654   gint bits_per_rgb;
655
656   guint32 red_mask;
657   gint red_shift;
658   gint red_prec;
659
660   guint32 green_mask;
661   gint green_shift;
662   gint green_prec;
663
664   guint32 blue_mask;
665   gint blue_shift;
666   gint blue_prec;
667 };
668
669 struct _GdkWindowAttr
670 {
671   gchar *title;
672   gint event_mask;
673   gint16 x, y;
674   gint16 width;
675   gint16 height;
676   GdkWindowClass wclass;
677   GdkVisual *visual;
678   GdkColormap *colormap;
679   GdkWindowType window_type;
680   GdkCursor *cursor;
681   gchar *wmclass_name;
682   gchar *wmclass_class;
683   gboolean override_redirect;
684 };
685
686 struct _GdkWindow
687 {
688   gpointer user_data;
689 };
690
691 struct _GdkImage
692 {
693   GdkImageType  type;
694   GdkVisual    *visual;     /* visual used to create the image */
695   GdkByteOrder  byte_order;
696   guint16       width;
697   guint16       height;
698   guint16       depth;
699   guint16       bpp;        /* bytes per pixel */
700   guint16       bpl;        /* bytes per line */
701   gpointer      mem;
702 };
703
704 struct _GdkGCValues
705 {
706   GdkColor          foreground;
707   GdkColor          background;
708   GdkFont          *font;
709   GdkFunction       function;
710   GdkFill           fill;
711   GdkPixmap        *tile;
712   GdkPixmap        *stipple;
713   GdkPixmap        *clip_mask;
714   GdkSubwindowMode  subwindow_mode;
715   gint              ts_x_origin;
716   gint              ts_y_origin;
717   gint              clip_x_origin;
718   gint              clip_y_origin;
719   gint              graphics_exposures;
720   gint              line_width;
721   GdkLineStyle      line_style;
722   GdkCapStyle       cap_style;
723   GdkJoinStyle      join_style;
724 };
725
726 struct _GdkGC
727 {
728   gint dummy_var;
729 };
730
731 struct _GdkPoint
732 {
733   gint16 x;
734   gint16 y;
735 };
736
737 struct _GdkRectangle
738 {
739   gint16 x;
740   gint16 y;
741   guint16 width;
742   guint16 height;
743 };
744
745 struct _GdkSegment
746 {
747   gint16 x1;
748   gint16 y1;
749   gint16 x2;
750   gint16 y2;
751 };
752
753 struct _GdkFont
754 {
755   GdkFontType type;
756   gint ascent;
757   gint descent;
758 };
759
760 struct _GdkCursor
761 {
762   GdkCursorType type;
763 };
764
765 struct _GdkColorContextDither
766 {
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];
771 };
772
773 struct _GdkColorContext
774 {
775   GdkVisual *visual;
776   GdkColormap *colormap;
777
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 */
781
782   GdkColorContextMode mode;
783   gint need_to_free_colormap;
784   GdkAtom std_cmap_atom;
785
786   gulong *clut;                 /* color look-up table */
787   GdkColor *cmap;               /* colormap */
788
789   GHashTable *color_hash;       /* hash table of allocated colors */
790   GdkColor *palette;            /* preallocated palette */
791   gint num_palette;             /* size of palette */
792
793   GdkColorContextDither *fast_dither;   /* fast dither matrix */
794
795   struct
796   {
797     gint red;
798     gint green;
799     gint blue;
800   } shifts;
801
802   struct
803   {
804     gulong red;
805     gulong green;
806     gulong blue;
807   } masks;
808
809   struct
810   {
811     gint red;
812     gint green;
813     gint blue;
814   } bits;
815
816   gulong max_entry;
817
818   gulong black_pixel;
819   gulong white_pixel;
820 };
821
822 /* Types for XInput support */
823
824 struct _GdkDeviceKey
825 {
826   guint keyval;
827   GdkModifierType modifiers;
828 };
829
830 struct _GdkDeviceInfo
831 {
832   guint32 deviceid;
833   gchar *name;
834   GdkInputSource source;
835   GdkInputMode mode;
836   gint has_cursor;      /* TRUE if the X pointer follows device motion */
837   gint num_axes;
838   GdkAxisUse *axes;    /* Specifies use for each axis */
839   gint num_keys;
840   GdkDeviceKey *keys;
841 };
842
843 struct _GdkTimeCoord
844 {
845   guint32 time;
846   gdouble x;
847   gdouble y;
848   gdouble pressure;
849   gdouble xtilt;
850   gdouble ytilt;
851 };
852
853 /* Event filtering */
854
855 typedef void GdkXEvent;   /* Can be cast to XEvent */
856
857 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
858                                           GdkEvent *event,
859                                           gpointer  data);
860
861 struct _GdkEventAny
862 {
863   GdkEventType type;
864   GdkWindow *window;
865   gint8 send_event;
866 };
867
868 struct _GdkEventExpose
869 {
870   GdkEventType type;
871   GdkWindow *window;
872   GdkRectangle area;
873   gint count; /* If non-zero, how many more events follow. */
874 };
875
876 struct _GdkEventNoExpose
877 {
878   GdkEventType type;
879   GdkWindow *window;
880   /* XXX: does anyone need the X major_code or minor_code fields? */
881 };
882
883 struct _GdkEventVisibility
884 {
885   GdkEventType type;
886   GdkWindow *window;
887   GdkVisibilityState state;
888 };
889
890 struct _GdkEventMotion
891 {
892   GdkEventType type;
893   GdkWindow *window;
894   guint32 time;
895   gdouble x;
896   gdouble y;
897   gdouble pressure;
898   gdouble xtilt;
899   gdouble ytilt;
900   guint state;
901   gint16 is_hint;
902   GdkInputSource source;
903   guint32 deviceid;
904   gdouble x_root, y_root;
905 };
906
907 struct _GdkEventButton
908 {
909   GdkEventType type;
910   GdkWindow *window;
911   guint32 time;
912   gdouble x;
913   gdouble y;
914   gdouble pressure;
915   gdouble xtilt;
916   gdouble ytilt;
917   guint state;
918   guint button;
919   GdkInputSource source;
920   guint32 deviceid;
921   gdouble x_root, y_root;
922 };
923
924 struct _GdkEventKey
925 {
926   GdkEventType type;
927   GdkWindow *window;
928   guint32 time;
929   guint state;
930   guint keyval;
931   gint length;
932   gchar *string;
933 };
934
935 struct _GdkEventCrossing
936 {
937   GdkEventType type;
938   GdkWindow *window;
939   GdkWindow *subwindow;
940   GdkNotifyType detail;
941 };
942
943 struct _GdkEventFocus
944 {
945   GdkEventType type;
946   GdkWindow *window;
947   gint16 in;
948 };
949
950 struct _GdkEventConfigure
951 {
952   GdkEventType type;
953   GdkWindow *window;
954   gint16 x, y;
955   gint16 width;
956   gint16 height;
957 };
958
959 struct _GdkEventProperty
960 {
961   GdkEventType type;
962   GdkWindow *window;
963   GdkAtom atom;
964   guint32 time;
965   guint state;
966 };
967
968 struct _GdkEventSelection
969 {
970   GdkEventType type;
971   GdkWindow *window;
972   GdkAtom selection;
973   GdkAtom target;
974   GdkAtom property;
975   guint32 requestor;
976   guint32 time;
977 };
978
979 /* This event type will be used pretty rarely. It only is important
980    for XInput aware programs that are drawing their own cursor */
981
982 struct _GdkEventProximity
983 {
984   GdkEventType type;
985   GdkWindow *window;
986   guint32 time;
987   GdkInputSource source;
988   guint32 deviceid;
989 };
990
991 struct _GdkEventDragRequest
992 {
993   GdkEventType type;
994   GdkWindow *window;
995   guint32 requestor;
996   union {
997     struct {
998       guint protocol_version:4;
999       guint sendreply:1;
1000       guint willaccept:1;
1001       guint delete_data:1; /* Do *not* delete if link is sent, only
1002                               if data is sent */
1003       guint senddata:1;
1004       guint reserved:22;
1005     } flags;
1006     glong allflags;
1007   } u;
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 */
1011
1012   GdkPoint drop_coords;
1013   gchar *data_type;
1014 };
1015
1016 struct _GdkEventDragBegin
1017 {
1018   GdkEventType type;
1019   GdkWindow *window;
1020   union {
1021     struct {
1022       guint protocol_version:4;
1023       guint reserved:28;
1024     } flags;
1025     glong allflags;
1026   } u;
1027 };
1028
1029 struct _GdkEventDropEnter
1030 {
1031   GdkEventType type;
1032   GdkWindow *window;
1033   guint32 requestor;
1034   union {
1035     struct {
1036       guint protocol_version:4;
1037       guint sendreply:1;
1038       guint extended_typelist:1;
1039       guint reserved:26;
1040     } flags;
1041     glong allflags;
1042   } u;
1043 };
1044
1045 struct _GdkEventDropLeave
1046 {
1047   GdkEventType type;
1048   GdkWindow *window;
1049   guint32 requestor;
1050   union {
1051     struct {
1052       guint protocol_version:4;
1053       guint reserved:28;
1054     } flags;
1055     glong allflags;
1056   } u;
1057 };
1058
1059 struct _GdkEventDropDataAvailable
1060 {
1061   GdkEventType type;
1062   GdkWindow *window;
1063   guint32 requestor;
1064   union {
1065     struct {
1066       guint protocol_version:4;
1067       guint isdrop:1;
1068       guint reserved:25;
1069     } flags;
1070     glong allflags;
1071   } u;
1072   gchar *data_type; /* MIME type */
1073   gulong data_numbytes;
1074   gpointer data;
1075 };
1076
1077 struct _GdkEventClient
1078 {
1079   GdkEventType type;
1080   GdkWindow *window;
1081   GdkAtom message_type;
1082   gushort data_format;
1083   union {
1084     char b[20];
1085     short s[10];
1086     long l[5];
1087   } data;
1088 };
1089
1090 struct _GdkEventOther
1091 {
1092   GdkEventType type;
1093   GdkWindow *window;
1094   GdkXEvent *xevent;
1095 };
1096
1097 union _GdkEvent
1098 {
1099   GdkEventType              type;
1100   GdkEventAny               any;
1101   GdkEventExpose            expose;
1102   GdkEventNoExpose          no_expose;
1103   GdkEventVisibility        visibility;
1104   GdkEventMotion            motion;
1105   GdkEventButton            button;
1106   GdkEventKey               key;
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;
1120 };
1121
1122
1123 #ifdef __cplusplus
1124 }
1125 #endif /* __cplusplus */
1126
1127
1128 #endif /* __GDK_TYPES_H__ */