1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
31 #ifndef __GDK_EVENTS_H__
32 #define __GDK_EVENTS_H__
34 #include <gdk/gdkcolor.h>
35 #include <gdk/gdktypes.h>
36 #include <gdk/gdkdnd.h>
37 #include <gdk/gdkdevice.h>
43 * SECTION:event_structs
44 * @Short_description: Data structures specific to each type of event
45 * @Title: Event Structures
47 * The event structs contain data specific to each type of event in GDK.
51 * A common mistake is to forget to set the event mask of a widget so that
52 * the required events are received. See gtk_widget_set_events().
58 #define GDK_TYPE_EVENT (gdk_event_get_type ())
61 * GDK_PRIORITY_EVENTS:
63 * This is the priority that events from the X server are given in the
64 * <link linkend="glib-The-Main-Event-Loop">GLib Main Loop</link>.
66 #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
69 * GDK_PRIORITY_REDRAW:
71 * This is the priority that the idle handler processing window updates
73 * <link linkend="glib-The-Main-Event-Loop">GLib Main Loop</link>.
75 #define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
78 * GDK_EVENT_PROPAGATE:
80 * Use this macro as the return value for continuing the propagation of
85 #define GDK_EVENT_PROPAGATE (FALSE)
90 * Use this macro as the return value for stopping the propagation of
95 #define GDK_EVENT_STOP (TRUE)
97 typedef struct _GdkEventAny GdkEventAny;
98 typedef struct _GdkEventExpose GdkEventExpose;
99 typedef struct _GdkEventVisibility GdkEventVisibility;
100 typedef struct _GdkEventMotion GdkEventMotion;
101 typedef struct _GdkEventButton GdkEventButton;
102 typedef struct _GdkEventScroll GdkEventScroll;
103 typedef struct _GdkEventKey GdkEventKey;
104 typedef struct _GdkEventFocus GdkEventFocus;
105 typedef struct _GdkEventCrossing GdkEventCrossing;
106 typedef struct _GdkEventConfigure GdkEventConfigure;
107 typedef struct _GdkEventProperty GdkEventProperty;
108 typedef struct _GdkEventSelection GdkEventSelection;
109 typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
110 typedef struct _GdkEventProximity GdkEventProximity;
111 typedef struct _GdkEventDND GdkEventDND;
112 typedef struct _GdkEventWindowState GdkEventWindowState;
113 typedef struct _GdkEventSetting GdkEventSetting;
114 typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
116 typedef union _GdkEvent GdkEvent;
120 * @event: the #GdkEvent to process.
121 * @data: (closure): user data set when the event handler was installed with
122 * gdk_event_handler_set().
124 * Specifies the type of function passed to gdk_event_handler_set() to
125 * handle all GDK events.
127 typedef void (*GdkEventFunc) (GdkEvent *event,
130 /* Event filtering */
135 * Used to represent native events (<type>XEvent</type>s for the X11
136 * backend, <type>MSG</type>s for Win32).
138 typedef void GdkXEvent; /* Can be cast to window system specific
139 * even type, XEvent on X11, MSG on Win32.
144 * @GDK_FILTER_CONTINUE: event not handled, continue processing.
145 * @GDK_FILTER_TRANSLATE: native event translated into a GDK event and stored
146 * in the <literal>event</literal> structure that was passed in.
147 * @GDK_FILTER_REMOVE: event handled, terminate processing.
149 * Specifies the result of applying a #GdkFilterFunc to a native event.
152 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
153 GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
154 stored in the "event" structure that was
156 GDK_FILTER_REMOVE /* Terminate processing, removing event */
161 * @xevent: the native event to filter.
162 * @event: the GDK event to which the X event will be translated.
163 * @data: user data set when the filter was installed.
165 * Specifies the type of function used to filter native events before they are
166 * converted to GDK events.
168 * When a filter is called, @event is unpopulated, except for
169 * <literal>event->window</literal>. The filter may translate the native
170 * event to a GDK event and store the result in @event, or handle it without
171 * translation. If the filter translates the event and processing should
172 * continue, it should return %GDK_FILTER_TRANSLATE.
174 * Returns: a #GdkFilterReturn value.
176 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
183 * @GDK_NOTHING: a special code to indicate a null event.
184 * @GDK_DELETE: the window manager has requested that the toplevel window be
185 * hidden or destroyed, usually when the user clicks on a special icon in the
187 * @GDK_DESTROY: the window has been destroyed.
188 * @GDK_EXPOSE: all or part of the window has become visible and needs to be
190 * @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
191 * @GDK_BUTTON_PRESS: a mouse button has been pressed.
192 * @GDK_2BUTTON_PRESS: a mouse button has been double-clicked (clicked twice
193 * within a short period of time). Note that each click also generates a
194 * %GDK_BUTTON_PRESS event.
195 * @GDK_3BUTTON_PRESS: a mouse button has been clicked 3 times in a short period
196 * of time. Note that each click also generates a %GDK_BUTTON_PRESS event.
197 * @GDK_BUTTON_RELEASE: a mouse button has been released.
198 * @GDK_KEY_PRESS: a key has been pressed.
199 * @GDK_KEY_RELEASE: a key has been released.
200 * @GDK_ENTER_NOTIFY: the pointer has entered the window.
201 * @GDK_LEAVE_NOTIFY: the pointer has left the window.
202 * @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the window.
203 * @GDK_CONFIGURE: the size, position or stacking order of the window has changed.
204 * Note that GTK+ discards these events for %GDK_WINDOW_CHILD windows.
205 * @GDK_MAP: the window has been mapped.
206 * @GDK_UNMAP: the window has been unmapped.
207 * @GDK_PROPERTY_NOTIFY: a property on the window has been changed or deleted.
208 * @GDK_SELECTION_CLEAR: the application has lost ownership of a selection.
209 * @GDK_SELECTION_REQUEST: another application has requested a selection.
210 * @GDK_SELECTION_NOTIFY: a selection has been received.
211 * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
212 * surface (e.g. a touchscreen or graphics tablet).
213 * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
215 * @GDK_DRAG_ENTER: the mouse has entered the window while a drag is in progress.
216 * @GDK_DRAG_LEAVE: the mouse has left the window while a drag is in progress.
217 * @GDK_DRAG_MOTION: the mouse has moved in the window while a drag is in
219 * @GDK_DRAG_STATUS: the status of the drag operation initiated by the window
221 * @GDK_DROP_START: a drop operation onto the window has started.
222 * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
223 * @GDK_CLIENT_EVENT: a message has been received from another application.
224 * @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
225 * @GDK_SCROLL: the scroll wheel was turned
226 * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
227 * for the possible window states
228 * @GDK_SETTING: a setting has been modified.
229 * @GDK_OWNER_CHANGE: the owner of a selection has changed. This event type
231 * @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
233 * @GDK_DAMAGE: the content of the window has been changed. This event type
235 * @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
237 * Specifies the type of the event.
239 * Do not confuse these events with the signals that GTK+ widgets emit.
240 * Although many of these events result in corresponding signals being emitted,
241 * the events are often transformed or filtered along the way.
249 GDK_MOTION_NOTIFY = 3,
250 GDK_BUTTON_PRESS = 4,
251 GDK_2BUTTON_PRESS = 5,
252 GDK_3BUTTON_PRESS = 6,
253 GDK_BUTTON_RELEASE = 7,
256 GDK_ENTER_NOTIFY = 10,
257 GDK_LEAVE_NOTIFY = 11,
258 GDK_FOCUS_CHANGE = 12,
262 GDK_PROPERTY_NOTIFY = 16,
263 GDK_SELECTION_CLEAR = 17,
264 GDK_SELECTION_REQUEST = 18,
265 GDK_SELECTION_NOTIFY = 19,
266 GDK_PROXIMITY_IN = 20,
267 GDK_PROXIMITY_OUT = 21,
270 GDK_DRAG_MOTION = 24,
271 GDK_DRAG_STATUS = 25,
273 GDK_DROP_FINISHED = 27,
274 GDK_CLIENT_EVENT = 28,
275 GDK_VISIBILITY_NOTIFY = 29,
277 GDK_WINDOW_STATE = 32,
279 GDK_OWNER_CHANGE = 34,
280 GDK_GRAB_BROKEN = 35,
282 GDK_EVENT_LAST /* helper variable for decls */
286 * GdkVisibilityState:
287 * @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
288 * @GDK_VISIBILITY_PARTIAL: the window is partially visible.
289 * @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
291 * Specifies the visiblity status of a window for a #GdkEventVisibility.
295 GDK_VISIBILITY_UNOBSCURED,
296 GDK_VISIBILITY_PARTIAL,
297 GDK_VISIBILITY_FULLY_OBSCURED
298 } GdkVisibilityState;
301 * GdkScrollDirection:
302 * @GDK_SCROLL_UP: the window is scrolled up.
303 * @GDK_SCROLL_DOWN: the window is scrolled down.
304 * @GDK_SCROLL_LEFT: the window is scrolled to the left.
305 * @GDK_SCROLL_RIGHT: the window is scrolled to the right.
307 * Specifies the direction for #GdkEventScroll.
315 } GdkScrollDirection;
319 * @GDK_NOTIFY_ANCESTOR: the window is entered from an ancestor or
320 * left towards an ancestor.
321 * @GDK_NOTIFY_VIRTUAL: the pointer moves between an ancestor and an
322 * inferior of the window.
323 * @GDK_NOTIFY_INFERIOR: the window is entered from an inferior or
324 * left towards an inferior.
325 * @GDK_NOTIFY_NONLINEAR: the window is entered from or left towards
326 * a window which is neither an ancestor nor an inferior.
327 * @GDK_NOTIFY_NONLINEAR_VIRTUAL: the pointer moves between two windows
328 * which are not ancestors of each other and the window is part of
329 * the ancestor chain between one of these windows and their least
331 * @GDK_NOTIFY_UNKNOWN: an unknown type of enter/leave event occurred.
333 * Specifies the kind of crossing for #GdkEventCrossing.
335 * See the X11 protocol specification of <type>LeaveNotify</type> for
336 * full details of crossing event generation.
340 GDK_NOTIFY_ANCESTOR = 0,
341 GDK_NOTIFY_VIRTUAL = 1,
342 GDK_NOTIFY_INFERIOR = 2,
343 GDK_NOTIFY_NONLINEAR = 3,
344 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
345 GDK_NOTIFY_UNKNOWN = 5
350 * @GDK_CROSSING_NORMAL: crossing because of pointer motion.
351 * @GDK_CROSSING_GRAB: crossing because a grab is activated.
352 * @GDK_CROSSING_UNGRAB: crossing because a grab is deactivated.
353 * @GDK_CROSSING_GTK_GRAB: crossing because a GTK+ grab is activated.
354 * @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
355 * @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
356 * state (e.g. sensitivity).
358 * Specifies the crossing mode for #GdkEventCrossing.
365 GDK_CROSSING_GTK_GRAB,
366 GDK_CROSSING_GTK_UNGRAB,
367 GDK_CROSSING_STATE_CHANGED
372 * @GDK_PROPERTY_NEW_VALUE: the property value was changed.
373 * @GDK_PROPERTY_DELETE: the property was deleted.
375 * Specifies the type of a property change for a #GdkEventProperty.
379 GDK_PROPERTY_NEW_VALUE,
385 * @GDK_WINDOW_STATE_WITHDRAWN: the window is not shown.
386 * @GDK_WINDOW_STATE_ICONIFIED: the window is minimized.
387 * @GDK_WINDOW_STATE_MAXIMIZED: the window is maximized.
388 * @GDK_WINDOW_STATE_STICKY: the window is sticky.
389 * @GDK_WINDOW_STATE_FULLSCREEN: the window is maximized without
391 * @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
392 * @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
393 * @GDK_WINDOW_STATE_FOCUSED: the window is presented as focused (with active decorations).
395 * Specifies the state of a toplevel window.
399 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
400 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
401 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
402 GDK_WINDOW_STATE_STICKY = 1 << 3,
403 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
404 GDK_WINDOW_STATE_ABOVE = 1 << 5,
405 GDK_WINDOW_STATE_BELOW = 1 << 6,
406 GDK_WINDOW_STATE_FOCUSED = 1 << 7
411 * @GDK_SETTING_ACTION_NEW: a setting was added.
412 * @GDK_SETTING_ACTION_CHANGED: a setting was changed.
413 * @GDK_SETTING_ACTION_DELETED: a setting was deleted.
415 * Specifies the kind of modification applied to a setting in a
420 GDK_SETTING_ACTION_NEW,
421 GDK_SETTING_ACTION_CHANGED,
422 GDK_SETTING_ACTION_DELETED
427 * @GDK_OWNER_CHANGE_NEW_OWNER: some other app claimed the ownership
428 * @GDK_OWNER_CHANGE_DESTROY: the window was destroyed
429 * @GDK_OWNER_CHANGE_CLOSE: the client was closed
431 * Specifies why a selection ownership was changed.
435 GDK_OWNER_CHANGE_NEW_OWNER,
436 GDK_OWNER_CHANGE_DESTROY,
437 GDK_OWNER_CHANGE_CLOSE
442 * @type: the type of the event.
443 * @window: the window which received the event.
444 * @send_event: %TRUE if the event was sent explicitly (e.g. using
445 * <function>XSendEvent</function>).
447 * Contains the fields which are common to all event structs.
448 * Any event pointer can safely be cast to a pointer to a #GdkEventAny to
449 * access these fields.
460 * @type: the type of the event (%GDK_EXPOSE or %GDK_DAMAGE).
461 * @window: the window which received the event.
462 * @send_event: %TRUE if the event was sent explicitly (e.g. using
463 * <function>XSendEvent</function>).
464 * @area: bounding box of @region.
465 * @region: the region that needs to be redrawn.
466 * @count: the number of contiguous %GDK_EXPOSE events following this one.
467 * The only use for this is "exposure compression", i.e. handling all
468 * contiguous %GDK_EXPOSE events in one go, though GDK performs some
469 * exposure compression so this is not normally needed.
471 * Generated when all or part of a window becomes visible and needs to be
474 struct _GdkEventExpose
480 cairo_region_t *region;
481 gint count; /* If non-zero, how many more events follow. */
485 * GdkEventVisibility:
486 * @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
487 * @window: the window which received the event.
488 * @send_event: %TRUE if the event was sent explicitly (e.g. using
489 * <function>XSendEvent</function>).
490 * @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
491 * %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
493 * Generated when the window visibility status has changed.
495 struct _GdkEventVisibility
500 GdkVisibilityState state;
505 * @type: the type of the event.
506 * @window: the window which received the event.
507 * @send_event: %TRUE if the event was sent explicitly (e.g. using
508 * <function>XSendEvent</function>).
509 * @time: the time of the event in milliseconds.
510 * @x: the x coordinate of the pointer relative to the window.
511 * @y: the y coordinate of the pointer relative to the window.
512 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
514 * @state: (type GdkModifierType): a bit-mask representing the state of
515 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
516 * buttons. See #GdkModifierType.
517 * @is_hint: set to 1 if this event is just a hint, see the
518 * %GDK_POINTER_MOTION_HINT_MASK value of #GdkEventMask.
519 * @device: the device where the event originated.
520 * @x_root: the x coordinate of the pointer relative to the root of the
522 * @y_root: the y coordinate of the pointer relative to the root of the
525 * Generated when the pointer moves.
527 struct _GdkEventMotion
539 gdouble x_root, y_root;
544 * @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
545 * %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
546 * @window: the window which received the event.
547 * @send_event: %TRUE if the event was sent explicitly (e.g. using
548 * <function>XSendEvent</function>).
549 * @time: the time of the event in milliseconds.
550 * @x: the x coordinate of the pointer relative to the window.
551 * @y: the y coordinate of the pointer relative to the window.
552 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
554 * @state: (type GdkModifierType): a bit-mask representing the state of
555 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
556 * buttons. See #GdkModifierType.
557 * @button: the button which was pressed or released, numbered from 1 to 5.
558 * Normally button 1 is the left mouse button, 2 is the middle button,
559 * and 3 is the right button. On 2-button mice, the middle button can
560 * often be simulated by pressing both mouse buttons together.
561 * @device: the device where the event originated.
562 * @x_root: the x coordinate of the pointer relative to the root of the
564 * @y_root: the y coordinate of the pointer relative to the root of the
567 * Used for button press and button release events. The
568 * @type field will be one of %GDK_BUTTON_PRESS,
569 * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
571 * Double and triple-clicks result in a sequence of events being received.
572 * For double-clicks the order of events will be:
574 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
575 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
576 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
577 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
578 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
580 * Note that the first click is received just like a normal
581 * button press, while the second click results in a %GDK_2BUTTON_PRESS
582 * being received just after the %GDK_BUTTON_PRESS.
584 * Triple-clicks are very similar to double-clicks, except that
585 * %GDK_3BUTTON_PRESS is inserted after the third click. The order of the
588 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
589 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
590 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
591 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
592 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
593 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
594 * <listitem><para>%GDK_3BUTTON_PRESS</para></listitem>
595 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
598 * For a double click to occur, the second button press must occur within
599 * 1/4 of a second of the first. For a triple click to occur, the third
600 * button press must also occur within 1/2 second of the first button press.
602 struct _GdkEventButton
614 gdouble x_root, y_root;
619 * @type: the type of the event (%GDK_SCROLL).
620 * @window: the window which received the event.
621 * @send_event: %TRUE if the event was sent explicitly (e.g. using
622 * <function>XSendEvent</function>).
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 * @state: (type GdkModifierType): a bit-mask representing the state of
627 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
628 * buttons. See #GdkModifierType.
629 * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
630 * %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT and %GDK_SCROLL_RIGHT).
631 * @device: the device where the event originated.
632 * @x_root: the x coordinate of the pointer relative to the root of the
634 * @y_root: the y coordinate of the pointer relative to the root of the
637 * Generated from button presses for the buttons 4 to 7. Wheel mice are
638 * usually configured to generate button press events for buttons 4 and 5
639 * when the wheel is turned.
641 struct _GdkEventScroll
650 GdkScrollDirection direction;
652 gdouble x_root, y_root;
657 * @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
658 * @window: the window which received the event.
659 * @send_event: %TRUE if the event was sent explicitly (e.g. using
660 * <function>XSendEvent</function>).
661 * @time: the time of the event in milliseconds.
662 * @state: (type GdkModifierType): a bit-mask representing the state of
663 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
664 * buttons. See #GdkModifierType.
665 * @keyval: the key that was pressed or released. See the
666 * <filename><gdk/gdkkeysyms.h></filename> header file for a
667 * complete list of GDK key codes.
668 * @length: the length of @string.
669 * @string: a string containing the an approximation of the text that
670 * would result from this keypress. The only correct way to handle text
671 * input of text is using input methods (see #GtkIMContext), so this
672 * field is deprecated and should never be used.
673 * (gdk_unicode_to_keyval() provides a non-deprecated way of getting
674 * an approximate translation for a key.) The string is encoded in the
675 * encoding of the current locale (Note: this for backwards compatibility:
676 * strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
677 * In some cases, the translation of the key code will be a single
678 * NUL byte, in which case looking at @length is necessary to distinguish
679 * it from the an empty translation.
680 * @hardware_keycode: the raw code of the key that was pressed or released.
681 * @group: the keyboard group.
682 * @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
683 * modifier. Since 2.10
685 * Describes a key press or key release event.
697 guint16 hardware_keycode;
699 guint is_modifier : 1;
704 * @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
705 * @window: the window which received the event.
706 * @send_event: %TRUE if the event was sent explicitly (e.g. using
707 * <function>XSendEvent</function>).
708 * @subwindow: the window that was entered or left.
709 * @time: the time of the event in milliseconds.
710 * @x: the x coordinate of the pointer relative to the window.
711 * @y: the y coordinate of the pointer relative to the window.
712 * @x_root: the x coordinate of the pointer relative to the root of the screen.
713 * @y_root: the y coordinate of the pointer relative to the root of the screen.
714 * @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
715 * %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
716 * %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
717 * and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
719 * @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
720 * %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
721 * %GDK_NOTIFY_NONLINEAR_VIRTUAL).
722 * @focus: %TRUE if @window is the focus window or an inferior.
723 * @state: (type GdkModifierType): a bit-mask representing the state of
724 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
725 * buttons. See #GdkModifierType.
727 * Generated when the pointer enters or leaves a window.
729 struct _GdkEventCrossing
734 GdkWindow *subwindow;
740 GdkCrossingMode mode;
741 GdkNotifyType detail;
748 * @type: the type of the event (%GDK_FOCUS_CHANGE).
749 * @window: the window which received the event.
750 * @send_event: %TRUE if the event was sent explicitly (e.g. using
751 * <function>XSendEvent</function>).
752 * @in: %TRUE if the window has gained the keyboard focus, %FALSE if
753 * it has lost the focus.
755 * Describes a change of keyboard focus.
757 struct _GdkEventFocus
767 * @type: the type of the event (%GDK_CONFIGURE).
768 * @window: the window which received the event.
769 * @send_event: %TRUE if the event was sent explicitly (e.g. using
770 * <function>XSendEvent</function>).
771 * @x: the new x coordinate of the window, relative to its parent.
772 * @y: the new y coordinate of the window, relative to its parent.
773 * @width: the new width of the window.
774 * @height: the new height of the window.
776 * Generated when a window size or position has changed.
778 struct _GdkEventConfigure
790 * @type: the type of the event (%GDK_PROPERTY_NOTIFY).
791 * @window: the window which received the event.
792 * @send_event: %TRUE if the event was sent explicitly (e.g. using
793 * <function>XSendEvent</function>).
794 * @atom: the property that was changed.
795 * @time: the time of the event in milliseconds.
796 * @state: whether the property was changed (%GDK_PROPERTY_NEW_VALUE) or
797 * deleted (%GDK_PROPERTY_DELETE).
799 * Describes a property change on a window.
801 struct _GdkEventProperty
813 * @type: the type of the event (%GDK_SELECTION_CLEAR,
814 * %GDK_SELECTION_NOTIFY or %GDK_SELECTION_REQUEST).
815 * @window: the window which received the event.
816 * @send_event: %TRUE if the event was sent explicitly (e.g. using
817 * <function>XSendEvent</function>).
818 * @selection: the selection.
819 * @target: the target to which the selection should be converted.
820 * @property: the property in which to place the result of the conversion.
821 * @time: the time of the event in milliseconds.
822 * @requestor: the window on which to place @property or %NULL if none.
824 * Generated when a selection is requested or ownership of a selection
825 * is taken over by another client application.
827 struct _GdkEventSelection
836 GdkWindow *requestor;
840 * GdkEventOwnerChange:
841 * @type: the type of the event (%GDK_OWNER_CHANGE).
842 * @window: the window which received the event
843 * @send_event: %TRUE if the event was sent explicitly (e.g. using
844 * <function>XSendEvent</function>)
845 * @owner: the new owner of the selection, or %NULL if there is none
846 * @reason: the reason for the ownership change as a #GdkOwnerChange value
847 * @selection: the atom identifying the selection
848 * @time: the timestamp of the event
849 * @selection_time: the time at which the selection ownership was taken
852 * Generated when the owner of a selection changes. On X11, this
853 * information is only available if the X server supports the XFIXES
858 struct _GdkEventOwnerChange
864 GdkOwnerChange reason;
867 guint32 selection_time;
872 * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
873 * @window: the window which received the event.
874 * @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
875 * @time: the time of the event in milliseconds.
876 * @device: the device where the event originated.
878 * Proximity events are generated when using GDK's wrapper for the
879 * XInput extension. The XInput extension is an add-on for standard X
880 * that allows you to use nonstandard devices such as graphics tablets.
881 * A proximity event indicates that the stylus has moved in or out of
882 * contact with the tablet, or perhaps that the user's finger has moved
883 * in or out of contact with a touch screen.
885 * This event type will be used pretty rarely. It only is important for
886 * XInput aware programs that are drawing their own cursor.
888 struct _GdkEventProximity
899 * @type: the type of the event (%GDK_SETTING).
900 * @window: the window which received the event.
901 * @send_event: %TRUE if the event was sent explicitly (e.g. using
902 * <function>XSendEvent</function>).
903 * @action: what happened to the setting (%GDK_SETTING_ACTION_NEW,
904 * %GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
905 * @name: the name of the setting.
907 * Generated when a setting is modified.
909 struct _GdkEventSetting
914 GdkSettingAction action;
919 * GdkEventWindowState:
920 * @type: the type of the event (%GDK_WINDOW_STATE).
921 * @window: the window which received the event.
922 * @send_event: %TRUE if the event was sent explicitly (e.g. using
923 * <function>XSendEvent</function>).
924 * @changed_mask: mask specifying what flags have changed.
925 * @new_window_state: the new window state, a combination of
926 * #GdkWindowState bits.
928 * Generated when the state of a toplevel window changes.
930 struct _GdkEventWindowState
935 GdkWindowState changed_mask;
936 GdkWindowState new_window_state;
940 * GdkEventGrabBroken:
941 * @type: the type of the event (%GDK_GRAB_BROKEN)
942 * @window: the window which received the event, i.e. the window
943 * that previously owned the grab
944 * @send_event: %TRUE if the event was sent explicitly (e.g. using
945 * <function>XSendEvent</function>).
946 * @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
948 * @implicit: %TRUE if the broken grab was implicit
949 * @grab_window: If this event is caused by another grab in the same
950 * application, @grab_window contains the new grab window. Otherwise
951 * @grab_window is %NULL.
953 * Generated when a pointer or keyboard grab is broken. On X11, this happens
954 * when the grab window becomes unviewable (i.e. it or one of its ancestors
955 * is unmapped), or if the same application grabs the pointer or keyboard
956 * again. Note that implicit grabs (which are initiated by button presses)
957 * can also cause #GdkEventGrabBroken events.
961 struct _GdkEventGrabBroken {
967 GdkWindow *grab_window;
972 * @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
973 * %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
974 * %GDK_DROP_FINISHED).
975 * @window: the window which received the event.
976 * @send_event: %TRUE if the event was sent explicitly (e.g. using
977 * <function>XSendEvent</function>).
978 * @context: the #GdkDragContext for the current DND operation.
979 * @time: the time of the event in milliseconds.
980 * @x_root: the x coordinate of the pointer relative to the root of the
981 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
982 * @y_root: the y coordinate of the pointer relative to the root of the
983 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
985 * Generated during DND operations.
987 struct _GdkEventDND {
991 GdkDragContext *context;
994 gshort x_root, y_root;
1000 * The #GdkEvent struct contains a union of all of the event structs,
1001 * and allows access to the data fields in a number of ways.
1003 * The event type is always the first field in all of the event structs, and
1004 * can always be accessed with the following code, no matter what type of
1009 * GdkEventType type;
1011 * type = event->type;
1013 * </informalexample>
1015 * To access other fields of the event structs, the pointer to the event
1016 * can be cast to the appropriate event struct pointer, or the union member
1017 * name can be used. For example if the event type is %GDK_BUTTON_PRESS
1018 * then the x coordinate of the button press can be accessed with:
1024 * x = ((GdkEventButton*)event)->x;
1026 * </informalexample>
1033 * x = event->button.x;
1035 * </informalexample>
1041 GdkEventExpose expose;
1042 GdkEventVisibility visibility;
1043 GdkEventMotion motion;
1044 GdkEventButton button;
1045 GdkEventScroll scroll;
1047 GdkEventCrossing crossing;
1048 GdkEventFocus focus_change;
1049 GdkEventConfigure configure;
1050 GdkEventProperty property;
1051 GdkEventSelection selection;
1052 GdkEventOwnerChange owner_change;
1053 GdkEventProximity proximity;
1055 GdkEventWindowState window_state;
1056 GdkEventSetting setting;
1057 GdkEventGrabBroken grab_broken;
1060 GType gdk_event_get_type (void) G_GNUC_CONST;
1062 gboolean gdk_events_pending (void);
1063 GdkEvent* gdk_event_get (void);
1065 GdkEvent* gdk_event_peek (void);
1066 void gdk_event_put (const GdkEvent *event);
1068 GdkEvent* gdk_event_new (GdkEventType type);
1069 GdkEvent* gdk_event_copy (const GdkEvent *event);
1070 void gdk_event_free (GdkEvent *event);
1072 guint32 gdk_event_get_time (const GdkEvent *event);
1073 gboolean gdk_event_get_state (const GdkEvent *event,
1074 GdkModifierType *state);
1075 gboolean gdk_event_get_coords (const GdkEvent *event,
1078 gboolean gdk_event_get_root_coords (const GdkEvent *event,
1081 gboolean gdk_event_get_button (const GdkEvent *event,
1083 gboolean gdk_event_get_click_count (const GdkEvent *event,
1084 guint *click_count);
1085 gboolean gdk_event_get_keyval (const GdkEvent *event,
1087 gboolean gdk_event_get_keycode (const GdkEvent *event,
1089 gboolean gdk_event_get_scroll_direction (const GdkEvent *event,
1090 GdkScrollDirection *direction);
1091 gboolean gdk_event_get_axis (const GdkEvent *event,
1092 GdkAxisUse axis_use,
1094 void gdk_event_set_device (GdkEvent *event,
1096 GdkDevice* gdk_event_get_device (const GdkEvent *event);
1097 void gdk_event_set_source_device (GdkEvent *event,
1099 GdkDevice* gdk_event_get_source_device (const GdkEvent *event);
1100 void gdk_event_request_motions (const GdkEventMotion *event);
1101 gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
1103 gboolean gdk_events_get_distance (GdkEvent *event1,
1106 gboolean gdk_events_get_angle (GdkEvent *event1,
1109 gboolean gdk_events_get_center (GdkEvent *event1,
1114 void gdk_event_handler_set (GdkEventFunc func,
1116 GDestroyNotify notify);
1118 void gdk_event_set_screen (GdkEvent *event,
1120 GdkScreen *gdk_event_get_screen (const GdkEvent *event);
1122 void gdk_set_show_events (gboolean show_events);
1123 gboolean gdk_get_show_events (void);
1125 #ifndef GDK_MULTIHEAD_SAFE
1127 gboolean gdk_setting_get (const gchar *name,
1130 #endif /* GDK_MULTIHEAD_SAFE */
1134 #endif /* __GDK_EVENTS_H__ */