]> Pileus Git - ~andy/gtk/blob - gdk/gdkevents.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gdk / gdkevents.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 Lesser 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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #ifndef __GDK_EVENTS_H__
26 #define __GDK_EVENTS_H__
27
28 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
29 #error "Only <gdk/gdk.h> can be included directly."
30 #endif
31
32 #include <gdk/gdkversionmacros.h>
33 #include <gdk/gdkcolor.h>
34 #include <gdk/gdktypes.h>
35 #include <gdk/gdkdnd.h>
36 #include <gdk/gdkdevice.h>
37
38 G_BEGIN_DECLS
39
40
41 /**
42  * SECTION:event_structs
43  * @Short_description: Data structures specific to each type of event
44  * @Title: Event Structures
45  *
46  * The event structs contain data specific to each type of event in GDK.
47  *
48  * <note>
49  * <para>
50  * A common mistake is to forget to set the event mask of a widget so that
51  * the required events are received. See gtk_widget_set_events().
52  * </para>
53  * </note>
54  */
55
56
57 #define GDK_TYPE_EVENT          (gdk_event_get_type ())
58
59 /**
60  * GDK_PRIORITY_EVENTS:
61  *
62  * This is the priority that events from the X server are given in the
63  * <link linkend="glib-The-Main-Event-Loop">GLib Main Loop</link>.
64  */
65 #define GDK_PRIORITY_EVENTS     (G_PRIORITY_DEFAULT)
66
67 /**
68  * GDK_PRIORITY_REDRAW:
69  *
70  * This is the priority that the idle handler processing window updates
71  * is given in the
72  * <link linkend="glib-The-Main-Event-Loop">GLib Main Loop</link>.
73  */
74 #define GDK_PRIORITY_REDRAW     (G_PRIORITY_HIGH_IDLE + 20)
75
76 /**
77  * GDK_EVENT_PROPAGATE:
78  *
79  * Use this macro as the return value for continuing the propagation of
80  * an event handler.
81  *
82  * Since: 3.4
83  */
84 #define GDK_EVENT_PROPAGATE     (FALSE)
85
86 /**
87  * GDK_EVENT_STOP:
88  *
89  * Use this macro as the return value for stopping the propagation of
90  * an event handler.
91  *
92  * Since: 3.4
93  */
94 #define GDK_EVENT_STOP          (TRUE)
95
96 /**
97  * GDK_BUTTON_PRIMARY:
98  *
99  * The primary button. This is typically the left mouse button, or the
100  * right button in a left-handed setup.
101  *
102  * Since: 3.4
103  */
104 #define GDK_BUTTON_PRIMARY      (1)
105
106 /**
107  * GDK_BUTTON_MIDDLE:
108  *
109  * The middle button.
110  *
111  * Since: 3.4
112  */
113 #define GDK_BUTTON_MIDDLE       (2)
114
115 /**
116  * GDK_BUTTON_SECONDARY:
117  *
118  * The secondary button. This is typically the right mouse button, or the
119  * left button in a left-handed setup.
120  *
121  * Since: 3.4
122  */
123 #define GDK_BUTTON_SECONDARY    (3)
124
125
126
127 typedef struct _GdkEventAny         GdkEventAny;
128 typedef struct _GdkEventExpose      GdkEventExpose;
129 typedef struct _GdkEventVisibility  GdkEventVisibility;
130 typedef struct _GdkEventMotion      GdkEventMotion;
131 typedef struct _GdkEventButton      GdkEventButton;
132 typedef struct _GdkEventTouch       GdkEventTouch;
133 typedef struct _GdkEventScroll      GdkEventScroll;  
134 typedef struct _GdkEventKey         GdkEventKey;
135 typedef struct _GdkEventFocus       GdkEventFocus;
136 typedef struct _GdkEventCrossing    GdkEventCrossing;
137 typedef struct _GdkEventConfigure   GdkEventConfigure;
138 typedef struct _GdkEventProperty    GdkEventProperty;
139 typedef struct _GdkEventSelection   GdkEventSelection;
140 typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
141 typedef struct _GdkEventProximity   GdkEventProximity;
142 typedef struct _GdkEventDND         GdkEventDND;
143 typedef struct _GdkEventWindowState GdkEventWindowState;
144 typedef struct _GdkEventSetting     GdkEventSetting;
145 typedef struct _GdkEventGrabBroken  GdkEventGrabBroken;
146
147 typedef struct _GdkEventSequence    GdkEventSequence;
148
149 typedef union  _GdkEvent            GdkEvent;
150
151 /**
152  * GdkEventFunc:
153  * @event: the #GdkEvent to process.
154  * @data: (closure): user data set when the event handler was installed with
155  *   gdk_event_handler_set().
156  *
157  * Specifies the type of function passed to gdk_event_handler_set() to
158  * handle all GDK events.
159  */
160 typedef void (*GdkEventFunc) (GdkEvent *event,
161                               gpointer  data);
162
163 /* Event filtering */
164
165 /**
166  * GdkXEvent:
167  *
168  * Used to represent native events (<type>XEvent</type>s for the X11
169  * backend, <type>MSG</type>s for Win32).
170  */
171 typedef void GdkXEvent;   /* Can be cast to window system specific
172                            * even type, XEvent on X11, MSG on Win32.
173                            */
174
175 /**
176  * GdkFilterReturn:
177  * @GDK_FILTER_CONTINUE: event not handled, continue processing.
178  * @GDK_FILTER_TRANSLATE: native event translated into a GDK event and stored
179  *  in the <literal>event</literal> structure that was passed in.
180  * @GDK_FILTER_REMOVE: event handled, terminate processing.
181  *
182  * Specifies the result of applying a #GdkFilterFunc to a native event.
183  */
184 typedef enum {
185   GDK_FILTER_CONTINUE,    /* Event not handled, continue processesing */
186   GDK_FILTER_TRANSLATE,   /* Native event translated into a GDK event and
187                              stored in the "event" structure that was
188                              passed in */
189   GDK_FILTER_REMOVE       /* Terminate processing, removing event */
190 } GdkFilterReturn;
191
192 /**
193  * GdkFilterFunc:
194  * @xevent: the native event to filter.
195  * @event: the GDK event to which the X event will be translated.
196  * @data: user data set when the filter was installed.
197  *
198  * Specifies the type of function used to filter native events before they are
199  * converted to GDK events.
200  *
201  * When a filter is called, @event is unpopulated, except for
202  * <literal>event->window</literal>. The filter may translate the native
203  * event to a GDK event and store the result in @event, or handle it without
204  * translation. If the filter translates the event and processing should
205  * continue, it should return %GDK_FILTER_TRANSLATE.
206  *
207  * Returns: a #GdkFilterReturn value.
208  */
209 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
210                                           GdkEvent *event,
211                                           gpointer  data);
212
213
214 /**
215  * GdkEventType:
216  * @GDK_NOTHING: a special code to indicate a null event.
217  * @GDK_DELETE: the window manager has requested that the toplevel window be
218  *   hidden or destroyed, usually when the user clicks on a special icon in the
219  *   title bar.
220  * @GDK_DESTROY: the window has been destroyed.
221  * @GDK_EXPOSE: all or part of the window has become visible and needs to be
222  *   redrawn.
223  * @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
224  * @GDK_BUTTON_PRESS: a mouse button has been pressed.
225  * @GDK_2BUTTON_PRESS: a mouse button has been double-clicked (clicked twice
226  *   within a short period of time). Note that each click also generates a
227  *   %GDK_BUTTON_PRESS event.
228  * @GDK_DOUBLE_BUTTON_PRESS: alias for %GDK_2BUTTON_PRESS, added in 3.6.
229  * @GDK_3BUTTON_PRESS: a mouse button has been clicked 3 times in a short period
230  *   of time. Note that each click also generates a %GDK_BUTTON_PRESS event.
231  * @GDK_TRIPLE_BUTTON_PRESS: alias for %GDK_3BUTTON_PRESS, added in 3.6.
232  * @GDK_BUTTON_RELEASE: a mouse button has been released.
233  * @GDK_KEY_PRESS: a key has been pressed.
234  * @GDK_KEY_RELEASE: a key has been released.
235  * @GDK_ENTER_NOTIFY: the pointer has entered the window.
236  * @GDK_LEAVE_NOTIFY: the pointer has left the window.
237  * @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the window.
238  * @GDK_CONFIGURE: the size, position or stacking order of the window has changed.
239  *   Note that GTK+ discards these events for %GDK_WINDOW_CHILD windows.
240  * @GDK_MAP: the window has been mapped.
241  * @GDK_UNMAP: the window has been unmapped.
242  * @GDK_PROPERTY_NOTIFY: a property on the window has been changed or deleted.
243  * @GDK_SELECTION_CLEAR: the application has lost ownership of a selection.
244  * @GDK_SELECTION_REQUEST: another application has requested a selection.
245  * @GDK_SELECTION_NOTIFY: a selection has been received.
246  * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
247  *   surface (e.g. a touchscreen or graphics tablet).
248  * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
249  *   surface.
250  * @GDK_DRAG_ENTER: the mouse has entered the window while a drag is in progress.
251  * @GDK_DRAG_LEAVE: the mouse has left the window while a drag is in progress.
252  * @GDK_DRAG_MOTION: the mouse has moved in the window while a drag is in
253  *   progress.
254  * @GDK_DRAG_STATUS: the status of the drag operation initiated by the window
255  *   has changed.
256  * @GDK_DROP_START: a drop operation onto the window has started.
257  * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
258  * @GDK_CLIENT_EVENT: a message has been received from another application.
259  * @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
260  * @GDK_SCROLL: the scroll wheel was turned
261  * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
262  *   for the possible window states
263  * @GDK_SETTING: a setting has been modified.
264  * @GDK_OWNER_CHANGE: the owner of a selection has changed. This event type
265  *   was added in 2.6
266  * @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
267  *   was added in 2.8.
268  * @GDK_DAMAGE: the content of the window has been changed. This event type
269  *   was added in 2.14.
270  * @GDK_TOUCH_BEGIN: A new touch event sequence has just started. This event
271  *   type was added in 3.4.
272  * @GDK_TOUCH_UPDATE: A touch event sequence has been updated. This event type
273  *   was added in 3.4.
274  * @GDK_TOUCH_END: A touch event sequence has finished. This event type
275  *   was added in 3.4.
276  * @GDK_TOUCH_CANCEL: A touch event sequence has been canceled. This event type
277  *   was added in 3.4.
278  * @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
279  *
280  * Specifies the type of the event.
281  *
282  * Do not confuse these events with the signals that GTK+ widgets emit.
283  * Although many of these events result in corresponding signals being emitted,
284  * the events are often transformed or filtered along the way.
285  *
286  * In some language bindings, the values %GDK_2BUTTON_PRESS and
287  * %GDK_3BUTTON_PRESS would translate into something syntactically
288  * invalid (eg <literal>Gdk.EventType.2ButtonPress</literal>, where a
289  * symbol is not allowed to start with a number). In that case, the
290  * aliases %GDK_DOUBLE_BUTTON_PRESS and %GDK_TRIPLE_BUTTON_PRESS can
291  * be used instead.
292  */
293 typedef enum
294 {
295   GDK_NOTHING           = -1,
296   GDK_DELETE            = 0,
297   GDK_DESTROY           = 1,
298   GDK_EXPOSE            = 2,
299   GDK_MOTION_NOTIFY     = 3,
300   GDK_BUTTON_PRESS      = 4,
301   GDK_2BUTTON_PRESS     = 5,
302   GDK_DOUBLE_BUTTON_PRESS = GDK_2BUTTON_PRESS,
303   GDK_3BUTTON_PRESS     = 6,
304   GDK_TRIPLE_BUTTON_PRESS = GDK_3BUTTON_PRESS,
305   GDK_BUTTON_RELEASE    = 7,
306   GDK_KEY_PRESS         = 8,
307   GDK_KEY_RELEASE       = 9,
308   GDK_ENTER_NOTIFY      = 10,
309   GDK_LEAVE_NOTIFY      = 11,
310   GDK_FOCUS_CHANGE      = 12,
311   GDK_CONFIGURE         = 13,
312   GDK_MAP               = 14,
313   GDK_UNMAP             = 15,
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,
320   GDK_DRAG_ENTER        = 22,
321   GDK_DRAG_LEAVE        = 23,
322   GDK_DRAG_MOTION       = 24,
323   GDK_DRAG_STATUS       = 25,
324   GDK_DROP_START        = 26,
325   GDK_DROP_FINISHED     = 27,
326   GDK_CLIENT_EVENT      = 28,
327   GDK_VISIBILITY_NOTIFY = 29,
328   GDK_SCROLL            = 31,
329   GDK_WINDOW_STATE      = 32,
330   GDK_SETTING           = 33,
331   GDK_OWNER_CHANGE      = 34,
332   GDK_GRAB_BROKEN       = 35,
333   GDK_DAMAGE            = 36,
334   GDK_TOUCH_BEGIN       = 37,
335   GDK_TOUCH_UPDATE      = 38,
336   GDK_TOUCH_END         = 39,
337   GDK_TOUCH_CANCEL      = 40,
338   GDK_EVENT_LAST        /* helper variable for decls */
339 } GdkEventType;
340
341 /**
342  * GdkVisibilityState:
343  * @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
344  * @GDK_VISIBILITY_PARTIAL: the window is partially visible.
345  * @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
346  *
347  * Specifies the visiblity status of a window for a #GdkEventVisibility.
348  */
349 typedef enum
350 {
351   GDK_VISIBILITY_UNOBSCURED,
352   GDK_VISIBILITY_PARTIAL,
353   GDK_VISIBILITY_FULLY_OBSCURED
354 } GdkVisibilityState;
355
356 /**
357  * GdkScrollDirection:
358  * @GDK_SCROLL_UP: the window is scrolled up.
359  * @GDK_SCROLL_DOWN: the window is scrolled down.
360  * @GDK_SCROLL_LEFT: the window is scrolled to the left.
361  * @GDK_SCROLL_RIGHT: the window is scrolled to the right.
362  * @GDK_SCROLL_SMOOTH: the scrolling is determined by the delta values
363  *   in #GdkEventScroll. See gdk_event_get_scroll_deltas(). Since: 3.4
364  *
365  * Specifies the direction for #GdkEventScroll.
366  */
367 typedef enum
368 {
369   GDK_SCROLL_UP,
370   GDK_SCROLL_DOWN,
371   GDK_SCROLL_LEFT,
372   GDK_SCROLL_RIGHT,
373   GDK_SCROLL_SMOOTH
374 } GdkScrollDirection;
375
376 /**
377  * GdkNotifyType:
378  * @GDK_NOTIFY_ANCESTOR: the window is entered from an ancestor or
379  *   left towards an ancestor.
380  * @GDK_NOTIFY_VIRTUAL: the pointer moves between an ancestor and an
381  *   inferior of the window.
382  * @GDK_NOTIFY_INFERIOR: the window is entered from an inferior or
383  *   left towards an inferior.
384  * @GDK_NOTIFY_NONLINEAR: the window is entered from or left towards
385  *   a window which is neither an ancestor nor an inferior.
386  * @GDK_NOTIFY_NONLINEAR_VIRTUAL: the pointer moves between two windows
387  *   which are not ancestors of each other and the window is part of
388  *   the ancestor chain between one of these windows and their least
389  *   common ancestor.
390  * @GDK_NOTIFY_UNKNOWN: an unknown type of enter/leave event occurred.
391  *
392  * Specifies the kind of crossing for #GdkEventCrossing.
393  *
394  * See the X11 protocol specification of <type>LeaveNotify</type> for
395  * full details of crossing event generation.
396  */
397 typedef enum
398 {
399   GDK_NOTIFY_ANCESTOR           = 0,
400   GDK_NOTIFY_VIRTUAL            = 1,
401   GDK_NOTIFY_INFERIOR           = 2,
402   GDK_NOTIFY_NONLINEAR          = 3,
403   GDK_NOTIFY_NONLINEAR_VIRTUAL  = 4,
404   GDK_NOTIFY_UNKNOWN            = 5
405 } GdkNotifyType;
406
407 /**
408  * GdkCrossingMode:
409  * @GDK_CROSSING_NORMAL: crossing because of pointer motion.
410  * @GDK_CROSSING_GRAB: crossing because a grab is activated.
411  * @GDK_CROSSING_UNGRAB: crossing because a grab is deactivated.
412  * @GDK_CROSSING_GTK_GRAB: crossing because a GTK+ grab is activated.
413  * @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
414  * @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
415  *   state (e.g. sensitivity).
416  * @GDK_CROSSING_TOUCH_BEGIN: crossing because a touch sequence has begun,
417  *   this event is synthetic as the pointer might have not left the window.
418  * @GDK_CROSSING_TOUCH_END: crossing because a touch sequence has ended,
419  *   this event is synthetic as the pointer might have not left the window.
420  * @GDK_CROSSING_DEVICE_SWITCH: crossing because of a device switch (i.e.
421  *   a mouse taking control of the pointer after a touch device), this event
422  *   is synthetic as the pointer didn't leave the window.
423  *
424  * Specifies the crossing mode for #GdkEventCrossing.
425  */
426 typedef enum
427 {
428   GDK_CROSSING_NORMAL,
429   GDK_CROSSING_GRAB,
430   GDK_CROSSING_UNGRAB,
431   GDK_CROSSING_GTK_GRAB,
432   GDK_CROSSING_GTK_UNGRAB,
433   GDK_CROSSING_STATE_CHANGED,
434   GDK_CROSSING_TOUCH_BEGIN,
435   GDK_CROSSING_TOUCH_END,
436   GDK_CROSSING_DEVICE_SWITCH
437 } GdkCrossingMode;
438
439 /**
440  * GdkPropertyState:
441  * @GDK_PROPERTY_NEW_VALUE: the property value was changed.
442  * @GDK_PROPERTY_DELETE: the property was deleted.
443  *
444  * Specifies the type of a property change for a #GdkEventProperty.
445  */
446 typedef enum
447 {
448   GDK_PROPERTY_NEW_VALUE,
449   GDK_PROPERTY_DELETE
450 } GdkPropertyState;
451
452 /**
453  * GdkWindowState:
454  * @GDK_WINDOW_STATE_WITHDRAWN: the window is not shown.
455  * @GDK_WINDOW_STATE_ICONIFIED: the window is minimized.
456  * @GDK_WINDOW_STATE_MAXIMIZED: the window is maximized.
457  * @GDK_WINDOW_STATE_STICKY: the window is sticky.
458  * @GDK_WINDOW_STATE_FULLSCREEN: the window is maximized without
459  *   decorations.
460  * @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
461  * @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
462  * @GDK_WINDOW_STATE_FOCUSED: the window is presented as focused (with active decorations).
463  *
464  * Specifies the state of a toplevel window.
465  */
466 typedef enum
467 {
468   GDK_WINDOW_STATE_WITHDRAWN  = 1 << 0,
469   GDK_WINDOW_STATE_ICONIFIED  = 1 << 1,
470   GDK_WINDOW_STATE_MAXIMIZED  = 1 << 2,
471   GDK_WINDOW_STATE_STICKY     = 1 << 3,
472   GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
473   GDK_WINDOW_STATE_ABOVE      = 1 << 5,
474   GDK_WINDOW_STATE_BELOW      = 1 << 6,
475   GDK_WINDOW_STATE_FOCUSED    = 1 << 7
476 } GdkWindowState;
477
478 /**
479  * GdkSettingAction:
480  * @GDK_SETTING_ACTION_NEW: a setting was added.
481  * @GDK_SETTING_ACTION_CHANGED: a setting was changed.
482  * @GDK_SETTING_ACTION_DELETED: a setting was deleted.
483  *
484  * Specifies the kind of modification applied to a setting in a
485  * #GdkEventSetting.
486  */
487 typedef enum
488 {
489   GDK_SETTING_ACTION_NEW,
490   GDK_SETTING_ACTION_CHANGED,
491   GDK_SETTING_ACTION_DELETED
492 } GdkSettingAction;
493
494 /**
495  * GdkOwnerChange:
496  * @GDK_OWNER_CHANGE_NEW_OWNER: some other app claimed the ownership
497  * @GDK_OWNER_CHANGE_DESTROY: the window was destroyed
498  * @GDK_OWNER_CHANGE_CLOSE: the client was closed
499  *
500  * Specifies why a selection ownership was changed.
501  */
502 typedef enum
503 {
504   GDK_OWNER_CHANGE_NEW_OWNER,
505   GDK_OWNER_CHANGE_DESTROY,
506   GDK_OWNER_CHANGE_CLOSE
507 } GdkOwnerChange;
508
509 /**
510  * GdkEventAny:
511  * @type: the type of the event.
512  * @window: the window which received the event.
513  * @send_event: %TRUE if the event was sent explicitly (e.g. using
514  *   <function>XSendEvent</function>).
515  *
516  * Contains the fields which are common to all event structs.
517  * Any event pointer can safely be cast to a pointer to a #GdkEventAny to
518  * access these fields.
519  */
520 struct _GdkEventAny
521 {
522   GdkEventType type;
523   GdkWindow *window;
524   gint8 send_event;
525 };
526
527 /**
528  * GdkEventExpose:
529  * @type: the type of the event (%GDK_EXPOSE or %GDK_DAMAGE).
530  * @window: the window which received the event.
531  * @send_event: %TRUE if the event was sent explicitly (e.g. using
532  *   <function>XSendEvent</function>).
533  * @area: bounding box of @region.
534  * @region: the region that needs to be redrawn.
535  * @count: the number of contiguous %GDK_EXPOSE events following this one.
536  *   The only use for this is "exposure compression", i.e. handling all
537  *   contiguous %GDK_EXPOSE events in one go, though GDK performs some
538  *   exposure compression so this is not normally needed.
539  *
540  * Generated when all or part of a window becomes visible and needs to be
541  * redrawn.
542  */
543 struct _GdkEventExpose
544 {
545   GdkEventType type;
546   GdkWindow *window;
547   gint8 send_event;
548   GdkRectangle area;
549   cairo_region_t *region;
550   gint count; /* If non-zero, how many more events follow. */
551 };
552
553 /**
554  * GdkEventVisibility:
555  * @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
556  * @window: the window which received the event.
557  * @send_event: %TRUE if the event was sent explicitly (e.g. using
558  *   <function>XSendEvent</function>).
559  * @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
560  *   %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
561  *
562  * Generated when the window visibility status has changed.
563  */
564 struct _GdkEventVisibility
565 {
566   GdkEventType type;
567   GdkWindow *window;
568   gint8 send_event;
569   GdkVisibilityState state;
570 };
571
572 /**
573  * GdkEventMotion:
574  * @type: the type of the event.
575  * @window: the window which received the event.
576  * @send_event: %TRUE if the event was sent explicitly (e.g. using
577  *   <function>XSendEvent</function>).
578  * @time: the time of the event in milliseconds.
579  * @x: the x coordinate of the pointer relative to the window.
580  * @y: the y coordinate of the pointer relative to the window.
581  * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
582  *   the mouse.
583  * @state: (type GdkModifierType): a bit-mask representing the state of
584  *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
585  *   buttons. See #GdkModifierType.
586  * @is_hint: set to 1 if this event is just a hint, see the
587  *   %GDK_POINTER_MOTION_HINT_MASK value of #GdkEventMask.
588  * @device: the device where the event originated.
589  * @x_root: the x coordinate of the pointer relative to the root of the
590  *   screen.
591  * @y_root: the y coordinate of the pointer relative to the root of the
592  *   screen.
593  *
594  * Generated when the pointer moves.
595  */
596 struct _GdkEventMotion
597 {
598   GdkEventType type;
599   GdkWindow *window;
600   gint8 send_event;
601   guint32 time;
602   gdouble x;
603   gdouble y;
604   gdouble *axes;
605   guint state;
606   gint16 is_hint;
607   GdkDevice *device;
608   gdouble x_root, y_root;
609 };
610
611 /**
612  * GdkEventButton:
613  * @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
614  *   %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
615  * @window: the window which received the event.
616  * @send_event: %TRUE if the event was sent explicitly (e.g. using
617  *   <function>XSendEvent</function>).
618  * @time: the time of the event in milliseconds.
619  * @x: the x coordinate of the pointer relative to the window.
620  * @y: the y coordinate of the pointer relative to the window.
621  * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
622  *   the mouse.
623  * @state: (type GdkModifierType): a bit-mask representing the state of
624  *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
625  *   buttons. See #GdkModifierType.
626  * @button: the button which was pressed or released, numbered from 1 to 5.
627  *   Normally button 1 is the left mouse button, 2 is the middle button,
628  *   and 3 is the right button. On 2-button mice, the middle button can
629  *   often be simulated by pressing both mouse buttons together.
630  * @device: the device where the event originated.
631  * @x_root: the x coordinate of the pointer relative to the root of the
632  *   screen.
633  * @y_root: the y coordinate of the pointer relative to the root of the
634  *   screen.
635  *
636  * Used for button press and button release events. The
637  * @type field will be one of %GDK_BUTTON_PRESS,
638  * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE,
639  *
640  * Double and triple-clicks result in a sequence of events being received.
641  * For double-clicks the order of events will be:
642  * <orderedlist>
643  * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
644  * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
645  * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
646  * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
647  * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
648  * </orderedlist>
649  * Note that the first click is received just like a normal
650  * button press, while the second click results in a %GDK_2BUTTON_PRESS
651  * being received just after the %GDK_BUTTON_PRESS.
652  *
653  * Triple-clicks are very similar to double-clicks, except that
654  * %GDK_3BUTTON_PRESS is inserted after the third click. The order of the
655  * events is:
656  * <orderedlist>
657  * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
658  * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
659  * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
660  * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
661  * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
662  * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
663  * <listitem><para>%GDK_3BUTTON_PRESS</para></listitem>
664  * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
665  * </orderedlist>
666  *
667  * For a double click to occur, the second button press must occur within
668  * 1/4 of a second of the first. For a triple click to occur, the third
669  * button press must also occur within 1/2 second of the first button press.
670  */
671 struct _GdkEventButton
672 {
673   GdkEventType type;
674   GdkWindow *window;
675   gint8 send_event;
676   guint32 time;
677   gdouble x;
678   gdouble y;
679   gdouble *axes;
680   guint state;
681   guint button;
682   GdkDevice *device;
683   gdouble x_root, y_root;
684 };
685
686 /**
687  * GdkEventTouch:
688  * @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
689  *   %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
690  * @window: the window which received the event
691  * @send_event: %TRUE if the event was sent explicitly (e.g. using
692  *   <function>XSendEvent</function>)
693  * @time: the time of the event in milliseconds.
694  * @x: the x coordinate of the pointer relative to the window
695  * @y: the y coordinate of the pointer relative to the window
696  * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
697  *   the mouse
698  * @state: (type GdkModifierType): a bit-mask representing the state of
699  *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
700  *   buttons. See #GdkModifierType
701  * @sequence: the event sequence that the event belongs to
702  * @emulating_pointer: whether the event should be used for emulating
703  *   pointer event
704  * @device: the device where the event originated
705  * @x_root: the x coordinate of the pointer relative to the root of the
706  *   screen
707  * @y_root: the y coordinate of the pointer relative to the root of the
708  *   screen
709  *
710  * Used for touch events.
711  * @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
712  * %GDK_TOUCH_END or %GDK_TOUCH_CANCEL.
713  *
714  * Touch events are grouped into sequences by means of the @sequence
715  * field, which can also be obtained with gdk_event_get_event_sequence().
716  * Each sequence begins with a %GDK_TOUCH_BEGIN event, followed by
717  * any number of %GDK_TOUCH_UPDATE events, and ends with a %GDK_TOUCH_END
718  * (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
719  * several active sequences at the same time.
720  */
721 struct _GdkEventTouch
722 {
723   GdkEventType type;
724   GdkWindow *window;
725   gint8 send_event;
726   guint32 time;
727   gdouble x;
728   gdouble y;
729   gdouble *axes;
730   guint state;
731   GdkEventSequence *sequence;
732   gboolean emulating_pointer;
733   GdkDevice *device;
734   gdouble x_root, y_root;
735 };
736
737 /**
738  * GdkEventScroll:
739  * @type: the type of the event (%GDK_SCROLL).
740  * @window: the window which received the event.
741  * @send_event: %TRUE if the event was sent explicitly (e.g. using
742  *   <function>XSendEvent</function>).
743  * @time: the time of the event in milliseconds.
744  * @x: the x coordinate of the pointer relative to the window.
745  * @y: the y coordinate of the pointer relative to the window.
746  * @state: (type GdkModifierType): a bit-mask representing the state of
747  *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
748  *   buttons. See #GdkModifierType.
749  * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
750  *   %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
751  *   %GDK_SCROLL_SMOOTH).
752  * @device: the device where the event originated.
753  * @x_root: the x coordinate of the pointer relative to the root of the
754  *   screen.
755  * @y_root: the y coordinate of the pointer relative to the root of the
756  *   screen.
757  *
758  * Generated from button presses for the buttons 4 to 7. Wheel mice are
759  * usually configured to generate button press events for buttons 4 and 5
760  * when the wheel is turned.
761  *
762  * Some GDK backends can also generate 'smooth' scroll events, which
763  * can be recognized by the %GDK_SCROLL_SMOOTH scroll direction. For
764  * these, the scroll deltas can be obtained with
765  * gdk_event_get_scroll_deltas().
766  */
767 struct _GdkEventScroll
768 {
769   GdkEventType type;
770   GdkWindow *window;
771   gint8 send_event;
772   guint32 time;
773   gdouble x;
774   gdouble y;
775   guint state;
776   GdkScrollDirection direction;
777   GdkDevice *device;
778   gdouble x_root, y_root;
779   gdouble delta_x;
780   gdouble delta_y;
781 };
782
783 /**
784  * GdkEventKey:
785  * @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
786  * @window: the window which received the event.
787  * @send_event: %TRUE if the event was sent explicitly (e.g. using
788  *   <function>XSendEvent</function>).
789  * @time: the time of the event in milliseconds.
790  * @state: (type GdkModifierType): a bit-mask representing the state of
791  *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
792  *   buttons. See #GdkModifierType.
793  * @keyval: the key that was pressed or released. See the
794  *   <filename>&lt;gdk/gdkkeysyms.h&gt;</filename> header file for a
795  *   complete list of GDK key codes.
796  * @length: the length of @string.
797  * @string: a string containing the an approximation of the text that
798  *   would result from this keypress. The only correct way to handle text
799  *   input of text is using input methods (see #GtkIMContext), so this
800  *   field is deprecated and should never be used.
801  *   (gdk_unicode_to_keyval() provides a non-deprecated way of getting
802  *   an approximate translation for a key.) The string is encoded in the
803  *   encoding of the current locale (Note: this for backwards compatibility:
804  *   strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
805  *   In some cases, the translation of the key code will be a single
806  *   NUL byte, in which case looking at @length is necessary to distinguish
807  *   it from the an empty translation.
808  * @hardware_keycode: the raw code of the key that was pressed or released.
809  * @group: the keyboard group.
810  * @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
811  *   modifier. Since 2.10
812  *
813  * Describes a key press or key release event.
814  */
815 struct _GdkEventKey
816 {
817   GdkEventType type;
818   GdkWindow *window;
819   gint8 send_event;
820   guint32 time;
821   guint state;
822   guint keyval;
823   gint length;
824   gchar *string;
825   guint16 hardware_keycode;
826   guint8 group;
827   guint is_modifier : 1;
828 };
829
830 /**
831  * GdkEventCrossing:
832  * @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
833  * @window: the window which received the event.
834  * @send_event: %TRUE if the event was sent explicitly (e.g. using
835  *  <function>XSendEvent</function>).
836  * @subwindow: the window that was entered or left.
837  * @time: the time of the event in milliseconds.
838  * @x: the x coordinate of the pointer relative to the window.
839  * @y: the y coordinate of the pointer relative to the window.
840  * @x_root: the x coordinate of the pointer relative to the root of the screen.
841  * @y_root: the y coordinate of the pointer relative to the root of the screen.
842  * @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
843  *  %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
844  *  %GDK_CROSSING_STATE_CHANGED).  %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
845  *  and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
846  *  never native.
847  * @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
848  *  %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
849  *  %GDK_NOTIFY_NONLINEAR_VIRTUAL).
850  * @focus: %TRUE if @window is the focus window or an inferior.
851  * @state: (type GdkModifierType): a bit-mask representing the state of
852  *   the modifier keys (e.g. Control, Shift and Alt) and the pointer
853  *   buttons. See #GdkModifierType.
854  *
855  * Generated when the pointer enters or leaves a window.
856  */
857 struct _GdkEventCrossing
858 {
859   GdkEventType type;
860   GdkWindow *window;
861   gint8 send_event;
862   GdkWindow *subwindow;
863   guint32 time;
864   gdouble x;
865   gdouble y;
866   gdouble x_root;
867   gdouble y_root;
868   GdkCrossingMode mode;
869   GdkNotifyType detail;
870   gboolean focus;
871   guint state;
872 };
873
874 /**
875  * GdkEventFocus:
876  * @type: the type of the event (%GDK_FOCUS_CHANGE).
877  * @window: the window which received the event.
878  * @send_event: %TRUE if the event was sent explicitly (e.g. using
879  *   <function>XSendEvent</function>).
880  * @in: %TRUE if the window has gained the keyboard focus, %FALSE if
881  *   it has lost the focus.
882  *
883  * Describes a change of keyboard focus.
884  */
885 struct _GdkEventFocus
886 {
887   GdkEventType type;
888   GdkWindow *window;
889   gint8 send_event;
890   gint16 in;
891 };
892
893 /**
894  * GdkEventConfigure:
895  * @type: the type of the event (%GDK_CONFIGURE).
896  * @window: the window which received the event.
897  * @send_event: %TRUE if the event was sent explicitly (e.g. using
898  *   <function>XSendEvent</function>).
899  * @x: the new x coordinate of the window, relative to its parent.
900  * @y: the new y coordinate of the window, relative to its parent.
901  * @width: the new width of the window.
902  * @height: the new height of the window.
903  *
904  * Generated when a window size or position has changed.
905  */
906 struct _GdkEventConfigure
907 {
908   GdkEventType type;
909   GdkWindow *window;
910   gint8 send_event;
911   gint x, y;
912   gint width;
913   gint height;
914 };
915
916 /**
917  * GdkEventProperty:
918  * @type: the type of the event (%GDK_PROPERTY_NOTIFY).
919  * @window: the window which received the event.
920  * @send_event: %TRUE if the event was sent explicitly (e.g. using
921  *   <function>XSendEvent</function>).
922  * @atom: the property that was changed.
923  * @time: the time of the event in milliseconds.
924  * @state: (type GdkPropertyState): whether the property was changed
925  *   (%GDK_PROPERTY_NEW_VALUE) or deleted (%GDK_PROPERTY_DELETE).
926  *
927  * Describes a property change on a window.
928  */
929 struct _GdkEventProperty
930 {
931   GdkEventType type;
932   GdkWindow *window;
933   gint8 send_event;
934   GdkAtom atom;
935   guint32 time;
936   guint state;
937 };
938
939 /**
940  * GdkEventSelection:
941  * @type: the type of the event (%GDK_SELECTION_CLEAR,
942  *   %GDK_SELECTION_NOTIFY or %GDK_SELECTION_REQUEST).
943  * @window: the window which received the event.
944  * @send_event: %TRUE if the event was sent explicitly (e.g. using
945  *   <function>XSendEvent</function>).
946  * @selection: the selection.
947  * @target: the target to which the selection should be converted.
948  * @property: the property in which to place the result of the conversion.
949  * @time: the time of the event in milliseconds.
950  * @requestor: the window on which to place @property or %NULL if none.
951  *
952  * Generated when a selection is requested or ownership of a selection
953  * is taken over by another client application.
954  */
955 struct _GdkEventSelection
956 {
957   GdkEventType type;
958   GdkWindow *window;
959   gint8 send_event;
960   GdkAtom selection;
961   GdkAtom target;
962   GdkAtom property;
963   guint32 time;
964   GdkWindow *requestor;
965 };
966
967 /**
968  * GdkEventOwnerChange:
969  * @type: the type of the event (%GDK_OWNER_CHANGE).
970  * @window: the window which received the event
971  * @send_event: %TRUE if the event was sent explicitly (e.g. using
972  *   <function>XSendEvent</function>)
973  * @owner: the new owner of the selection, or %NULL if there is none
974  * @reason: the reason for the ownership change as a #GdkOwnerChange value
975  * @selection: the atom identifying the selection
976  * @time: the timestamp of the event
977  * @selection_time: the time at which the selection ownership was taken
978  *   over
979  *
980  * Generated when the owner of a selection changes. On X11, this
981  * information is only available if the X server supports the XFIXES
982  * extension.
983  *
984  * Since: 2.6
985  */
986 struct _GdkEventOwnerChange
987 {
988   GdkEventType type;
989   GdkWindow *window;
990   gint8 send_event;
991   GdkWindow *owner;
992   GdkOwnerChange reason;
993   GdkAtom selection;
994   guint32 time;
995   guint32 selection_time;
996 };
997
998 /**
999  * GdkEventProximity:
1000  * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
1001  * @window: the window which received the event.
1002  * @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
1003  * @time: the time of the event in milliseconds.
1004  * @device: the device where the event originated.
1005  *
1006  * Proximity events are generated when using GDK's wrapper for the
1007  * XInput extension. The XInput extension is an add-on for standard X
1008  * that allows you to use nonstandard devices such as graphics tablets.
1009  * A proximity event indicates that the stylus has moved in or out of
1010  * contact with the tablet, or perhaps that the user's finger has moved
1011  * in or out of contact with a touch screen.
1012  *
1013  * This event type will be used pretty rarely. It only is important for
1014  * XInput aware programs that are drawing their own cursor.
1015  */
1016 struct _GdkEventProximity
1017 {
1018   GdkEventType type;
1019   GdkWindow *window;
1020   gint8 send_event;
1021   guint32 time;
1022   GdkDevice *device;
1023 };
1024
1025 /**
1026  * GdkEventSetting:
1027  * @type: the type of the event (%GDK_SETTING).
1028  * @window: the window which received the event.
1029  * @send_event: %TRUE if the event was sent explicitly (e.g. using
1030  *   <function>XSendEvent</function>).
1031  * @action: what happened to the setting (%GDK_SETTING_ACTION_NEW,
1032  *   %GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
1033  * @name: the name of the setting.
1034  *
1035  * Generated when a setting is modified.
1036  */
1037 struct _GdkEventSetting
1038 {
1039   GdkEventType type;
1040   GdkWindow *window;
1041   gint8 send_event;
1042   GdkSettingAction action;
1043   char *name;
1044 };
1045
1046 /**
1047  * GdkEventWindowState:
1048  * @type: the type of the event (%GDK_WINDOW_STATE).
1049  * @window: the window which received the event.
1050  * @send_event: %TRUE if the event was sent explicitly (e.g. using
1051  *   <function>XSendEvent</function>).
1052  * @changed_mask: mask specifying what flags have changed.
1053  * @new_window_state: the new window state, a combination of
1054  *   #GdkWindowState bits.
1055  *
1056  * Generated when the state of a toplevel window changes.
1057  */
1058 struct _GdkEventWindowState
1059 {
1060   GdkEventType type;
1061   GdkWindow *window;
1062   gint8 send_event;
1063   GdkWindowState changed_mask;
1064   GdkWindowState new_window_state;
1065 };
1066
1067 /**
1068  * GdkEventGrabBroken:
1069  * @type: the type of the event (%GDK_GRAB_BROKEN)
1070  * @window: the window which received the event, i.e. the window
1071  *   that previously owned the grab
1072  * @send_event: %TRUE if the event was sent explicitly (e.g. using
1073  *   <function>XSendEvent</function>).
1074  * @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
1075  *   grab was broken
1076  * @implicit: %TRUE if the broken grab was implicit
1077  * @grab_window: If this event is caused by another grab in the same
1078  *   application, @grab_window contains the new grab window. Otherwise
1079  *   @grab_window is %NULL.
1080  *
1081  * Generated when a pointer or keyboard grab is broken. On X11, this happens
1082  * when the grab window becomes unviewable (i.e. it or one of its ancestors
1083  * is unmapped), or if the same application grabs the pointer or keyboard
1084  * again. Note that implicit grabs (which are initiated by button presses)
1085  * can also cause #GdkEventGrabBroken events.
1086  *
1087  * Since: 2.8
1088  */
1089 struct _GdkEventGrabBroken {
1090   GdkEventType type;
1091   GdkWindow *window;
1092   gint8 send_event;
1093   gboolean keyboard;
1094   gboolean implicit;
1095   GdkWindow *grab_window;
1096 };
1097
1098 /**
1099  * GdkEventDND:
1100  * @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
1101  *   %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
1102  *   %GDK_DROP_FINISHED).
1103  * @window: the window which received the event.
1104  * @send_event: %TRUE if the event was sent explicitly (e.g. using
1105  *   <function>XSendEvent</function>).
1106  * @context: the #GdkDragContext for the current DND operation.
1107  * @time: the time of the event in milliseconds.
1108  * @x_root: the x coordinate of the pointer relative to the root of the
1109  *   screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
1110  * @y_root: the y coordinate of the pointer relative to the root of the
1111  *   screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
1112  *
1113  * Generated during DND operations.
1114  */
1115 struct _GdkEventDND {
1116   GdkEventType type;
1117   GdkWindow *window;
1118   gint8 send_event;
1119   GdkDragContext *context;
1120
1121   guint32 time;
1122   gshort x_root, y_root;
1123 };
1124
1125 /**
1126  * GdkEvent:
1127  *
1128  * The #GdkEvent struct contains a union of all of the event structs,
1129  * and allows access to the data fields in a number of ways.
1130  *
1131  * The event type is always the first field in all of the event structs, and
1132  * can always be accessed with the following code, no matter what type of
1133  * event it is:
1134  * <informalexample>
1135  * <programlisting>
1136  *   GdkEvent *event;
1137  *   GdkEventType type;
1138  *
1139  *   type = event->type;
1140  * </programlisting>
1141  * </informalexample>
1142  *
1143  * To access other fields of the event structs, the pointer to the event
1144  * can be cast to the appropriate event struct pointer, or the union member
1145  * name can be used. For example if the event type is %GDK_BUTTON_PRESS
1146  * then the x coordinate of the button press can be accessed with:
1147  * <informalexample>
1148  * <programlisting>
1149  *   GdkEvent *event;
1150  *   gdouble x;
1151  *
1152  *   x = ((GdkEventButton*)event)->x;
1153  * </programlisting>
1154  * </informalexample>
1155  * or:
1156  * <informalexample>
1157  * <programlisting>
1158  *   GdkEvent *event;
1159  *   gdouble x;
1160  *
1161  *   x = event->button.x;
1162  * </programlisting>
1163  * </informalexample>
1164  */
1165 union _GdkEvent
1166 {
1167   GdkEventType              type;
1168   GdkEventAny               any;
1169   GdkEventExpose            expose;
1170   GdkEventVisibility        visibility;
1171   GdkEventMotion            motion;
1172   GdkEventButton            button;
1173   GdkEventTouch             touch;
1174   GdkEventScroll            scroll;
1175   GdkEventKey               key;
1176   GdkEventCrossing          crossing;
1177   GdkEventFocus             focus_change;
1178   GdkEventConfigure         configure;
1179   GdkEventProperty          property;
1180   GdkEventSelection         selection;
1181   GdkEventOwnerChange       owner_change;
1182   GdkEventProximity         proximity;
1183   GdkEventDND               dnd;
1184   GdkEventWindowState       window_state;
1185   GdkEventSetting           setting;
1186   GdkEventGrabBroken        grab_broken;
1187 };
1188
1189 GType     gdk_event_get_type            (void) G_GNUC_CONST;
1190
1191 gboolean  gdk_events_pending            (void);
1192 GdkEvent* gdk_event_get                 (void);
1193
1194 GdkEvent* gdk_event_peek                (void);
1195 void      gdk_event_put                 (const GdkEvent *event);
1196
1197 GdkEvent* gdk_event_new                 (GdkEventType    type);
1198 GdkEvent* gdk_event_copy                (const GdkEvent *event);
1199 void      gdk_event_free                (GdkEvent       *event);
1200
1201 guint32   gdk_event_get_time            (const GdkEvent  *event);
1202 gboolean  gdk_event_get_state           (const GdkEvent  *event,
1203                                          GdkModifierType *state);
1204 gboolean  gdk_event_get_coords          (const GdkEvent  *event,
1205                                          gdouble         *x_win,
1206                                          gdouble         *y_win);
1207 gboolean  gdk_event_get_root_coords     (const GdkEvent *event,
1208                                          gdouble        *x_root,
1209                                          gdouble        *y_root);
1210 GDK_AVAILABLE_IN_3_2
1211 gboolean  gdk_event_get_button          (const GdkEvent *event,
1212                                          guint          *button);
1213 GDK_AVAILABLE_IN_3_2
1214 gboolean  gdk_event_get_click_count     (const GdkEvent *event,
1215                                          guint          *click_count);
1216 GDK_AVAILABLE_IN_3_2
1217 gboolean  gdk_event_get_keyval          (const GdkEvent *event,
1218                                          guint          *keyval);
1219 GDK_AVAILABLE_IN_3_2
1220 gboolean  gdk_event_get_keycode         (const GdkEvent *event,
1221                                          guint16        *keycode);
1222 GDK_AVAILABLE_IN_3_2
1223 gboolean gdk_event_get_scroll_direction (const GdkEvent *event,
1224                                          GdkScrollDirection *direction);
1225 GDK_AVAILABLE_IN_3_4
1226 gboolean  gdk_event_get_scroll_deltas   (const GdkEvent *event,
1227                                          gdouble         *delta_x,
1228                                          gdouble         *delta_y);
1229
1230 gboolean  gdk_event_get_axis            (const GdkEvent  *event,
1231                                          GdkAxisUse       axis_use,
1232                                          gdouble         *value);
1233 void       gdk_event_set_device         (GdkEvent        *event,
1234                                          GdkDevice       *device);
1235 GdkDevice* gdk_event_get_device         (const GdkEvent  *event);
1236 void       gdk_event_set_source_device  (GdkEvent        *event,
1237                                          GdkDevice       *device);
1238 GdkDevice* gdk_event_get_source_device  (const GdkEvent  *event);
1239 void       gdk_event_request_motions    (const GdkEventMotion *event);
1240 GDK_AVAILABLE_IN_3_4
1241 gboolean   gdk_event_triggers_context_menu (const GdkEvent *event);
1242
1243 gboolean  gdk_events_get_distance       (GdkEvent        *event1,
1244                                          GdkEvent        *event2,
1245                                          gdouble         *distance);
1246 gboolean  gdk_events_get_angle          (GdkEvent        *event1,
1247                                          GdkEvent        *event2,
1248                                          gdouble         *angle);
1249 gboolean  gdk_events_get_center         (GdkEvent        *event1,
1250                                          GdkEvent        *event2,
1251                                          gdouble         *x,
1252                                          gdouble         *y);
1253
1254 void      gdk_event_handler_set         (GdkEventFunc    func,
1255                                          gpointer        data,
1256                                          GDestroyNotify  notify);
1257
1258 void       gdk_event_set_screen         (GdkEvent        *event,
1259                                          GdkScreen       *screen);
1260 GdkScreen *gdk_event_get_screen         (const GdkEvent  *event);
1261
1262 GDK_AVAILABLE_IN_3_4
1263 GdkEventSequence *gdk_event_get_event_sequence (const GdkEvent *event);
1264
1265 void      gdk_set_show_events           (gboolean        show_events);
1266 gboolean  gdk_get_show_events           (void);
1267
1268 #ifndef GDK_MULTIHEAD_SAFE
1269
1270 gboolean gdk_setting_get                           (const gchar *name,
1271                                                     GValue          *value);
1272
1273 #endif /* GDK_MULTIHEAD_SAFE */
1274
1275 G_END_DECLS
1276
1277 #endif /* __GDK_EVENTS_H__ */