]> Pileus Git - ~andy/gtk/blob - gdk/gdkevents.h
Remove all references to offscreen flag which was no longer used.
[~andy/gtk] / gdk / gdkevents.h
1 #ifndef __GDK_EVENTS_H__
2 #define __GDK_EVENTS_H__
3
4 #include <gdk/gdktypes.h>
5 #include <gdk/gdkdnd.h>
6 #include <gdk/gdkinput.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif /* __cplusplus */
11
12 #define GDK_PRIORITY_EVENTS     (G_PRIORITY_DEFAULT)
13 #define GDK_PRIORITY_REDRAW     (G_PRIORITY_HIGH_IDLE + 20)
14
15
16 typedef struct _GdkEventAny         GdkEventAny;
17 typedef struct _GdkEventExpose      GdkEventExpose;
18 typedef struct _GdkEventNoExpose    GdkEventNoExpose;
19 typedef struct _GdkEventVisibility  GdkEventVisibility;
20 typedef struct _GdkEventMotion      GdkEventMotion;
21 typedef struct _GdkEventButton      GdkEventButton;
22 typedef struct _GdkEventScroll      GdkEventScroll;  
23 typedef struct _GdkEventKey         GdkEventKey;
24 typedef struct _GdkEventFocus       GdkEventFocus;
25 typedef struct _GdkEventCrossing    GdkEventCrossing;
26 typedef struct _GdkEventConfigure   GdkEventConfigure;
27 typedef struct _GdkEventProperty    GdkEventProperty;
28 typedef struct _GdkEventSelection   GdkEventSelection;
29 typedef struct _GdkEventProximity   GdkEventProximity;
30 typedef struct _GdkEventClient      GdkEventClient;
31
32 typedef struct _GdkEventDND         GdkEventDND;
33
34 typedef union  _GdkEvent            GdkEvent;
35
36 typedef void (*GdkEventFunc) (GdkEvent *event,
37                               gpointer  data);
38
39 /* Event filtering */
40
41 typedef void GdkXEvent;   /* Can be cast to XEvent */
42
43 typedef enum {
44   GDK_FILTER_CONTINUE,    /* Event not handled, continue processesing */
45   GDK_FILTER_TRANSLATE,   /* Translated event stored */
46   GDK_FILTER_REMOVE       /* Terminate processing, removing event */
47 } GdkFilterReturn;
48
49 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
50                                           GdkEvent *event,
51                                           gpointer  data);
52
53
54 /* Event types.
55  *   Nothing: No event occurred.
56  *   Delete: A window delete event was sent by the window manager.
57  *           The specified window should be deleted.
58  *   Destroy: A window has been destroyed.
59  *   Expose: Part of a window has been uncovered.
60  *   NoExpose: Same as expose, but no expose event was generated.
61  *   VisibilityNotify: A window has become fully/partially/not obscured.
62  *   MotionNotify: The mouse has moved.
63  *   ButtonPress: A mouse button was pressed.
64  *   ButtonRelease: A mouse button was release.
65  *   KeyPress: A key was pressed.
66  *   KeyRelease: A key was released.
67  *   EnterNotify: A window was entered.
68  *   LeaveNotify: A window was exited.
69  *   FocusChange: The focus window has changed. (The focus window gets
70  *                keyboard events).
71  *   Resize: A window has been resized.
72  *   Map: A window has been mapped. (It is now visible on the screen).
73  *   Unmap: A window has been unmapped. (It is no longer visible on
74  *          the screen).
75  *   Scroll: A mouse wheel was scrolled either up or down.
76  */
77 typedef enum
78 {
79   GDK_NOTHING           = -1,
80   GDK_DELETE            = 0,
81   GDK_DESTROY           = 1,
82   GDK_EXPOSE            = 2,
83   GDK_MOTION_NOTIFY     = 3,
84   GDK_BUTTON_PRESS      = 4,
85   GDK_2BUTTON_PRESS     = 5,
86   GDK_3BUTTON_PRESS     = 6,
87   GDK_BUTTON_RELEASE    = 7,
88   GDK_KEY_PRESS         = 8,
89   GDK_KEY_RELEASE       = 9,
90   GDK_ENTER_NOTIFY      = 10,
91   GDK_LEAVE_NOTIFY      = 11,
92   GDK_FOCUS_CHANGE      = 12,
93   GDK_CONFIGURE         = 13,
94   GDK_MAP               = 14,
95   GDK_UNMAP             = 15,
96   GDK_PROPERTY_NOTIFY   = 16,
97   GDK_SELECTION_CLEAR   = 17,
98   GDK_SELECTION_REQUEST = 18,
99   GDK_SELECTION_NOTIFY  = 19,
100   GDK_PROXIMITY_IN      = 20,
101   GDK_PROXIMITY_OUT     = 21,
102   GDK_DRAG_ENTER        = 22,
103   GDK_DRAG_LEAVE        = 23,
104   GDK_DRAG_MOTION       = 24,
105   GDK_DRAG_STATUS       = 25,
106   GDK_DROP_START        = 26,
107   GDK_DROP_FINISHED     = 27,
108   GDK_CLIENT_EVENT      = 28,
109   GDK_VISIBILITY_NOTIFY = 29,
110   GDK_NO_EXPOSE         = 30,
111   GDK_SCROLL            = 31
112 } GdkEventType;
113
114 /* Event masks. (Used to select what types of events a window
115  *  will receive).
116  */
117 typedef enum
118 {
119   GDK_EXPOSURE_MASK             = 1 << 1,
120   GDK_POINTER_MOTION_MASK       = 1 << 2,
121   GDK_POINTER_MOTION_HINT_MASK  = 1 << 3,
122   GDK_BUTTON_MOTION_MASK        = 1 << 4,
123   GDK_BUTTON1_MOTION_MASK       = 1 << 5,
124   GDK_BUTTON2_MOTION_MASK       = 1 << 6,
125   GDK_BUTTON3_MOTION_MASK       = 1 << 7,
126   GDK_BUTTON_PRESS_MASK         = 1 << 8,
127   GDK_BUTTON_RELEASE_MASK       = 1 << 9,
128   GDK_KEY_PRESS_MASK            = 1 << 10,
129   GDK_KEY_RELEASE_MASK          = 1 << 11,
130   GDK_ENTER_NOTIFY_MASK         = 1 << 12,
131   GDK_LEAVE_NOTIFY_MASK         = 1 << 13,
132   GDK_FOCUS_CHANGE_MASK         = 1 << 14,
133   GDK_STRUCTURE_MASK            = 1 << 15,
134   GDK_PROPERTY_CHANGE_MASK      = 1 << 16,
135   GDK_VISIBILITY_NOTIFY_MASK    = 1 << 17,
136   GDK_PROXIMITY_IN_MASK         = 1 << 18,
137   GDK_PROXIMITY_OUT_MASK        = 1 << 19,
138   GDK_SUBSTRUCTURE_MASK         = 1 << 20,
139   GDK_SCROLL_MASK               = 1 << 21,
140   GDK_ALL_EVENTS_MASK           = 0x3FFFFE
141 } GdkEventMask;
142
143 typedef enum
144 {
145   GDK_VISIBILITY_UNOBSCURED,
146   GDK_VISIBILITY_PARTIAL,
147   GDK_VISIBILITY_FULLY_OBSCURED
148 } GdkVisibilityState;
149
150 typedef enum
151 {
152   GDK_SCROLL_UP,
153   GDK_SCROLL_DOWN,
154   GDK_SCROLL_LEFT,
155   GDK_SCROLL_RIGHT
156 } GdkScrollDirection;
157
158 /* Types of enter/leave notifications.
159  *   Ancestor:
160  *   Virtual:
161  *   Inferior:
162  *   Nonlinear:
163  *   NonlinearVirtual:
164  *   Unknown: An unknown type of enter/leave event occurred.
165  */
166 typedef enum
167 {
168   GDK_NOTIFY_ANCESTOR           = 0,
169   GDK_NOTIFY_VIRTUAL            = 1,
170   GDK_NOTIFY_INFERIOR           = 2,
171   GDK_NOTIFY_NONLINEAR          = 3,
172   GDK_NOTIFY_NONLINEAR_VIRTUAL  = 4,
173   GDK_NOTIFY_UNKNOWN            = 5
174 } GdkNotifyType;
175
176 /* Enter/leave event modes.
177  *   NotifyNormal
178  *   NotifyGrab
179  *   NotifyUngrab
180  */
181 typedef enum
182 {
183   GDK_CROSSING_NORMAL,
184   GDK_CROSSING_GRAB,
185   GDK_CROSSING_UNGRAB
186 } GdkCrossingMode;
187
188 typedef enum
189 {
190   GDK_PROPERTY_NEW_VALUE,
191   GDK_PROPERTY_DELETE
192 } GdkPropertyState;
193
194 struct _GdkEventAny
195 {
196   GdkEventType type;
197   GdkWindow *window;
198   gint8 send_event;
199 };
200
201 struct _GdkEventExpose
202 {
203   GdkEventType type;
204   GdkWindow *window;
205   gint8 send_event;
206   GdkRectangle area;
207   gint count; /* If non-zero, how many more events follow. */
208 };
209
210 struct _GdkEventNoExpose
211 {
212   GdkEventType type;
213   GdkWindow *window;
214   gint8 send_event;
215   /* XXX: does anyone need the X major_code or minor_code fields? */
216 };
217
218 struct _GdkEventVisibility
219 {
220   GdkEventType type;
221   GdkWindow *window;
222   gint8 send_event;
223   GdkVisibilityState state;
224 };
225
226 struct _GdkEventMotion
227 {
228   GdkEventType type;
229   GdkWindow *window;
230   gint8 send_event;
231   guint32 time;
232   gdouble x;
233   gdouble y;
234   gdouble pressure;
235   gdouble xtilt;
236   gdouble ytilt;
237   guint state;
238   gint16 is_hint;
239   GdkInputSource source;
240   guint32 deviceid;
241   gdouble x_root, y_root;
242 };
243
244 struct _GdkEventButton
245 {
246   GdkEventType type;
247   GdkWindow *window;
248   gint8 send_event;
249   guint32 time;
250   gdouble x;
251   gdouble y;
252   gdouble pressure;
253   gdouble xtilt;
254   gdouble ytilt;
255   guint state;
256   guint button;
257   GdkInputSource source;
258   guint32 deviceid;
259   gdouble x_root, y_root;
260 };
261
262 struct _GdkEventScroll
263 {
264   GdkEventType type;
265   GdkWindow *window;
266   gint8 send_event;
267   guint32 time;
268   gdouble x;
269   gdouble y;
270   gdouble pressure;
271   gdouble xtilt;
272   gdouble ytilt;
273   guint state;
274   GdkScrollDirection direction;
275   GdkInputSource source;
276   guint32 deviceid;
277   gdouble x_root, y_root;
278 };
279
280 struct _GdkEventKey
281 {
282   GdkEventType type;
283   GdkWindow *window;
284   gint8 send_event;
285   guint32 time;
286   guint state;
287   guint keyval;
288   gint length;
289   gchar *string;
290 };
291
292 struct _GdkEventCrossing
293 {
294   GdkEventType type;
295   GdkWindow *window;
296   gint8 send_event;
297   GdkWindow *subwindow;
298   guint32 time;
299   gdouble x;
300   gdouble y;
301   gdouble x_root;
302   gdouble y_root;
303   GdkCrossingMode mode;
304   GdkNotifyType detail;
305   gboolean focus;
306   guint state;
307 };
308
309 struct _GdkEventFocus
310 {
311   GdkEventType type;
312   GdkWindow *window;
313   gint8 send_event;
314   gint16 in;
315 };
316
317 struct _GdkEventConfigure
318 {
319   GdkEventType type;
320   GdkWindow *window;
321   gint8 send_event;
322   gint x, y;
323   gint width;
324   gint height;
325 };
326
327 struct _GdkEventProperty
328 {
329   GdkEventType type;
330   GdkWindow *window;
331   gint8 send_event;
332   GdkAtom atom;
333   guint32 time;
334   guint state;
335 };
336
337 struct _GdkEventSelection
338 {
339   GdkEventType type;
340   GdkWindow *window;
341   gint8 send_event;
342   GdkAtom selection;
343   GdkAtom target;
344   GdkAtom property;
345   guint32 requestor;
346   guint32 time;
347 };
348
349 /* This event type will be used pretty rarely. It only is important
350    for XInput aware programs that are drawing their own cursor */
351
352 struct _GdkEventProximity
353 {
354   GdkEventType type;
355   GdkWindow *window;
356   gint8 send_event;
357   guint32 time;
358   GdkInputSource source;
359   guint32 deviceid;
360 };
361
362 struct _GdkEventClient
363 {
364   GdkEventType type;
365   GdkWindow *window;
366   gint8 send_event;
367   GdkAtom message_type;
368   gushort data_format;
369   union {
370     char b[20];
371     short s[10];
372     long l[5];
373   } data;
374 };
375
376 /* Event types for DND */
377
378 struct _GdkEventDND {
379   GdkEventType type;
380   GdkWindow *window;
381   gint8 send_event;
382   GdkDragContext *context;
383
384   guint32 time;
385   gshort x_root, y_root;
386 };
387
388 union _GdkEvent
389 {
390   GdkEventType              type;
391   GdkEventAny               any;
392   GdkEventExpose            expose;
393   GdkEventNoExpose          no_expose;
394   GdkEventVisibility        visibility;
395   GdkEventMotion            motion;
396   GdkEventButton            button;
397   GdkEventScroll            scroll;
398   GdkEventKey               key;
399   GdkEventCrossing          crossing;
400   GdkEventFocus             focus_change;
401   GdkEventConfigure         configure;
402   GdkEventProperty          property;
403   GdkEventSelection         selection;
404   GdkEventProximity         proximity;
405   GdkEventClient            client;
406   GdkEventDND               dnd;
407 };
408
409 gboolean  gdk_events_pending            (void);
410 GdkEvent* gdk_event_get                 (void);
411
412 GdkEvent* gdk_event_peek                (void);
413 GdkEvent* gdk_event_get_graphics_expose (GdkWindow      *window);
414 void      gdk_event_put                 (GdkEvent       *event);
415
416 GdkEvent* gdk_event_copy                (GdkEvent       *event);
417 void      gdk_event_free                (GdkEvent       *event);
418 guint32   gdk_event_get_time            (GdkEvent       *event);
419
420 void      gdk_event_handler_set         (GdkEventFunc    func,
421                                          gpointer        data,
422                                          GDestroyNotify  notify);
423
424 void      gdk_set_show_events           (gboolean        show_events);
425 gboolean  gdk_get_show_events           (void);
426
427 /*
428  * The following function adds a global filter for all client
429  * messages of type message_type
430  */
431 void gdk_add_client_message_filter (GdkAtom       message_type,
432                                     GdkFilterFunc func,
433                                     gpointer      data);
434
435
436 #ifdef __cplusplus
437 }
438 #endif /* __cplusplus */
439
440 #endif /* __GDK_EVENTS_H__ */