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: (value 120)
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. Since 3.22.23, this
524 * is deprecated in favor of per-edge information.
525 * @GDK_WINDOW_STATE_TOP_TILED: whether the top edge is tiled, Since 3.22.23
526 * @GDK_WINDOW_STATE_TOP_RESIZABLE: whether the top edge is resizable, Since 3.22.23
527 * @GDK_WINDOW_STATE_RIGHT_TILED: whether the right edge is tiled, Since 3.22.23
528 * @GDK_WINDOW_STATE_RIGHT_RESIZABLE: whether the right edge is resizable, Since 3.22.23
529 * @GDK_WINDOW_STATE_BOTTOM_TILED: whether the bottom edge is tiled, Since 3.22.23
530 * @GDK_WINDOW_STATE_BOTTOM_RESIZABLE: whether the bottom edge is resizable, Since 3.22.23
531 * @GDK_WINDOW_STATE_LEFT_TILED: whether the left edge is tiled, Since 3.22.23
532 * @GDK_WINDOW_STATE_LEFT_RESIZABLE: whether the left edge is resizable, Since 3.22.23
533 *
534 * Specifies the state of a toplevel window.
535 */
536typedef enum
537{
538 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
539 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
540 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
541 GDK_WINDOW_STATE_STICKY = 1 << 3,
542 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
543 GDK_WINDOW_STATE_ABOVE = 1 << 5,
544 GDK_WINDOW_STATE_BELOW = 1 << 6,
545 GDK_WINDOW_STATE_FOCUSED = 1 << 7,
546 GDK_WINDOW_STATE_TILED = 1 << 8,
547 GDK_WINDOW_STATE_TOP_TILED = 1 << 9,
548 GDK_WINDOW_STATE_TOP_RESIZABLE = 1 << 10,
549 GDK_WINDOW_STATE_RIGHT_TILED = 1 << 11,
550 GDK_WINDOW_STATE_RIGHT_RESIZABLE = 1 << 12,
551 GDK_WINDOW_STATE_BOTTOM_TILED = 1 << 13,
552 GDK_WINDOW_STATE_BOTTOM_RESIZABLE = 1 << 14,
553 GDK_WINDOW_STATE_LEFT_TILED = 1 << 15,
554 GDK_WINDOW_STATE_LEFT_RESIZABLE = 1 << 16
555} GdkWindowState;
556
557/**
558 * GdkSettingAction:
559 * @GDK_SETTING_ACTION_NEW: a setting was added.
560 * @GDK_SETTING_ACTION_CHANGED: a setting was changed.
561 * @GDK_SETTING_ACTION_DELETED: a setting was deleted.
562 *
563 * Specifies the kind of modification applied to a setting in a
564 * #GdkEventSetting.
565 */
566typedef enum
567{
568 GDK_SETTING_ACTION_NEW,
569 GDK_SETTING_ACTION_CHANGED,
570 GDK_SETTING_ACTION_DELETED
571} GdkSettingAction;
572
573/**
574 * GdkOwnerChange:
575 * @GDK_OWNER_CHANGE_NEW_OWNER: some other app claimed the ownership
576 * @GDK_OWNER_CHANGE_DESTROY: the window was destroyed
577 * @GDK_OWNER_CHANGE_CLOSE: the client was closed
578 *
579 * Specifies why a selection ownership was changed.
580 */
581typedef enum
582{
583 GDK_OWNER_CHANGE_NEW_OWNER,
584 GDK_OWNER_CHANGE_DESTROY,
585 GDK_OWNER_CHANGE_CLOSE
586} GdkOwnerChange;
587
588/**
589 * GdkEventAny:
590 * @type: the type of the event.
591 * @window: the window which received the event.
592 * @send_event: %TRUE if the event was sent explicitly.
593 *
594 * Contains the fields which are common to all event structs.
595 * Any event pointer can safely be cast to a pointer to a #GdkEventAny to
596 * access these fields.
597 */
598struct _GdkEventAny
599{
600 GdkEventType type;
601 GdkWindow *window;
602 gint8 send_event;
603};
604
605/**
606 * GdkEventExpose:
607 * @type: the type of the event (%GDK_EXPOSE or %GDK_DAMAGE).
608 * @window: the window which received the event.
609 * @send_event: %TRUE if the event was sent explicitly.
610 * @area: bounding box of @region.
611 * @region: the region that needs to be redrawn.
612 * @count: the number of contiguous %GDK_EXPOSE events following this one.
613 * The only use for this is “exposure compression”, i.e. handling all
614 * contiguous %GDK_EXPOSE events in one go, though GDK performs some
615 * exposure compression so this is not normally needed.
616 *
617 * Generated when all or part of a window becomes visible and needs to be
618 * redrawn.
619 */
620struct _GdkEventExpose
621{
622 GdkEventType type;
623 GdkWindow *window;
624 gint8 send_event;
625 GdkRectangle area;
626 cairo_region_t *region;
627 gint count; /* If non-zero, how many more events follow. */
628};
629
630/**
631 * GdkEventVisibility:
632 * @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
633 * @window: the window which received the event.
634 * @send_event: %TRUE if the event was sent explicitly.
635 * @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
636 * %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
637 *
638 * Generated when the window visibility status has changed.
639 *
640 * Deprecated: 3.12: Modern composited windowing systems with pervasive
641 * transparency make it impossible to track the visibility of a window
642 * reliably, so this event can not be guaranteed to provide useful
643 * information.
644 */
645struct _GdkEventVisibility
646{
647 GdkEventType type;
648 GdkWindow *window;
649 gint8 send_event;
650 GdkVisibilityState state;
651};
652
653/**
654 * GdkEventMotion:
655 * @type: the type of the event.
656 * @window: the window which received the event.
657 * @send_event: %TRUE if the event was sent explicitly.
658 * @time: the time of the event in milliseconds.
659 * @x: the x coordinate of the pointer relative to the window.
660 * @y: the y coordinate of the pointer relative to the window.
661 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
662 * the mouse.
663 * @state: (type GdkModifierType): a bit-mask representing the state of
664 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
665 * buttons. See #GdkModifierType.
666 * @is_hint: set to 1 if this event is just a hint, see the
667 * %GDK_POINTER_MOTION_HINT_MASK value of #GdkEventMask.
668 * @device: the master device that the event originated from. Use
669 * gdk_event_get_source_device() to get the slave device.
670 * @x_root: the x coordinate of the pointer relative to the root of the
671 * screen.
672 * @y_root: the y coordinate of the pointer relative to the root of the
673 * screen.
674 *
675 * Generated when the pointer moves.
676 */
677struct _GdkEventMotion
678{
679 GdkEventType type;
680 GdkWindow *window;
681 gint8 send_event;
682 guint32 time;
683 gdouble x;
684 gdouble y;
685 gdouble *axes;
686 guint state;
687 gint16 is_hint;
688 GdkDevice *device;
689 gdouble x_root, y_root;
690};
691
692/**
693 * GdkEventButton:
694 * @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
695 * %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
696 * @window: the window which received the event.
697 * @send_event: %TRUE if the event was sent explicitly.
698 * @time: the time of the event in milliseconds.
699 * @x: the x coordinate of the pointer relative to the window.
700 * @y: the y coordinate of the pointer relative to the window.
701 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
702 * the mouse.
703 * @state: (type GdkModifierType): a bit-mask representing the state of
704 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
705 * buttons. See #GdkModifierType.
706 * @button: the button which was pressed or released, numbered from 1 to 5.
707 * Normally button 1 is the left mouse button, 2 is the middle button,
708 * and 3 is the right button. On 2-button mice, the middle button can
709 * often be simulated by pressing both mouse buttons together.
710 * @device: the master device that the event originated from. Use
711 * gdk_event_get_source_device() to get the slave device.
712 * @x_root: the x coordinate of the pointer relative to the root of the
713 * screen.
714 * @y_root: the y coordinate of the pointer relative to the root of the
715 * screen.
716 *
717 * Used for button press and button release events. The
718 * @type field will be one of %GDK_BUTTON_PRESS,
719 * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE,
720 *
721 * Double and triple-clicks result in a sequence of events being received.
722 * For double-clicks the order of events will be:
723 *
724 * - %GDK_BUTTON_PRESS
725 * - %GDK_BUTTON_RELEASE
726 * - %GDK_BUTTON_PRESS
727 * - %GDK_2BUTTON_PRESS
728 * - %GDK_BUTTON_RELEASE
729 *
730 * Note that the first click is received just like a normal
731 * button press, while the second click results in a %GDK_2BUTTON_PRESS
732 * being received just after the %GDK_BUTTON_PRESS.
733 *
734 * Triple-clicks are very similar to double-clicks, except that
735 * %GDK_3BUTTON_PRESS is inserted after the third click. The order of the
736 * events is:
737 *
738 * - %GDK_BUTTON_PRESS
739 * - %GDK_BUTTON_RELEASE
740 * - %GDK_BUTTON_PRESS
741 * - %GDK_2BUTTON_PRESS
742 * - %GDK_BUTTON_RELEASE
743 * - %GDK_BUTTON_PRESS
744 * - %GDK_3BUTTON_PRESS
745 * - %GDK_BUTTON_RELEASE
746 *
747 * For a double click to occur, the second button press must occur within
748 * 1/4 of a second of the first. For a triple click to occur, the third
749 * button press must also occur within 1/2 second of the first button press.
750 */
751struct _GdkEventButton
752{
753 GdkEventType type;
754 GdkWindow *window;
755 gint8 send_event;
756 guint32 time;
757 gdouble x;
758 gdouble y;
759 gdouble *axes;
760 guint state;
761 guint button;
762 GdkDevice *device;
763 gdouble x_root, y_root;
764};
765
766/**
767 * GdkEventTouch:
768 * @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
769 * %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
770 * @window: the window which received the event
771 * @send_event: %TRUE if the event was sent explicitly.
772 * @time: the time of the event in milliseconds.
773 * @x: the x coordinate of the pointer relative to the window
774 * @y: the y coordinate of the pointer relative to the window
775 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
776 * the mouse
777 * @state: (type GdkModifierType): a bit-mask representing the state of
778 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
779 * buttons. See #GdkModifierType
780 * @sequence: the event sequence that the event belongs to
781 * @emulating_pointer: whether the event should be used for emulating
782 * pointer event
783 * @device: the master device that the event originated from. Use
784 * gdk_event_get_source_device() to get the slave device.
785 * @x_root: the x coordinate of the pointer relative to the root of the
786 * screen
787 * @y_root: the y coordinate of the pointer relative to the root of the
788 * screen
789 *
790 * Used for touch events.
791 * @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
792 * %GDK_TOUCH_END or %GDK_TOUCH_CANCEL.
793 *
794 * Touch events are grouped into sequences by means of the @sequence
795 * field, which can also be obtained with gdk_event_get_event_sequence().
796 * Each sequence begins with a %GDK_TOUCH_BEGIN event, followed by
797 * any number of %GDK_TOUCH_UPDATE events, and ends with a %GDK_TOUCH_END
798 * (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
799 * several active sequences at the same time.
800 */
801struct _GdkEventTouch
802{
803 GdkEventType type;
804 GdkWindow *window;
805 gint8 send_event;
806 guint32 time;
807 gdouble x;
808 gdouble y;
809 gdouble *axes;
810 guint state;
811 GdkEventSequence *sequence;
812 gboolean emulating_pointer;
813 GdkDevice *device;
814 gdouble x_root, y_root;
815};
816
817/**
818 * GdkEventScroll:
819 * @type: the type of the event (%GDK_SCROLL).
820 * @window: the window which received the event.
821 * @send_event: %TRUE if the event was sent explicitly.
822 * @time: the time of the event in milliseconds.
823 * @x: the x coordinate of the pointer relative to the window.
824 * @y: the y coordinate of the pointer relative to the window.
825 * @state: (type GdkModifierType): a bit-mask representing the state of
826 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
827 * buttons. See #GdkModifierType.
828 * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
829 * %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
830 * %GDK_SCROLL_SMOOTH).
831 * @device: the master device that the event originated from. Use
832 * gdk_event_get_source_device() to get the slave device.
833 * @x_root: the x coordinate of the pointer relative to the root of the
834 * screen.
835 * @y_root: the y coordinate of the pointer relative to the root of the
836 * screen.
837 * @delta_x: the x coordinate of the scroll delta
838 * @delta_y: the y coordinate of the scroll delta
839 *
840 * Generated from button presses for the buttons 4 to 7. Wheel mice are
841 * usually configured to generate button press events for buttons 4 and 5
842 * when the wheel is turned.
843 *
844 * Some GDK backends can also generate “smooth” scroll events, which
845 * can be recognized by the %GDK_SCROLL_SMOOTH scroll direction. For
846 * these, the scroll deltas can be obtained with
847 * gdk_event_get_scroll_deltas().
848 */
849struct _GdkEventScroll
850{
851 GdkEventType type;
852 GdkWindow *window;
853 gint8 send_event;
854 guint32 time;
855 gdouble x;
856 gdouble y;
857 guint state;
858 GdkScrollDirection direction;
859 GdkDevice *device;
860 gdouble x_root, y_root;
861 gdouble delta_x;
862 gdouble delta_y;
863 guint is_stop : 1;
864};
865
866/**
867 * GdkEventKey:
868 * @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
869 * @window: the window which received the event.
870 * @send_event: %TRUE if the event was sent explicitly.
871 * @time: the time of the event in milliseconds.
872 * @state: (type GdkModifierType): a bit-mask representing the state of
873 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
874 * buttons. See #GdkModifierType.
875 * @keyval: the key that was pressed or released. See the
876 * `gdk/gdkkeysyms.h` header file for a
877 * complete list of GDK key codes.
878 * @length: the length of @string.
879 * @string: a string containing an approximation of the text that
880 * would result from this keypress. The only correct way to handle text
881 * input of text is using input methods (see #GtkIMContext), so this
882 * field is deprecated and should never be used.
883 * (gdk_unicode_to_keyval() provides a non-deprecated way of getting
884 * an approximate translation for a key.) The string is encoded in the
885 * encoding of the current locale (Note: this for backwards compatibility:
886 * strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
887 * In some cases, the translation of the key code will be a single
888 * NUL byte, in which case looking at @length is necessary to distinguish
889 * it from the an empty translation.
890 * @hardware_keycode: the raw code of the key that was pressed or released.
891 * @group: the keyboard group.
892 * @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
893 * modifier. Since 2.10
894 *
895 * Describes a key press or key release event.
896 */
897struct _GdkEventKey
898{
899 GdkEventType type;
900 GdkWindow *window;
901 gint8 send_event;
902 guint32 time;
903 guint state;
904 guint keyval;
905 gint length;
906 gchar *string;
907 guint16 hardware_keycode;
908 guint8 group;
909 guint is_modifier : 1;
910};
911
912/**
913 * GdkEventCrossing:
914 * @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
915 * @window: the window which received the event.
916 * @send_event: %TRUE if the event was sent explicitly.
917 * @subwindow: the window that was entered or left.
918 * @time: the time of the event in milliseconds.
919 * @x: the x coordinate of the pointer relative to the window.
920 * @y: the y coordinate of the pointer relative to the window.
921 * @x_root: the x coordinate of the pointer relative to the root of the screen.
922 * @y_root: the y coordinate of the pointer relative to the root of the screen.
923 * @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
924 * %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
925 * %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
926 * and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
927 * never native.
928 * @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
929 * %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
930 * %GDK_NOTIFY_NONLINEAR_VIRTUAL).
931 * @focus: %TRUE if @window is the focus window or an inferior.
932 * @state: (type GdkModifierType): a bit-mask representing the state of
933 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
934 * buttons. See #GdkModifierType.
935 *
936 * Generated when the pointer enters or leaves a window.
937 */
938struct _GdkEventCrossing
939{
940 GdkEventType type;
941 GdkWindow *window;
942 gint8 send_event;
943 GdkWindow *subwindow;
944 guint32 time;
945 gdouble x;
946 gdouble y;
947 gdouble x_root;
948 gdouble y_root;
949 GdkCrossingMode mode;
950 GdkNotifyType detail;
951 gboolean focus;
952 guint state;
953};
954
955/**
956 * GdkEventFocus:
957 * @type: the type of the event (%GDK_FOCUS_CHANGE).
958 * @window: the window which received the event.
959 * @send_event: %TRUE if the event was sent explicitly.
960 * @in: %TRUE if the window has gained the keyboard focus, %FALSE if
961 * it has lost the focus.
962 *
963 * Describes a change of keyboard focus.
964 */
965struct _GdkEventFocus
966{
967 GdkEventType type;
968 GdkWindow *window;
969 gint8 send_event;
970 gint16 in;
971};
972
973/**
974 * GdkEventConfigure:
975 * @type: the type of the event (%GDK_CONFIGURE).
976 * @window: the window which received the event.
977 * @send_event: %TRUE if the event was sent explicitly.
978 * @x: the new x coordinate of the window, relative to its parent.
979 * @y: the new y coordinate of the window, relative to its parent.
980 * @width: the new width of the window.
981 * @height: the new height of the window.
982 *
983 * Generated when a window size or position has changed.
984 */
985struct _GdkEventConfigure
986{
987 GdkEventType type;
988 GdkWindow *window;
989 gint8 send_event;
990 gint x, y;
991 gint width;
992 gint height;
993};
994
995/**
996 * GdkEventProperty:
997 * @type: the type of the event (%GDK_PROPERTY_NOTIFY).
998 * @window: the window which received the event.
999 * @send_event: %TRUE if the event was sent explicitly.
1000 * @atom: the property that was changed.
1001 * @time: the time of the event in milliseconds.
1002 * @state: (type GdkPropertyState): whether the property was changed
1003 * (%GDK_PROPERTY_NEW_VALUE) or deleted (%GDK_PROPERTY_DELETE).
1004 *
1005 * Describes a property change on a window.
1006 */
1007struct _GdkEventProperty
1008{
1009 GdkEventType type;
1010 GdkWindow *window;
1011 gint8 send_event;
1012 GdkAtom atom;
1013 guint32 time;
1014 guint state;
1015};
1016
1017/**
1018 * GdkEventSelection:
1019 * @type: the type of the event (%GDK_SELECTION_CLEAR,
1020 * %GDK_SELECTION_NOTIFY or %GDK_SELECTION_REQUEST).
1021 * @window: the window which received the event.
1022 * @send_event: %TRUE if the event was sent explicitly.
1023 * @selection: the selection.
1024 * @target: the target to which the selection should be converted.
1025 * @property: the property in which to place the result of the conversion.
1026 * @time: the time of the event in milliseconds.
1027 * @requestor: the window on which to place @property or %NULL if none.
1028 *
1029 * Generated when a selection is requested or ownership of a selection
1030 * is taken over by another client application.
1031 */
1032struct _GdkEventSelection
1033{
1034 GdkEventType type;
1035 GdkWindow *window;
1036 gint8 send_event;
1037 GdkAtom selection;
1038 GdkAtom target;
1039 GdkAtom property;
1040 guint32 time;
1041 GdkWindow *requestor;
1042};
1043
1044/**
1045 * GdkEventOwnerChange:
1046 * @type: the type of the event (%GDK_OWNER_CHANGE).
1047 * @window: the window which received the event
1048 * @send_event: %TRUE if the event was sent explicitly.
1049 * @owner: the new owner of the selection, or %NULL if there is none
1050 * @reason: the reason for the ownership change as a #GdkOwnerChange value
1051 * @selection: the atom identifying the selection
1052 * @time: the timestamp of the event
1053 * @selection_time: the time at which the selection ownership was taken
1054 * over
1055 *
1056 * Generated when the owner of a selection changes. On X11, this
1057 * information is only available if the X server supports the XFIXES
1058 * extension.
1059 *
1060 * Since: 2.6
1061 */
1062struct _GdkEventOwnerChange
1063{
1064 GdkEventType type;
1065 GdkWindow *window;
1066 gint8 send_event;
1067 GdkWindow *owner;
1068 GdkOwnerChange reason;
1069 GdkAtom selection;
1070 guint32 time;
1071 guint32 selection_time;
1072};
1073
1074/**
1075 * GdkEventProximity:
1076 * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
1077 * @window: the window which received the event.
1078 * @send_event: %TRUE if the event was sent explicitly.
1079 * @time: the time of the event in milliseconds.
1080 * @device: the master device that the event originated from. Use
1081 * gdk_event_get_source_device() to get the slave device.
1082 *
1083 * Proximity events are generated when using GDK’s wrapper for the
1084 * XInput extension. The XInput extension is an add-on for standard X
1085 * that allows you to use nonstandard devices such as graphics tablets.
1086 * A proximity event indicates that the stylus has moved in or out of
1087 * contact with the tablet, or perhaps that the user’s finger has moved
1088 * in or out of contact with a touch screen.
1089 *
1090 * This event type will be used pretty rarely. It only is important for
1091 * XInput aware programs that are drawing their own cursor.
1092 */
1093struct _GdkEventProximity
1094{
1095 GdkEventType type;
1096 GdkWindow *window;
1097 gint8 send_event;
1098 guint32 time;
1099 GdkDevice *device;
1100};
1101
1102/**
1103 * GdkEventSetting:
1104 * @type: the type of the event (%GDK_SETTING).
1105 * @window: the window which received the event.
1106 * @send_event: %TRUE if the event was sent explicitly.
1107 * @action: what happened to the setting (%GDK_SETTING_ACTION_NEW,
1108 * %GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
1109 * @name: the name of the setting.
1110 *
1111 * Generated when a setting is modified.
1112 */
1113struct _GdkEventSetting
1114{
1115 GdkEventType type;
1116 GdkWindow *window;
1117 gint8 send_event;
1118 GdkSettingAction action;
1119 char *name;
1120};
1121
1122/**
1123 * GdkEventWindowState:
1124 * @type: the type of the event (%GDK_WINDOW_STATE).
1125 * @window: the window which received the event.
1126 * @send_event: %TRUE if the event was sent explicitly.
1127 * @changed_mask: mask specifying what flags have changed.
1128 * @new_window_state: the new window state, a combination of
1129 * #GdkWindowState bits.
1130 *
1131 * Generated when the state of a toplevel window changes.
1132 */
1133struct _GdkEventWindowState
1134{
1135 GdkEventType type;
1136 GdkWindow *window;
1137 gint8 send_event;
1138 GdkWindowState changed_mask;
1139 GdkWindowState new_window_state;
1140};
1141
1142/**
1143 * GdkEventGrabBroken:
1144 * @type: the type of the event (%GDK_GRAB_BROKEN)
1145 * @window: the window which received the event, i.e. the window
1146 * that previously owned the grab
1147 * @send_event: %TRUE if the event was sent explicitly.
1148 * @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
1149 * grab was broken
1150 * @implicit: %TRUE if the broken grab was implicit
1151 * @grab_window: If this event is caused by another grab in the same
1152 * application, @grab_window contains the new grab window. Otherwise
1153 * @grab_window is %NULL.
1154 *
1155 * Generated when a pointer or keyboard grab is broken. On X11, this happens
1156 * when the grab window becomes unviewable (i.e. it or one of its ancestors
1157 * is unmapped), or if the same application grabs the pointer or keyboard
1158 * again. Note that implicit grabs (which are initiated by button presses)
1159 * can also cause #GdkEventGrabBroken events.
1160 *
1161 * Since: 2.8
1162 */
1163struct _GdkEventGrabBroken {
1164 GdkEventType type;
1165 GdkWindow *window;
1166 gint8 send_event;
1167 gboolean keyboard;
1168 gboolean implicit;
1169 GdkWindow *grab_window;
1170};
1171
1172/**
1173 * GdkEventDND:
1174 * @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
1175 * %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
1176 * %GDK_DROP_FINISHED).
1177 * @window: the window which received the event.
1178 * @send_event: %TRUE if the event was sent explicitly.
1179 * @context: the #GdkDragContext for the current DND operation.
1180 * @time: the time of the event in milliseconds.
1181 * @x_root: the x coordinate of the pointer relative to the root of the
1182 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
1183 * @y_root: the y coordinate of the pointer relative to the root of the
1184 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
1185 *
1186 * Generated during DND operations.
1187 */
1188struct _GdkEventDND {
1189 GdkEventType type;
1190 GdkWindow *window;
1191 gint8 send_event;
1192 GdkDragContext *context;
1193
1194 guint32 time;
1195 gshort x_root, y_root;
1196};
1197
1198/**
1199 * GdkEventTouchpadSwipe:
1200 * @type: the type of the event (%GDK_TOUCHPAD_SWIPE)
1201 * @window: the window which received the event
1202 * @send_event: %TRUE if the event was sent explicitly
1203 * @phase: the current phase of the gesture
1204 * @n_fingers: The number of fingers triggering the swipe
1205 * @time: the time of the event in milliseconds
1206 * @x: The X coordinate of the pointer
1207 * @y: The Y coordinate of the pointer
1208 * @dx: Movement delta in the X axis of the swipe focal point
1209 * @dy: Movement delta in the Y axis of the swipe focal point
1210 * @x_root: The X coordinate of the pointer, relative to the
1211 * root of the screen.
1212 * @y_root: The Y coordinate of the pointer, relative to the
1213 * root of the screen.
1214 * @state: (type GdkModifierType): a bit-mask representing the state of
1215 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
1216 * buttons. See #GdkModifierType.
1217 *
1218 * Generated during touchpad swipe gestures.
1219 */
1220struct _GdkEventTouchpadSwipe {
1221 GdkEventType type;
1222 GdkWindow *window;
1223 gint8 send_event;
1224 gint8 phase;
1225 gint8 n_fingers;
1226 guint32 time;
1227 gdouble x;
1228 gdouble y;
1229 gdouble dx;
1230 gdouble dy;
1231 gdouble x_root, y_root;
1232 guint state;
1233};
1234
1235/**
1236 * GdkEventTouchpadPinch:
1237 * @type: the type of the event (%GDK_TOUCHPAD_PINCH)
1238 * @window: the window which received the event
1239 * @send_event: %TRUE if the event was sent explicitly
1240 * @phase: the current phase of the gesture
1241 * @n_fingers: The number of fingers triggering the pinch
1242 * @time: the time of the event in milliseconds
1243 * @x: The X coordinate of the pointer
1244 * @y: The Y coordinate of the pointer
1245 * @dx: Movement delta in the X axis of the swipe focal point
1246 * @dy: Movement delta in the Y axis of the swipe focal point
1247 * @angle_delta: The angle change in radians, negative angles
1248 * denote counter-clockwise movements
1249 * @scale: The current scale, relative to that at the time of
1250 * the corresponding %GDK_TOUCHPAD_GESTURE_PHASE_BEGIN event
1251 * @x_root: The X coordinate of the pointer, relative to the
1252 * root of the screen.
1253 * @y_root: The Y coordinate of the pointer, relative to the
1254 * root of the screen.
1255 * @state: (type GdkModifierType): a bit-mask representing the state of
1256 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
1257 * buttons. See #GdkModifierType.
1258 *
1259 * Generated during touchpad swipe gestures.
1260 */
1261struct _GdkEventTouchpadPinch {
1262 GdkEventType type;
1263 GdkWindow *window;
1264 gint8 send_event;
1265 gint8 phase;
1266 gint8 n_fingers;
1267 guint32 time;
1268 gdouble x;
1269 gdouble y;
1270 gdouble dx;
1271 gdouble dy;
1272 gdouble angle_delta;
1273 gdouble scale;
1274 gdouble x_root, y_root;
1275 guint state;
1276};
1277
1278/**
1279 * GdkEventPadButton:
1280 * @type: the type of the event (%GDK_PAD_BUTTON_PRESS or %GDK_PAD_BUTTON_RELEASE).
1281 * @window: the window which received the event.
1282 * @send_event: %TRUE if the event was sent explicitly.
1283 * @time: the time of the event in milliseconds.
1284 * @group: the pad group the button belongs to. A %GDK_SOURCE_TABLET_PAD device
1285 * may have one or more groups containing a set of buttons/rings/strips each.
1286 * @button: The pad button that was pressed.
1287 * @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
1288 * device may have different current modes.
1289 *
1290 * Generated during %GDK_SOURCE_TABLET_PAD button presses and releases.
1291 *
1292 * Since: 3.22
1293 */
1294struct _GdkEventPadButton {
1295 GdkEventType type;
1296 GdkWindow *window;
1297 gint8 send_event;
1298 guint32 time;
1299 guint group;
1300 guint button;
1301 guint mode;
1302};
1303
1304/**
1305 * GdkEventPadAxis:
1306 * @type: the type of the event (%GDK_PAD_RING or %GDK_PAD_STRIP).
1307 * @window: the window which received the event.
1308 * @send_event: %TRUE if the event was sent explicitly.
1309 * @time: the time of the event in milliseconds.
1310 * @group: the pad group the ring/strip belongs to. A %GDK_SOURCE_TABLET_PAD
1311 * device may have one or more groups containing a set of buttons/rings/strips
1312 * each.
1313 * @index: number of strip/ring that was interacted. This number is 0-indexed.
1314 * @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
1315 * device may have different current modes.
1316 * @value: The current value for the given axis.
1317 *
1318 * Generated during %GDK_SOURCE_TABLET_PAD interaction with tactile sensors.
1319 *
1320 * Since: 3.22
1321 */
1322struct _GdkEventPadAxis {
1323 GdkEventType type;
1324 GdkWindow *window;
1325 gint8 send_event;
1326 guint32 time;
1327 guint group;
1328 guint index;
1329 guint mode;
1330 gdouble value;
1331};
1332
1333/**
1334 * GdkEventPadGroupMode:
1335 * @type: the type of the event (%GDK_PAD_GROUP_MODE).
1336 * @window: the window which received the event.
1337 * @send_event: %TRUE if the event was sent explicitly.
1338 * @time: the time of the event in milliseconds.
1339 * @group: the pad group that is switching mode. A %GDK_SOURCE_TABLET_PAD
1340 * device may have one or more groups containing a set of buttons/rings/strips
1341 * each.
1342 * @mode: The new mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
1343 * device may have different current modes.
1344 *
1345 * Generated during %GDK_SOURCE_TABLET_PAD mode switches in a group.
1346 *
1347 * Since: 3.22
1348 */
1349struct _GdkEventPadGroupMode {
1350 GdkEventType type;
1351 GdkWindow *window;
1352 gint8 send_event;
1353 guint32 time;
1354 guint group;
1355 guint mode;
1356};
1357
1358/**
1359 * GdkEvent:
1360 * @type: the #GdkEventType
1361 * @any: a #GdkEventAny
1362 * @expose: a #GdkEventExpose
1363 * @visibility: a #GdkEventVisibility
1364 * @motion: a #GdkEventMotion
1365 * @button: a #GdkEventButton
1366 * @touch: a #GdkEventTouch
1367 * @scroll: a #GdkEventScroll
1368 * @key: a #GdkEventKey
1369 * @crossing: a #GdkEventCrossing
1370 * @focus_change: a #GdkEventFocus
1371 * @configure: a #GdkEventConfigure
1372 * @property: a #GdkEventProperty
1373 * @selection: a #GdkEventSelection
1374 * @owner_change: a #GdkEventOwnerChange
1375 * @proximity: a #GdkEventProximity
1376 * @dnd: a #GdkEventDND
1377 * @window_state: a #GdkEventWindowState
1378 * @setting: a #GdkEventSetting
1379 * @grab_broken: a #GdkEventGrabBroken
1380 * @touchpad_swipe: a #GdkEventTouchpadSwipe
1381 * @touchpad_pinch: a #GdkEventTouchpadPinch
1382 * @pad_button: a #GdkEventPadButton
1383 * @pad_axis: a #GdkEventPadAxis
1384 * @pad_group_mode: a #GdkEventPadGroupMode
1385 *
1386 * A #GdkEvent contains a union of all of the event types,
1387 * and allows access to the data fields in a number of ways.
1388 *
1389 * The event type is always the first field in all of the event types, and
1390 * can always be accessed with the following code, no matter what type of
1391 * event it is:
1392 * |[<!-- language="C" -->
1393 * GdkEvent *event;
1394 * GdkEventType type;
1395 *
1396 * type = event->type;
1397 * ]|
1398 *
1399 * To access other fields of the event, the pointer to the event
1400 * can be cast to the appropriate event type, or the union member
1401 * name can be used. For example if the event type is %GDK_BUTTON_PRESS
1402 * then the x coordinate of the button press can be accessed with:
1403 * |[<!-- language="C" -->
1404 * GdkEvent *event;
1405 * gdouble x;
1406 *
1407 * x = ((GdkEventButton*)event)->x;
1408 * ]|
1409 * or:
1410 * |[<!-- language="C" -->
1411 * GdkEvent *event;
1412 * gdouble x;
1413 *
1414 * x = event->button.x;
1415 * ]|
1416 */
1417union _GdkEvent
1418{
1419 GdkEventType type;
1420 GdkEventAny any;
1421 GdkEventExpose expose;
1422 GdkEventVisibility visibility;
1423 GdkEventMotion motion;
1424 GdkEventButton button;
1425 GdkEventTouch touch;
1426 GdkEventScroll scroll;
1427 GdkEventKey key;
1428 GdkEventCrossing crossing;
1429 GdkEventFocus focus_change;
1430 GdkEventConfigure configure;
1431 GdkEventProperty property;
1432 GdkEventSelection selection;
1433 GdkEventOwnerChange owner_change;
1434 GdkEventProximity proximity;
1435 GdkEventDND dnd;
1436 GdkEventWindowState window_state;
1437 GdkEventSetting setting;
1438 GdkEventGrabBroken grab_broken;
1439 GdkEventTouchpadSwipe touchpad_swipe;
1440 GdkEventTouchpadPinch touchpad_pinch;
1441 GdkEventPadButton pad_button;
1442 GdkEventPadAxis pad_axis;
1443 GdkEventPadGroupMode pad_group_mode;
1444};
1445
1446GDK_AVAILABLE_IN_ALL
1447GType gdk_event_get_type (void) G_GNUC_CONST;
1448
1449GDK_AVAILABLE_IN_3_14
1450GType gdk_event_sequence_get_type (void) G_GNUC_CONST;
1451
1452GDK_AVAILABLE_IN_ALL
1453gboolean gdk_events_pending (void);
1454GDK_AVAILABLE_IN_ALL
1455GdkEvent* gdk_event_get (void);
1456
1457GDK_AVAILABLE_IN_ALL
1458GdkEvent* gdk_event_peek (void);
1459GDK_AVAILABLE_IN_ALL
1460void gdk_event_put (const GdkEvent *event);
1461
1462GDK_AVAILABLE_IN_ALL
1463GdkEvent* gdk_event_new (GdkEventType type);
1464GDK_AVAILABLE_IN_ALL
1465GdkEvent* gdk_event_copy (const GdkEvent *event);
1466GDK_AVAILABLE_IN_ALL
1467void gdk_event_free (GdkEvent *event);
1468
1469GDK_AVAILABLE_IN_3_10
1470GdkWindow *gdk_event_get_window (const GdkEvent *event);
1471
1472GDK_AVAILABLE_IN_ALL
1473guint32 gdk_event_get_time (const GdkEvent *event);
1474GDK_AVAILABLE_IN_ALL
1475gboolean gdk_event_get_state (const GdkEvent *event,
1476 GdkModifierType *state);
1477GDK_AVAILABLE_IN_ALL
1478gboolean gdk_event_get_coords (const GdkEvent *event,
1479 gdouble *x_win,
1480 gdouble *y_win);
1481GDK_AVAILABLE_IN_ALL
1482gboolean gdk_event_get_root_coords (const GdkEvent *event,
1483 gdouble *x_root,
1484 gdouble *y_root);
1485GDK_AVAILABLE_IN_3_2
1486gboolean gdk_event_get_button (const GdkEvent *event,
1487 guint *button);
1488GDK_AVAILABLE_IN_3_2
1489gboolean gdk_event_get_click_count (const GdkEvent *event,
1490 guint *click_count);
1491GDK_AVAILABLE_IN_3_2
1492gboolean gdk_event_get_keyval (const GdkEvent *event,
1493 guint *keyval);
1494GDK_AVAILABLE_IN_3_2
1495gboolean gdk_event_get_keycode (const GdkEvent *event,
1496 guint16 *keycode);
1497GDK_AVAILABLE_IN_3_2
1498gboolean gdk_event_get_scroll_direction (const GdkEvent *event,
1499 GdkScrollDirection *direction);
1500GDK_AVAILABLE_IN_3_4
1501gboolean gdk_event_get_scroll_deltas (const GdkEvent *event,
1502 gdouble *delta_x,
1503 gdouble *delta_y);
1504
1505GDK_AVAILABLE_IN_3_20
1506gboolean gdk_event_is_scroll_stop_event (const GdkEvent *event);
1507
1508GDK_AVAILABLE_IN_ALL
1509gboolean gdk_event_get_axis (const GdkEvent *event,
1510 GdkAxisUse axis_use,
1511 gdouble *value);
1512GDK_AVAILABLE_IN_ALL
1513void gdk_event_set_device (GdkEvent *event,
1514 GdkDevice *device);
1515GDK_AVAILABLE_IN_ALL
1516GdkDevice* gdk_event_get_device (const GdkEvent *event);
1517GDK_AVAILABLE_IN_ALL
1518void gdk_event_set_source_device (GdkEvent *event,
1519 GdkDevice *device);
1520GDK_AVAILABLE_IN_ALL
1521GdkDevice* gdk_event_get_source_device (const GdkEvent *event);
1522GDK_AVAILABLE_IN_ALL
1523void gdk_event_request_motions (const GdkEventMotion *event);
1524GDK_AVAILABLE_IN_3_4
1525gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
1526
1527GDK_AVAILABLE_IN_ALL
1528gboolean gdk_events_get_distance (GdkEvent *event1,
1529 GdkEvent *event2,
1530 gdouble *distance);
1531GDK_AVAILABLE_IN_ALL
1532gboolean gdk_events_get_angle (GdkEvent *event1,
1533 GdkEvent *event2,
1534 gdouble *angle);
1535GDK_AVAILABLE_IN_ALL
1536gboolean gdk_events_get_center (GdkEvent *event1,
1537 GdkEvent *event2,
1538 gdouble *x,
1539 gdouble *y);
1540
1541GDK_AVAILABLE_IN_ALL
1542void gdk_event_handler_set (GdkEventFunc func,
1543 gpointer data,
1544 GDestroyNotify notify);
1545
1546GDK_AVAILABLE_IN_ALL
1547void gdk_event_set_screen (GdkEvent *event,
1548 GdkScreen *screen);
1549GDK_AVAILABLE_IN_ALL
1550GdkScreen *gdk_event_get_screen (const GdkEvent *event);
1551
1552GDK_AVAILABLE_IN_3_4
1553GdkEventSequence *gdk_event_get_event_sequence (const GdkEvent *event);
1554
1555GDK_AVAILABLE_IN_3_10
1556GdkEventType gdk_event_get_event_type (const GdkEvent *event);
1557
1558GDK_AVAILABLE_IN_3_20
1559GdkSeat *gdk_event_get_seat (const GdkEvent *event);
1560
1561GDK_AVAILABLE_IN_ALL
1562void gdk_set_show_events (gboolean show_events);
1563GDK_AVAILABLE_IN_ALL
1564gboolean gdk_get_show_events (void);
1565
1566GDK_AVAILABLE_IN_ALL
1567gboolean gdk_setting_get (const gchar *name,
1568 GValue *value);
1569
1570GDK_AVAILABLE_IN_3_22
1571GdkDeviceTool *gdk_event_get_device_tool (const GdkEvent *event);
1572
1573GDK_AVAILABLE_IN_3_22
1574void gdk_event_set_device_tool (GdkEvent *event,
1575 GdkDeviceTool *tool);
1576
1577GDK_AVAILABLE_IN_3_22
1578int gdk_event_get_scancode (GdkEvent *event);
1579
1580GDK_AVAILABLE_IN_3_22
1581gboolean gdk_event_get_pointer_emulated (GdkEvent *event);
1582
1583G_END_DECLS
1584
1585#endif /* __GDK_EVENTS_H__ */
1586