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