]> Pileus Git - ~andy/gtk/blob - gdk/gdktypes.h
Fixes to allow GTK to work with colormaps that aren't 256 entries long.
[~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 struct _GdkRegion           GdkRegion;
88 typedef gint (*GdkEventFunc) (GdkEvent *event,
89                               gpointer  data);
90
91 typedef void*                     GdkIC;
92 typedef void*                     GdkIM;
93
94
95 /* Types of windows.
96  *   Root: There is only 1 root window and it is initialized
97  *         at startup. Creating a window of type GDK_WINDOW_ROOT
98  *         is an error.
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
105  *           transient window.
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
114  */
115 typedef enum
116 {
117   GDK_WINDOW_ROOT,
118   GDK_WINDOW_TOPLEVEL,
119   GDK_WINDOW_CHILD,
120   GDK_WINDOW_DIALOG,
121   GDK_WINDOW_TEMP,
122   GDK_WINDOW_PIXMAP,
123   GDK_WINDOW_FOREIGN
124 } GdkWindowType;
125
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.
134  */
135 typedef enum
136 {
137   GDK_INPUT_OUTPUT,
138   GDK_INPUT_ONLY
139 } GdkWindowClass;
140
141 /* Types of images.
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.
150  */
151 typedef enum
152 {
153   GDK_IMAGE_NORMAL,
154   GDK_IMAGE_SHARED,
155   GDK_IMAGE_FASTEST
156 } GdkImageType;
157
158 /* Types of visuals.
159  *   StaticGray:
160  *   Grayscale:
161  *   StaticColor:
162  *   PseudoColor:
163  *   TrueColor:
164  *   DirectColor:
165  */
166 typedef enum
167 {
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
174 } GdkVisualType;
175
176 /* Types of font.
177  *   GDK_FONT_FONT: the font is an XFontStruct.
178  *   GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
179  */
180 typedef enum
181 {
182   GDK_FONT_FONT,
183   GDK_FONT_FONTSET
184 } GdkFontType;
185
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.
193  */
194 typedef enum
195 {
196   GDK_WA_TITLE    = 1 << 1,
197   GDK_WA_X        = 1 << 2,
198   GDK_WA_Y        = 1 << 3,
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;
205
206 /* Size restriction enumeration.
207  */
208 typedef enum
209 {
210   GDK_HINT_POS       = 1 << 0,
211   GDK_HINT_MIN_SIZE  = 1 << 1,
212   GDK_HINT_MAX_SIZE  = 1 << 2
213 } GdkWindowHints;
214
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.
219  */
220 typedef enum
221 {
222   GDK_COPY,
223   GDK_INVERT,
224   GDK_XOR
225 } GdkFunction;
226
227 /* GC fill types.
228  *  Solid:
229  *  Tiled:
230  *  Stippled:
231  *  OpaqueStippled:
232  */
233 typedef enum
234 {
235   GDK_SOLID,
236   GDK_TILED,
237   GDK_STIPPLED,
238   GDK_OPAQUE_STIPPLED
239 } GdkFill;
240
241 /* GC line styles
242  *  Solid:
243  *  OnOffDash:
244  *  DoubleDash:
245  */
246 typedef enum
247 {
248   GDK_LINE_SOLID,
249   GDK_LINE_ON_OFF_DASH,
250   GDK_LINE_DOUBLE_DASH
251 } GdkLineStyle;
252
253 /* GC cap styles
254  *  CapNotLast:
255  *  CapButt:
256  *  CapRound:
257  *  CapProjecting:
258  */
259 typedef enum
260 {
261   GDK_CAP_NOT_LAST,
262   GDK_CAP_BUTT,
263   GDK_CAP_ROUND,
264   GDK_CAP_PROJECTING
265 } GdkCapStyle;
266
267 /* GC join styles
268  *  JoinMiter:
269  *  JoinRound:
270  *  JoinBevel:
271  */
272 typedef enum
273 {
274   GDK_JOIN_MITER,
275   GDK_JOIN_ROUND,
276   GDK_JOIN_BEVEL
277 } GdkJoinStyle;
278
279 /* Cursor types.
280  */
281 typedef enum
282 {
283 #include <gdk/gdkcursors.h>
284   GDK_LAST_CURSOR,
285   GDK_CURSOR_IS_PIXMAP = -1
286 } GdkCursorType;
287
288 typedef enum {
289   GDK_FILTER_CONTINUE,    /* Event not handled, continue processesing */
290   GDK_FILTER_TRANSLATE,   /* Translated event stored */
291   GDK_FILTER_REMOVE       /* Terminate processing, removing event */
292 } GdkFilterReturn;
293
294 typedef enum {
295   GDK_VISIBILITY_UNOBSCURED,
296   GDK_VISIBILITY_PARTIAL,
297   GDK_VISIBILITY_FULLY_OBSCURED
298 } GdkVisibilityState;
299
300 /* Event types.
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
316  *                keyboard events).
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
320  *          the screen).
321  */
322 typedef enum
323 {
324   GDK_NOTHING           = -1,
325   GDK_DELETE            = 0,
326   GDK_DESTROY           = 1,
327   GDK_EXPOSE            = 2,
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,
333   GDK_KEY_PRESS         = 8,
334   GDK_KEY_RELEASE       = 9,
335   GDK_ENTER_NOTIFY      = 10,
336   GDK_LEAVE_NOTIFY      = 11,
337   GDK_FOCUS_CHANGE      = 12,
338   GDK_CONFIGURE         = 13,
339   GDK_MAP               = 14,
340   GDK_UNMAP             = 15,
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,
347   GDK_DRAG_BEGIN        = 22,
348   GDK_DRAG_REQUEST      = 23,
349   GDK_DROP_ENTER        = 24,
350   GDK_DROP_LEAVE        = 25,
351   GDK_DROP_DATA_AVAIL   = 26,
352   GDK_CLIENT_EVENT      = 27,
353   GDK_VISIBILITY_NOTIFY = 28,
354   GDK_NO_EXPOSE         = 29,
355   GDK_OTHER_EVENT       = 9999  /* Deprecated, use filters instead */
356 } GdkEventType;
357
358 /* Event masks. (Used to select what types of events a window
359  *  will receive).
360  */
361 typedef enum
362 {
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
383 } GdkEventMask;
384
385 /* Types of enter/leave notifications.
386  *   Ancestor:
387  *   Virtual:
388  *   Inferior:
389  *   Nonlinear:
390  *   NonlinearVirtual:
391  *   Unknown: An unknown type of enter/leave event occurred.
392  */
393 typedef enum
394 {
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
401 } GdkNotifyType;
402
403 /* Types of modifiers.
404  */
405 typedef enum
406 {
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
420 } GdkModifierType;
421
422 typedef enum
423 {
424   GDK_CLIP_BY_CHILDREN  = 0,
425   GDK_INCLUDE_INFERIORS = 1
426 } GdkSubwindowMode;
427
428 typedef enum
429 {
430   GDK_INPUT_READ       = 1 << 0,
431   GDK_INPUT_WRITE      = 1 << 1,
432   GDK_INPUT_EXCEPTION  = 1 << 2
433 } GdkInputCondition;
434
435 typedef enum
436 {
437   GDK_OK          = 0,
438   GDK_ERROR       = -1,
439   GDK_ERROR_PARAM = -2,
440   GDK_ERROR_FILE  = -3,
441   GDK_ERROR_MEM   = -4
442 } GdkStatus;
443
444 typedef enum
445 {
446   GDK_LSB_FIRST,
447   GDK_MSB_FIRST
448 } GdkByteOrder;
449
450 typedef enum
451 {
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
470 } GdkGCValuesMask;
471
472 typedef enum
473 {
474   GDK_SELECTION_PRIMARY = 1,
475   GDK_SELECTION_SECONDARY = 2
476 } GdkSelection;
477
478 typedef enum
479 {
480   GDK_PROPERTY_NEW_VALUE,
481   GDK_PROPERTY_DELETE
482 } GdkPropertyState;
483
484 typedef enum
485 {
486   GDK_PROP_MODE_REPLACE,
487   GDK_PROP_MODE_PREPEND,
488   GDK_PROP_MODE_APPEND
489 } GdkPropMode;
490
491 /* These definitions are for version 1 of the OffiX D&D protocol,
492    taken from <OffiX/DragAndDropTypes.h> */
493 typedef enum
494 {
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,
501   GDK_DNDTYPE_DIR = 5,
502   GDK_DNDTYPE_LINK = 6,
503   GDK_DNDTYPE_EXE = 7,
504   GDK_DNDTYPE_URL = 8,
505   GDK_DNDTYPE_MIME = 9,
506   GDK_DNDTYPE_END = 10
507 } GdkDndType;
508
509 /* Enums for XInput support */
510
511 typedef enum
512 {
513   GDK_SOURCE_MOUSE,
514   GDK_SOURCE_PEN,
515   GDK_SOURCE_ERASER,
516   GDK_SOURCE_CURSOR
517 } GdkInputSource;
518
519 typedef enum
520 {
521   GDK_MODE_DISABLED,
522   GDK_MODE_SCREEN,
523   GDK_MODE_WINDOW
524 } GdkInputMode;
525
526 typedef enum
527 {
528   GDK_AXIS_IGNORE,
529   GDK_AXIS_X,
530   GDK_AXIS_Y,
531   GDK_AXIS_PRESSURE,
532   GDK_AXIS_XTILT,
533   GDK_AXIS_YTILT,
534   GDK_AXIS_LAST
535 } GdkAxisUse;
536
537 /* The next two types define enums for predefined atoms relating
538    to selections. In general, one will need to use gdk_intern_atom */
539
540 typedef enum
541 {
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
547 } GdkTarget;
548
549 typedef enum
550 {
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
559 } GdkSelectionType;
560
561 typedef enum
562 {
563   GDK_EXTENSION_EVENTS_NONE,
564   GDK_EXTENSION_EVENTS_ALL,
565   GDK_EXTENSION_EVENTS_CURSOR
566 } GdkExtensionMode;
567
568 typedef enum
569 {
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
579 } GdkIMStyle;
580
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.
585  */
586 typedef enum
587 {
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
595 } GdkWMDecoration;
596
597 typedef enum
598 {
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
605 } GdkWMFunction;
606
607 #define GdkIMPreeditMask \
608         ( GdkIMPreeditArea     | GdkIMPreeditCallbacks | \
609           GdkIMPreeditPosition | GdkIMPreeditNothing | \
610           GdkIMPreeditNone )
611
612 #define GdkIMStatusMask \
613         ( GdkIMStatusArea | GdkIMStatusCallbacks | \
614           GdkIMStatusNothing | GdkIMStatusNone )
615
616 typedef void (*GdkInputFunction) (gpointer          data,
617                                   gint              source,
618                                   GdkInputCondition condition);
619
620 typedef void (*GdkDestroyNotify) (gpointer data);
621
622 /* Color Context modes.
623  *
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
630  */ 
631
632 typedef enum
633 {
634   GDK_CC_MODE_UNDEFINED,
635   GDK_CC_MODE_BW,
636   GDK_CC_MODE_STD_CMAP,
637   GDK_CC_MODE_TRUE,
638   GDK_CC_MODE_MY_GRAY,
639   GDK_CC_MODE_PALETTE
640 } GdkColorContextMode;
641
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
646  */
647
648 typedef enum
649 {
650   GDK_OVERLAP_RECTANGLE_IN,
651   GDK_OVERLAP_RECTANGLE_OUT,
652   GDK_OVERLAP_RECTANGLE_PART
653 } GdkOverlapType;
654
655 /* The color type.
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.
661  */
662 struct _GdkColor
663 {
664   gulong  pixel;
665   gushort red;
666   gushort green;
667   gushort blue;
668 };
669
670 /* The colormap type.
671  *   Colormaps consist of 256 colors.
672  */
673 struct _GdkColormap
674 {
675   gint      size;
676   GdkColor *colors;
677 };
678
679 /* The visual type.
680  *   "type" is the type of visual this is (PseudoColor, TrueColor, etc).
681  *   "depth" is the bit depth of this visual.
682  *   "colormap_size" is the size of a colormap for this visual.
683  *   "bits_per_rgb" is the number of significant bits per red, green and blue.
684  *  The red, green and blue masks, shifts and precisions refer
685  *   to value needed to calculate pixel values in TrueColor and DirectColor
686  *   visuals. The "mask" is the significant bits within the pixel. The
687  *   "shift" is the number of bits left we must shift a primary for it
688  *   to be in position (according to the "mask"). "prec" refers to how
689  *   much precision the pixel value contains for a particular primary.
690  */
691 struct _GdkVisual
692 {
693   GdkVisualType type;
694   gint depth;
695   GdkByteOrder byte_order;
696   gint colormap_size;
697   gint bits_per_rgb;
698
699   guint32 red_mask;
700   gint red_shift;
701   gint red_prec;
702
703   guint32 green_mask;
704   gint green_shift;
705   gint green_prec;
706
707   guint32 blue_mask;
708   gint blue_shift;
709   gint blue_prec;
710 };
711
712 struct _GdkWindowAttr
713 {
714   gchar *title;
715   gint event_mask;
716   gint16 x, y;
717   gint16 width;
718   gint16 height;
719   GdkWindowClass wclass;
720   GdkVisual *visual;
721   GdkColormap *colormap;
722   GdkWindowType window_type;
723   GdkCursor *cursor;
724   gchar *wmclass_name;
725   gchar *wmclass_class;
726   gboolean override_redirect;
727 };
728
729 struct _GdkWindow
730 {
731   gpointer user_data;
732 };
733
734 struct _GdkImage
735 {
736   GdkImageType  type;
737   GdkVisual    *visual;     /* visual used to create the image */
738   GdkByteOrder  byte_order;
739   guint16       width;
740   guint16       height;
741   guint16       depth;
742   guint16       bpp;        /* bytes per pixel */
743   guint16       bpl;        /* bytes per line */
744   gpointer      mem;
745 };
746
747 struct _GdkGCValues
748 {
749   GdkColor          foreground;
750   GdkColor          background;
751   GdkFont          *font;
752   GdkFunction       function;
753   GdkFill           fill;
754   GdkPixmap        *tile;
755   GdkPixmap        *stipple;
756   GdkPixmap        *clip_mask;
757   GdkSubwindowMode  subwindow_mode;
758   gint              ts_x_origin;
759   gint              ts_y_origin;
760   gint              clip_x_origin;
761   gint              clip_y_origin;
762   gint              graphics_exposures;
763   gint              line_width;
764   GdkLineStyle      line_style;
765   GdkCapStyle       cap_style;
766   GdkJoinStyle      join_style;
767 };
768
769 struct _GdkGC
770 {
771   gint dummy_var;
772 };
773
774 struct _GdkPoint
775 {
776   gint16 x;
777   gint16 y;
778 };
779
780 struct _GdkRectangle
781 {
782   gint16 x;
783   gint16 y;
784   guint16 width;
785   guint16 height;
786 };
787
788 struct _GdkSegment
789 {
790   gint16 x1;
791   gint16 y1;
792   gint16 x2;
793   gint16 y2;
794 };
795
796 struct _GdkFont
797 {
798   GdkFontType type;
799   gint ascent;
800   gint descent;
801 };
802
803 struct _GdkCursor
804 {
805   GdkCursorType type;
806 };
807
808 struct _GdkColorContextDither
809 {
810   gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */
811   gint fast_err[32][32][32]; /* internal RGB error information */
812   gint fast_erg[32][32][32];
813   gint fast_erb[32][32][32];
814 };
815
816 struct _GdkColorContext
817 {
818   GdkVisual *visual;
819   GdkColormap *colormap;
820
821   gint num_colors;              /* available no. of colors in colormap */
822   gint max_colors;              /* maximum no. of colors */
823   gint num_allocated;           /* no. of allocated colors */
824
825   GdkColorContextMode mode;
826   gint need_to_free_colormap;
827   GdkAtom std_cmap_atom;
828
829   gulong *clut;                 /* color look-up table */
830   GdkColor *cmap;               /* colormap */
831
832   GHashTable *color_hash;       /* hash table of allocated colors */
833   GdkColor *palette;            /* preallocated palette */
834   gint num_palette;             /* size of palette */
835
836   GdkColorContextDither *fast_dither;   /* fast dither matrix */
837
838   struct
839   {
840     gint red;
841     gint green;
842     gint blue;
843   } shifts;
844
845   struct
846   {
847     gulong red;
848     gulong green;
849     gulong blue;
850   } masks;
851
852   struct
853   {
854     gint red;
855     gint green;
856     gint blue;
857   } bits;
858
859   gulong max_entry;
860
861   gulong black_pixel;
862   gulong white_pixel;
863 };
864
865 /* Types for XInput support */
866
867 struct _GdkDeviceKey
868 {
869   guint keyval;
870   GdkModifierType modifiers;
871 };
872
873 struct _GdkDeviceInfo
874 {
875   guint32 deviceid;
876   gchar *name;
877   GdkInputSource source;
878   GdkInputMode mode;
879   gint has_cursor;      /* TRUE if the X pointer follows device motion */
880   gint num_axes;
881   GdkAxisUse *axes;    /* Specifies use for each axis */
882   gint num_keys;
883   GdkDeviceKey *keys;
884 };
885
886 struct _GdkTimeCoord
887 {
888   guint32 time;
889   gdouble x;
890   gdouble y;
891   gdouble pressure;
892   gdouble xtilt;
893   gdouble ytilt;
894 };
895
896 /* Event filtering */
897
898 typedef void GdkXEvent;   /* Can be cast to XEvent */
899
900 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
901                                           GdkEvent *event,
902                                           gpointer  data);
903
904 struct _GdkEventAny
905 {
906   GdkEventType type;
907   GdkWindow *window;
908   gint8 send_event;
909 };
910
911 struct _GdkEventExpose
912 {
913   GdkEventType type;
914   GdkWindow *window;
915   gint8 send_event;
916   GdkRectangle area;
917   gint count; /* If non-zero, how many more events follow. */
918 };
919
920 struct _GdkEventNoExpose
921 {
922   GdkEventType type;
923   GdkWindow *window;
924   gint8 send_event;
925   /* XXX: does anyone need the X major_code or minor_code fields? */
926 };
927
928 struct _GdkEventVisibility
929 {
930   GdkEventType type;
931   GdkWindow *window;
932   gint8 send_event;
933   GdkVisibilityState state;
934 };
935
936 struct _GdkEventMotion
937 {
938   GdkEventType type;
939   GdkWindow *window;
940   gint8 send_event;
941   guint32 time;
942   gdouble x;
943   gdouble y;
944   gdouble pressure;
945   gdouble xtilt;
946   gdouble ytilt;
947   guint state;
948   gint16 is_hint;
949   GdkInputSource source;
950   guint32 deviceid;
951   gdouble x_root, y_root;
952 };
953
954 struct _GdkEventButton
955 {
956   GdkEventType type;
957   GdkWindow *window;
958   gint8 send_event;
959   guint32 time;
960   gdouble x;
961   gdouble y;
962   gdouble pressure;
963   gdouble xtilt;
964   gdouble ytilt;
965   guint state;
966   guint button;
967   GdkInputSource source;
968   guint32 deviceid;
969   gdouble x_root, y_root;
970 };
971
972 struct _GdkEventKey
973 {
974   GdkEventType type;
975   GdkWindow *window;
976   gint8 send_event;
977   guint32 time;
978   guint state;
979   guint keyval;
980   gint length;
981   gchar *string;
982 };
983
984 struct _GdkEventCrossing
985 {
986   GdkEventType type;
987   GdkWindow *window;
988   gint8 send_event;
989   GdkWindow *subwindow;
990   GdkNotifyType detail;
991 };
992
993 struct _GdkEventFocus
994 {
995   GdkEventType type;
996   GdkWindow *window;
997   gint8 send_event;
998   gint16 in;
999 };
1000
1001 struct _GdkEventConfigure
1002 {
1003   GdkEventType type;
1004   GdkWindow *window;
1005   gint8 send_event;
1006   gint16 x, y;
1007   gint16 width;
1008   gint16 height;
1009 };
1010
1011 struct _GdkEventProperty
1012 {
1013   GdkEventType type;
1014   GdkWindow *window;
1015   gint8 send_event;
1016   GdkAtom atom;
1017   guint32 time;
1018   guint state;
1019 };
1020
1021 struct _GdkEventSelection
1022 {
1023   GdkEventType type;
1024   GdkWindow *window;
1025   gint8 send_event;
1026   GdkAtom selection;
1027   GdkAtom target;
1028   GdkAtom property;
1029   guint32 requestor;
1030   guint32 time;
1031 };
1032
1033 /* This event type will be used pretty rarely. It only is important
1034    for XInput aware programs that are drawing their own cursor */
1035
1036 struct _GdkEventProximity
1037 {
1038   GdkEventType type;
1039   GdkWindow *window;
1040   gint8 send_event;
1041   guint32 time;
1042   GdkInputSource source;
1043   guint32 deviceid;
1044 };
1045
1046 struct _GdkEventDragRequest
1047 {
1048   GdkEventType type;
1049   GdkWindow *window;
1050   gint8 send_event;
1051   guint32 requestor;
1052   union {
1053     struct {
1054       guint protocol_version:4;
1055       guint sendreply:1;
1056       guint willaccept:1;
1057       guint delete_data:1; /* Do *not* delete if link is sent, only
1058                               if data is sent */
1059       guint senddata:1;
1060       guint reserved:22;
1061     } flags;
1062     glong allflags;
1063   } u;
1064   guint8 isdrop; /* This gdk event can be generated by a couple of
1065                     X events - this lets the app know whether the
1066                     drop really occurred or we just set the data */
1067
1068   GdkPoint drop_coords;
1069   gchar *data_type;
1070   guint32 timestamp;
1071 };
1072
1073 struct _GdkEventDragBegin
1074 {
1075   GdkEventType type;
1076   GdkWindow *window;
1077   gint8 send_event;
1078   union {
1079     struct {
1080       guint protocol_version:4;
1081       guint reserved:28;
1082     } flags;
1083     glong allflags;
1084   } u;
1085 };
1086
1087 struct _GdkEventDropEnter
1088 {
1089   GdkEventType type;
1090   GdkWindow *window;
1091   gint8 send_event;
1092   guint32 requestor;
1093   union {
1094     struct {
1095       guint protocol_version:4;
1096       guint sendreply:1;
1097       guint extended_typelist:1;
1098       guint reserved:26;
1099     } flags;
1100     glong allflags;
1101   } u;
1102 };
1103
1104 struct _GdkEventDropLeave
1105 {
1106   GdkEventType type;
1107   GdkWindow *window;
1108   gint8 send_event;
1109   guint32 requestor;
1110   union {
1111     struct {
1112       guint protocol_version:4;
1113       guint reserved:28;
1114     } flags;
1115     glong allflags;
1116   } u;
1117 };
1118
1119 struct _GdkEventDropDataAvailable
1120 {
1121   GdkEventType type;
1122   GdkWindow *window;
1123   gint8 send_event;
1124   guint32 requestor;
1125   union {
1126     struct {
1127       guint protocol_version:4;
1128       guint isdrop:1;
1129       guint reserved:25;
1130     } flags;
1131     glong allflags;
1132   } u;
1133   gchar *data_type; /* MIME type */
1134   gulong data_numbytes;
1135   gpointer data;
1136   guint32 timestamp;
1137   GdkPoint coords;
1138 };
1139
1140 struct _GdkEventClient
1141 {
1142   GdkEventType type;
1143   GdkWindow *window;
1144   gint8 send_event;
1145   GdkAtom message_type;
1146   gushort data_format;
1147   union {
1148     char b[20];
1149     short s[10];
1150     long l[5];
1151   } data;
1152 };
1153
1154 struct _GdkEventOther
1155 {
1156   GdkEventType type;
1157   GdkWindow *window;
1158   gint8 send_event;
1159   GdkXEvent *xevent;
1160 };
1161
1162 union _GdkEvent
1163 {
1164   GdkEventType              type;
1165   GdkEventAny               any;
1166   GdkEventExpose            expose;
1167   GdkEventNoExpose          no_expose;
1168   GdkEventVisibility        visibility;
1169   GdkEventMotion            motion;
1170   GdkEventButton            button;
1171   GdkEventKey               key;
1172   GdkEventCrossing          crossing;
1173   GdkEventFocus             focus_change;
1174   GdkEventConfigure         configure;
1175   GdkEventProperty          property;
1176   GdkEventSelection         selection;
1177   GdkEventProximity         proximity;
1178   GdkEventDragBegin         dragbegin;
1179   GdkEventDragRequest       dragrequest;
1180   GdkEventDropEnter         dropenter;
1181   GdkEventDropLeave         dropleave;
1182   GdkEventDropDataAvailable dropdataavailable;
1183   GdkEventClient            client;
1184   GdkEventOther             other;
1185 };
1186
1187 struct _GdkRegion
1188 {
1189   gpointer user_data;
1190 };
1191
1192
1193
1194 #ifdef __cplusplus
1195 }
1196 #endif /* __cplusplus */
1197
1198
1199 #endif /* __GDK_TYPES_H__ */