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 typedef struct _GdkEventAny GdkEventAny;
79 typedef struct _GdkEventExpose GdkEventExpose;
80 typedef struct _GdkEventVisibility GdkEventVisibility;
81 typedef struct _GdkEventMotion GdkEventMotion;
82 typedef struct _GdkEventButton GdkEventButton;
83 typedef struct _GdkEventScroll GdkEventScroll;
84 typedef struct _GdkEventKey GdkEventKey;
85 typedef struct _GdkEventFocus GdkEventFocus;
86 typedef struct _GdkEventCrossing GdkEventCrossing;
87 typedef struct _GdkEventConfigure GdkEventConfigure;
88 typedef struct _GdkEventProperty GdkEventProperty;
89 typedef struct _GdkEventSelection GdkEventSelection;
90 typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
91 typedef struct _GdkEventProximity GdkEventProximity;
92 typedef struct _GdkEventDND GdkEventDND;
93 typedef struct _GdkEventWindowState GdkEventWindowState;
94 typedef struct _GdkEventSetting GdkEventSetting;
95 typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
97 typedef union _GdkEvent GdkEvent;
101 * @event: the #GdkEvent to process.
102 * @data: (closure): user data set when the event handler was installed with
103 * gdk_event_handler_set().
105 * Specifies the type of function passed to gdk_event_handler_set() to
106 * handle all GDK events.
108 typedef void (*GdkEventFunc) (GdkEvent *event,
111 /* Event filtering */
116 * Used to represent native events (<type>XEvent</type>s for the X11
117 * backend, <type>MSG</type>s for Win32).
119 typedef void GdkXEvent; /* Can be cast to window system specific
120 * even type, XEvent on X11, MSG on Win32.
125 * @GDK_FILTER_CONTINUE: event not handled, continue processing.
126 * @GDK_FILTER_TRANSLATE: native event translated into a GDK event and stored
127 * in the <literal>event</literal> structure that was passed in.
128 * @GDK_FILTER_REMOVE: event handled, terminate processing.
130 * Specifies the result of applying a #GdkFilterFunc to a native event.
133 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
134 GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
135 stored in the "event" structure that was
137 GDK_FILTER_REMOVE /* Terminate processing, removing event */
142 * @xevent: the native event to filter.
143 * @event: the GDK event to which the X event will be translated.
144 * @data: user data set when the filter was installed.
146 * Specifies the type of function used to filter native events before they are
147 * converted to GDK events.
149 * When a filter is called, @event is unpopulated, except for
150 * <literal>event->window</literal>. The filter may translate the native
151 * event to a GDK event and store the result in @event, or handle it without
152 * translation. If the filter translates the event and processing should
153 * continue, it should return %GDK_FILTER_TRANSLATE.
155 * Returns: a #GdkFilterReturn value.
157 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
164 * @GDK_NOTHING: a special code to indicate a null event.
165 * @GDK_DELETE: the window manager has requested that the toplevel window be
166 * hidden or destroyed, usually when the user clicks on a special icon in the
168 * @GDK_DESTROY: the window has been destroyed.
169 * @GDK_EXPOSE: all or part of the window has become visible and needs to be
171 * @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
172 * @GDK_BUTTON_PRESS: a mouse button has been pressed.
173 * @GDK_2BUTTON_PRESS: a mouse button has been double-clicked (clicked twice
174 * within a short period of time). Note that each click also generates a
175 * %GDK_BUTTON_PRESS event.
176 * @GDK_3BUTTON_PRESS: a mouse button has been clicked 3 times in a short period
177 * of time. Note that each click also generates a %GDK_BUTTON_PRESS event.
178 * @GDK_BUTTON_RELEASE: a mouse button has been released.
179 * @GDK_KEY_PRESS: a key has been pressed.
180 * @GDK_KEY_RELEASE: a key has been released.
181 * @GDK_ENTER_NOTIFY: the pointer has entered the window.
182 * @GDK_LEAVE_NOTIFY: the pointer has left the window.
183 * @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the window.
184 * @GDK_CONFIGURE: the size, position or stacking order of the window has changed.
185 * Note that GTK+ discards these events for %GDK_WINDOW_CHILD windows.
186 * @GDK_MAP: the window has been mapped.
187 * @GDK_UNMAP: the window has been unmapped.
188 * @GDK_PROPERTY_NOTIFY: a property on the window has been changed or deleted.
189 * @GDK_SELECTION_CLEAR: the application has lost ownership of a selection.
190 * @GDK_SELECTION_REQUEST: another application has requested a selection.
191 * @GDK_SELECTION_NOTIFY: a selection has been received.
192 * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
193 * surface (e.g. a touchscreen or graphics tablet).
194 * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
196 * @GDK_DRAG_ENTER: the mouse has entered the window while a drag is in progress.
197 * @GDK_DRAG_LEAVE: the mouse has left the window while a drag is in progress.
198 * @GDK_DRAG_MOTION: the mouse has moved in the window while a drag is in
200 * @GDK_DRAG_STATUS: the status of the drag operation initiated by the window
202 * @GDK_DROP_START: a drop operation onto the window has started.
203 * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
204 * @GDK_CLIENT_EVENT: a message has been received from another application.
205 * @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
206 * @GDK_SCROLL: the scroll wheel was turned
207 * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
208 * for the possible window states
209 * @GDK_SETTING: a setting has been modified.
210 * @GDK_OWNER_CHANGE: the owner of a selection has changed. This event type
212 * @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
214 * @GDK_DAMAGE: the content of the window has been changed. This event type
216 * @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
218 * Specifies the type of the event.
220 * Do not confuse these events with the signals that GTK+ widgets emit.
221 * Although many of these events result in corresponding signals being emitted,
222 * the events are often transformed or filtered along the way.
230 GDK_MOTION_NOTIFY = 3,
231 GDK_BUTTON_PRESS = 4,
232 GDK_2BUTTON_PRESS = 5,
233 GDK_3BUTTON_PRESS = 6,
234 GDK_BUTTON_RELEASE = 7,
237 GDK_ENTER_NOTIFY = 10,
238 GDK_LEAVE_NOTIFY = 11,
239 GDK_FOCUS_CHANGE = 12,
243 GDK_PROPERTY_NOTIFY = 16,
244 GDK_SELECTION_CLEAR = 17,
245 GDK_SELECTION_REQUEST = 18,
246 GDK_SELECTION_NOTIFY = 19,
247 GDK_PROXIMITY_IN = 20,
248 GDK_PROXIMITY_OUT = 21,
251 GDK_DRAG_MOTION = 24,
252 GDK_DRAG_STATUS = 25,
254 GDK_DROP_FINISHED = 27,
255 GDK_CLIENT_EVENT = 28,
256 GDK_VISIBILITY_NOTIFY = 29,
258 GDK_WINDOW_STATE = 32,
260 GDK_OWNER_CHANGE = 34,
261 GDK_GRAB_BROKEN = 35,
263 GDK_EVENT_LAST /* helper variable for decls */
267 * GdkVisibilityState:
268 * @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
269 * @GDK_VISIBILITY_PARTIAL: the window is partially visible.
270 * @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
272 * Specifies the visiblity status of a window for a #GdkEventVisibility.
276 GDK_VISIBILITY_UNOBSCURED,
277 GDK_VISIBILITY_PARTIAL,
278 GDK_VISIBILITY_FULLY_OBSCURED
279 } GdkVisibilityState;
282 * GdkScrollDirection:
283 * @GDK_SCROLL_UP: the window is scrolled up.
284 * @GDK_SCROLL_DOWN: the window is scrolled down.
285 * @GDK_SCROLL_LEFT: the window is scrolled to the left.
286 * @GDK_SCROLL_RIGHT: the window is scrolled to the right.
288 * Specifies the direction for #GdkEventScroll.
296 } GdkScrollDirection;
300 * @GDK_NOTIFY_ANCESTOR: the window is entered from an ancestor or
301 * left towards an ancestor.
302 * @GDK_NOTIFY_VIRTUAL: the pointer moves between an ancestor and an
303 * inferior of the window.
304 * @GDK_NOTIFY_INFERIOR: the window is entered from an inferior or
305 * left towards an inferior.
306 * @GDK_NOTIFY_NONLINEAR: the window is entered from or left towards
307 * a window which is neither an ancestor nor an inferior.
308 * @GDK_NOTIFY_NONLINEAR_VIRTUAL: the pointer moves between two windows
309 * which are not ancestors of each other and the window is part of
310 * the ancestor chain between one of these windows and their least
312 * @GDK_NOTIFY_UNKNOWN: an unknown type of enter/leave event occurred.
314 * Specifies the kind of crossing for #GdkEventCrossing.
316 * See the X11 protocol specification of <type>LeaveNotify</type> for
317 * full details of crossing event generation.
321 GDK_NOTIFY_ANCESTOR = 0,
322 GDK_NOTIFY_VIRTUAL = 1,
323 GDK_NOTIFY_INFERIOR = 2,
324 GDK_NOTIFY_NONLINEAR = 3,
325 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
326 GDK_NOTIFY_UNKNOWN = 5
331 * @GDK_CROSSING_NORMAL: crossing because of pointer motion.
332 * @GDK_CROSSING_GRAB: crossing because a grab is activated.
333 * @GDK_CROSSING_UNGRAB: crossing because a grab is deactivated.
334 * @GDK_CROSSING_GTK_GRAB: crossing because a GTK+ grab is activated.
335 * @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
336 * @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
337 * state (e.g. sensitivity).
339 * Specifies the crossing mode for #GdkEventCrossing.
346 GDK_CROSSING_GTK_GRAB,
347 GDK_CROSSING_GTK_UNGRAB,
348 GDK_CROSSING_STATE_CHANGED
353 * @GDK_PROPERTY_NEW_VALUE: the property value was changed.
354 * @GDK_PROPERTY_DELETE: the property was deleted.
356 * Specifies the type of a property change for a #GdkEventProperty.
360 GDK_PROPERTY_NEW_VALUE,
366 * @GDK_WINDOW_STATE_WITHDRAWN: the window is not shown.
367 * @GDK_WINDOW_STATE_ICONIFIED: the window is minimized.
368 * @GDK_WINDOW_STATE_MAXIMIZED: the window is maximized.
369 * @GDK_WINDOW_STATE_STICKY: the window is sticky.
370 * @GDK_WINDOW_STATE_FULLSCREEN: the window is maximized without
372 * @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
373 * @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
374 * @GDK_WINDOW_STATE_FOCUSED: the window is presented as focused (with active decorations).
376 * Specifies the state of a toplevel window.
380 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
381 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
382 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
383 GDK_WINDOW_STATE_STICKY = 1 << 3,
384 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
385 GDK_WINDOW_STATE_ABOVE = 1 << 5,
386 GDK_WINDOW_STATE_BELOW = 1 << 6,
387 GDK_WINDOW_STATE_FOCUSED = 1 << 7
392 * @GDK_SETTING_ACTION_NEW: a setting was added.
393 * @GDK_SETTING_ACTION_CHANGED: a setting was changed.
394 * @GDK_SETTING_ACTION_DELETED: a setting was deleted.
396 * Specifies the kind of modification applied to a setting in a
401 GDK_SETTING_ACTION_NEW,
402 GDK_SETTING_ACTION_CHANGED,
403 GDK_SETTING_ACTION_DELETED
408 * @GDK_OWNER_CHANGE_NEW_OWNER: some other app claimed the ownership
409 * @GDK_OWNER_CHANGE_DESTROY: the window was destroyed
410 * @GDK_OWNER_CHANGE_CLOSE: the client was closed
412 * Specifies why a selection ownership was changed.
416 GDK_OWNER_CHANGE_NEW_OWNER,
417 GDK_OWNER_CHANGE_DESTROY,
418 GDK_OWNER_CHANGE_CLOSE
423 * @type: the type of the event.
424 * @window: the window which received the event.
425 * @send_event: %TRUE if the event was sent explicitly (e.g. using
426 * <function>XSendEvent</function>).
428 * Contains the fields which are common to all event structs.
429 * Any event pointer can safely be cast to a pointer to a #GdkEventAny to
430 * access these fields.
441 * @type: the type of the event (%GDK_EXPOSE or %GDK_DAMAGE).
442 * @window: the window which received the event.
443 * @send_event: %TRUE if the event was sent explicitly (e.g. using
444 * <function>XSendEvent</function>).
445 * @area: bounding box of @region.
446 * @region: the region that needs to be redrawn.
447 * @count: the number of contiguous %GDK_EXPOSE events following this one.
448 * The only use for this is "exposure compression", i.e. handling all
449 * contiguous %GDK_EXPOSE events in one go, though GDK performs some
450 * exposure compression so this is not normally needed.
452 * Generated when all or part of a window becomes visible and needs to be
455 struct _GdkEventExpose
461 cairo_region_t *region;
462 gint count; /* If non-zero, how many more events follow. */
466 * GdkEventVisibility:
467 * @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
468 * @window: the window which received the event.
469 * @send_event: %TRUE if the event was sent explicitly (e.g. using
470 * <function>XSendEvent</function>).
471 * @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
472 * %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
474 * Generated when the window visibility status has changed.
476 struct _GdkEventVisibility
481 GdkVisibilityState state;
486 * @type: the type of the event.
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 * @time: the time of the event in milliseconds.
491 * @x: the x coordinate of the pointer relative to the window.
492 * @y: the y coordinate of the pointer relative to the window.
493 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
495 * @state: (type GdkModifierType): a bit-mask representing the state of
496 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
497 * buttons. See #GdkModifierType.
498 * @is_hint: set to 1 if this event is just a hint, see the
499 * %GDK_POINTER_MOTION_HINT_MASK value of #GdkEventMask.
500 * @device: the device where the event originated.
501 * @x_root: the x coordinate of the pointer relative to the root of the
503 * @y_root: the y coordinate of the pointer relative to the root of the
506 * Generated when the pointer moves.
508 struct _GdkEventMotion
520 gdouble x_root, y_root;
525 * @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
526 * %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
527 * @window: the window which received the event.
528 * @send_event: %TRUE if the event was sent explicitly (e.g. using
529 * <function>XSendEvent</function>).
530 * @time: the time of the event in milliseconds.
531 * @x: the x coordinate of the pointer relative to the window.
532 * @y: the y coordinate of the pointer relative to the window.
533 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
535 * @state: (type GdkModifierType): a bit-mask representing the state of
536 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
537 * buttons. See #GdkModifierType.
538 * @button: the button which was pressed or released, numbered from 1 to 5.
539 * Normally button 1 is the left mouse button, 2 is the middle button,
540 * and 3 is the right button. On 2-button mice, the middle button can
541 * often be simulated by pressing both mouse buttons together.
542 * @device: the device where the event originated.
543 * @x_root: the x coordinate of the pointer relative to the root of the
545 * @y_root: the y coordinate of the pointer relative to the root of the
548 * Used for button press and button release events. The
549 * @type field will be one of %GDK_BUTTON_PRESS,
550 * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
552 * Double and triple-clicks result in a sequence of events being received.
553 * For double-clicks the order of events will be:
555 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
556 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
557 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
558 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
559 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
561 * Note that the first click is received just like a normal
562 * button press, while the second click results in a %GDK_2BUTTON_PRESS
563 * being received just after the %GDK_BUTTON_PRESS.
565 * Triple-clicks are very similar to double-clicks, except that
566 * %GDK_3BUTTON_PRESS is inserted after the third click. The order of the
569 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
570 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
571 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
572 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
573 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
574 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
575 * <listitem><para>%GDK_3BUTTON_PRESS</para></listitem>
576 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
579 * For a double click to occur, the second button press must occur within
580 * 1/4 of a second of the first. For a triple click to occur, the third
581 * button press must also occur within 1/2 second of the first button press.
583 struct _GdkEventButton
595 gdouble x_root, y_root;
600 * @type: the type of the event (%GDK_SCROLL).
601 * @window: the window which received the event.
602 * @send_event: %TRUE if the event was sent explicitly (e.g. using
603 * <function>XSendEvent</function>).
604 * @time: the time of the event in milliseconds.
605 * @x: the x coordinate of the pointer relative to the window.
606 * @y: the y coordinate of the pointer relative to the window.
607 * @state: (type GdkModifierType): a bit-mask representing the state of
608 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
609 * buttons. See #GdkModifierType.
610 * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
611 * %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT and %GDK_SCROLL_RIGHT).
612 * @device: the device where the event originated.
613 * @x_root: the x coordinate of the pointer relative to the root of the
615 * @y_root: the y coordinate of the pointer relative to the root of the
618 * Generated from button presses for the buttons 4 to 7. Wheel mice are
619 * usually configured to generate button press events for buttons 4 and 5
620 * when the wheel is turned.
622 struct _GdkEventScroll
631 GdkScrollDirection direction;
633 gdouble x_root, y_root;
638 * @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
639 * @window: the window which received the event.
640 * @send_event: %TRUE if the event was sent explicitly (e.g. using
641 * <function>XSendEvent</function>).
642 * @time: the time of the event in milliseconds.
643 * @state: (type GdkModifierType): a bit-mask representing the state of
644 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
645 * buttons. See #GdkModifierType.
646 * @keyval: the key that was pressed or released. See the
647 * <filename><gdk/gdkkeysyms.h></filename> header file for a
648 * complete list of GDK key codes.
649 * @length: the length of @string.
650 * @string: a string containing the an approximation of the text that
651 * would result from this keypress. The only correct way to handle text
652 * input of text is using input methods (see #GtkIMContext), so this
653 * field is deprecated and should never be used.
654 * (gdk_unicode_to_keyval() provides a non-deprecated way of getting
655 * an approximate translation for a key.) The string is encoded in the
656 * encoding of the current locale (Note: this for backwards compatibility:
657 * strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
658 * In some cases, the translation of the key code will be a single
659 * NUL byte, in which case looking at @length is necessary to distinguish
660 * it from the an empty translation.
661 * @hardware_keycode: the raw code of the key that was pressed or released.
662 * @group: the keyboard group.
663 * @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
664 * modifier. Since 2.10
666 * Describes a key press or key release event.
678 guint16 hardware_keycode;
680 guint is_modifier : 1;
685 * @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
686 * @window: the window which received the event.
687 * @send_event: %TRUE if the event was sent explicitly (e.g. using
688 * <function>XSendEvent</function>).
689 * @subwindow: the window that was entered or left.
690 * @time: the time of the event in milliseconds.
691 * @x: the x coordinate of the pointer relative to the window.
692 * @y: the y coordinate of the pointer relative to the window.
693 * @x_root: the x coordinate of the pointer relative to the root of the screen.
694 * @y_root: the y coordinate of the pointer relative to the root of the screen.
695 * @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
696 * %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
697 * %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
698 * and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
700 * @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
701 * %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
702 * %GDK_NOTIFY_NONLINEAR_VIRTUAL).
703 * @focus: %TRUE if @window is the focus window or an inferior.
704 * @state: (type GdkModifierType): a bit-mask representing the state of
705 * the modifier keys (e.g. Control, Shift and Alt) and the pointer
706 * buttons. See #GdkModifierType.
708 * Generated when the pointer enters or leaves a window.
710 struct _GdkEventCrossing
715 GdkWindow *subwindow;
721 GdkCrossingMode mode;
722 GdkNotifyType detail;
729 * @type: the type of the event (%GDK_FOCUS_CHANGE).
730 * @window: the window which received the event.
731 * @send_event: %TRUE if the event was sent explicitly (e.g. using
732 * <function>XSendEvent</function>).
733 * @in: %TRUE if the window has gained the keyboard focus, %FALSE if
734 * it has lost the focus.
736 * Describes a change of keyboard focus.
738 struct _GdkEventFocus
748 * @type: the type of the event (%GDK_CONFIGURE).
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 * @x: the new x coordinate of the window, relative to its parent.
753 * @y: the new y coordinate of the window, relative to its parent.
754 * @width: the new width of the window.
755 * @height: the new height of the window.
757 * Generated when a window size or position has changed.
759 struct _GdkEventConfigure
771 * @type: the type of the event (%GDK_PROPERTY_NOTIFY).
772 * @window: the window which received the event.
773 * @send_event: %TRUE if the event was sent explicitly (e.g. using
774 * <function>XSendEvent</function>).
775 * @atom: the property that was changed.
776 * @time: the time of the event in milliseconds.
777 * @state: whether the property was changed (%GDK_PROPERTY_NEW_VALUE) or
778 * deleted (%GDK_PROPERTY_DELETE).
780 * Describes a property change on a window.
782 struct _GdkEventProperty
794 * @type: the type of the event (%GDK_SELECTION_CLEAR,
795 * %GDK_SELECTION_NOTIFY or %GDK_SELECTION_REQUEST).
796 * @window: the window which received the event.
797 * @send_event: %TRUE if the event was sent explicitly (e.g. using
798 * <function>XSendEvent</function>).
799 * @selection: the selection.
800 * @target: the target to which the selection should be converted.
801 * @property: the property in which to place the result of the conversion.
802 * @time: the time of the event in milliseconds.
803 * @requestor: the window on which to place @property or %NULL if none.
805 * Generated when a selection is requested or ownership of a selection
806 * is taken over by another client application.
808 struct _GdkEventSelection
817 GdkWindow *requestor;
821 * GdkEventOwnerChange:
822 * @type: the type of the event (%GDK_OWNER_CHANGE).
823 * @window: the window which received the event
824 * @send_event: %TRUE if the event was sent explicitly (e.g. using
825 * <function>XSendEvent</function>)
826 * @owner: the new owner of the selection, or %NULL if there is none
827 * @reason: the reason for the ownership change as a #GdkOwnerChange value
828 * @selection: the atom identifying the selection
829 * @time: the timestamp of the event
830 * @selection_time: the time at which the selection ownership was taken
833 * Generated when the owner of a selection changes. On X11, this
834 * information is only available if the X server supports the XFIXES
839 struct _GdkEventOwnerChange
845 GdkOwnerChange reason;
848 guint32 selection_time;
853 * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
854 * @window: the window which received the event.
855 * @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
856 * @time: the time of the event in milliseconds.
857 * @device: the device where the event originated.
859 * Proximity events are generated when using GDK's wrapper for the
860 * XInput extension. The XInput extension is an add-on for standard X
861 * that allows you to use nonstandard devices such as graphics tablets.
862 * A proximity event indicates that the stylus has moved in or out of
863 * contact with the tablet, or perhaps that the user's finger has moved
864 * in or out of contact with a touch screen.
866 * This event type will be used pretty rarely. It only is important for
867 * XInput aware programs that are drawing their own cursor.
869 struct _GdkEventProximity
880 * @type: the type of the event (%GDK_SETTING).
881 * @window: the window which received the event.
882 * @send_event: %TRUE if the event was sent explicitly (e.g. using
883 * <function>XSendEvent</function>).
884 * @action: what happened to the setting (%GDK_SETTING_ACTION_NEW,
885 * %GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
886 * @name: the name of the setting.
888 * Generated when a setting is modified.
890 struct _GdkEventSetting
895 GdkSettingAction action;
900 * GdkEventWindowState:
901 * @type: the type of the event (%GDK_WINDOW_STATE).
902 * @window: the window which received the event.
903 * @send_event: %TRUE if the event was sent explicitly (e.g. using
904 * <function>XSendEvent</function>).
905 * @changed_mask: mask specifying what flags have changed.
906 * @new_window_state: the new window state, a combination of
907 * #GdkWindowState bits.
909 * Generated when the state of a toplevel window changes.
911 struct _GdkEventWindowState
916 GdkWindowState changed_mask;
917 GdkWindowState new_window_state;
921 * GdkEventGrabBroken:
922 * @type: the type of the event (%GDK_GRAB_BROKEN)
923 * @window: the window which received the event, i.e. the window
924 * that previously owned the grab
925 * @send_event: %TRUE if the event was sent explicitly (e.g. using
926 * <function>XSendEvent</function>).
927 * @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
929 * @implicit: %TRUE if the broken grab was implicit
930 * @grab_window: If this event is caused by another grab in the same
931 * application, @grab_window contains the new grab window. Otherwise
932 * @grab_window is %NULL.
934 * Generated when a pointer or keyboard grab is broken. On X11, this happens
935 * when the grab window becomes unviewable (i.e. it or one of its ancestors
936 * is unmapped), or if the same application grabs the pointer or keyboard
937 * again. Note that implicit grabs (which are initiated by button presses)
938 * can also cause #GdkEventGrabBroken events.
942 struct _GdkEventGrabBroken {
948 GdkWindow *grab_window;
953 * @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
954 * %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
955 * %GDK_DROP_FINISHED).
956 * @window: the window which received the event.
957 * @send_event: %TRUE if the event was sent explicitly (e.g. using
958 * <function>XSendEvent</function>).
959 * @context: the #GdkDragContext for the current DND operation.
960 * @time: the time of the event in milliseconds.
961 * @x_root: the x coordinate of the pointer relative to the root of the
962 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
963 * @y_root: the y coordinate of the pointer relative to the root of the
964 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
966 * Generated during DND operations.
968 struct _GdkEventDND {
972 GdkDragContext *context;
975 gshort x_root, y_root;
981 * The #GdkEvent struct contains a union of all of the event structs,
982 * and allows access to the data fields in a number of ways.
984 * The event type is always the first field in all of the event structs, and
985 * can always be accessed with the following code, no matter what type of
992 * type = event->type;
996 * To access other fields of the event structs, the pointer to the event
997 * can be cast to the appropriate event struct pointer, or the union member
998 * name can be used. For example if the event type is %GDK_BUTTON_PRESS
999 * then the x coordinate of the button press can be accessed with:
1005 * x = ((GdkEventButton*)event)->x;
1007 * </informalexample>
1014 * x = event->button.x;
1016 * </informalexample>
1022 GdkEventExpose expose;
1023 GdkEventVisibility visibility;
1024 GdkEventMotion motion;
1025 GdkEventButton button;
1026 GdkEventScroll scroll;
1028 GdkEventCrossing crossing;
1029 GdkEventFocus focus_change;
1030 GdkEventConfigure configure;
1031 GdkEventProperty property;
1032 GdkEventSelection selection;
1033 GdkEventOwnerChange owner_change;
1034 GdkEventProximity proximity;
1036 GdkEventWindowState window_state;
1037 GdkEventSetting setting;
1038 GdkEventGrabBroken grab_broken;
1041 GType gdk_event_get_type (void) G_GNUC_CONST;
1043 gboolean gdk_events_pending (void);
1044 GdkEvent* gdk_event_get (void);
1046 GdkEvent* gdk_event_peek (void);
1047 void gdk_event_put (const GdkEvent *event);
1049 GdkEvent* gdk_event_new (GdkEventType type);
1050 GdkEvent* gdk_event_copy (const GdkEvent *event);
1051 void gdk_event_free (GdkEvent *event);
1053 guint32 gdk_event_get_time (const GdkEvent *event);
1054 gboolean gdk_event_get_state (const GdkEvent *event,
1055 GdkModifierType *state);
1056 gboolean gdk_event_get_coords (const GdkEvent *event,
1059 gboolean gdk_event_get_root_coords (const GdkEvent *event,
1062 gboolean gdk_event_get_button (const GdkEvent *event,
1064 gboolean gdk_event_get_click_count (const GdkEvent *event,
1065 guint *click_count);
1066 gboolean gdk_event_get_keyval (const GdkEvent *event,
1068 gboolean gdk_event_get_keycode (const GdkEvent *event,
1070 gboolean gdk_event_get_scroll_direction (const GdkEvent *event,
1071 GdkScrollDirection *direction);
1072 gboolean gdk_event_get_axis (const GdkEvent *event,
1073 GdkAxisUse axis_use,
1075 void gdk_event_set_device (GdkEvent *event,
1077 GdkDevice* gdk_event_get_device (const GdkEvent *event);
1078 void gdk_event_set_source_device (GdkEvent *event,
1080 GdkDevice* gdk_event_get_source_device (const GdkEvent *event);
1081 void gdk_event_request_motions (const GdkEventMotion *event);
1082 gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
1084 gboolean gdk_events_get_distance (GdkEvent *event1,
1087 gboolean gdk_events_get_angle (GdkEvent *event1,
1090 gboolean gdk_events_get_center (GdkEvent *event1,
1095 void gdk_event_handler_set (GdkEventFunc func,
1097 GDestroyNotify notify);
1099 void gdk_event_set_screen (GdkEvent *event,
1101 GdkScreen *gdk_event_get_screen (const GdkEvent *event);
1103 void gdk_set_show_events (gboolean show_events);
1104 gboolean gdk_get_show_events (void);
1106 #ifndef GDK_MULTIHEAD_SAFE
1108 gboolean gdk_setting_get (const gchar *name,
1111 #endif /* GDK_MULTIHEAD_SAFE */
1115 #endif /* __GDK_EVENTS_H__ */