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