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 _GdkEventNoExpose GdkEventNoExpose;
81 typedef struct _GdkEventVisibility GdkEventVisibility;
82 typedef struct _GdkEventMotion GdkEventMotion;
83 typedef struct _GdkEventButton GdkEventButton;
84 typedef struct _GdkEventScroll GdkEventScroll;
85 typedef struct _GdkEventKey GdkEventKey;
86 typedef struct _GdkEventFocus GdkEventFocus;
87 typedef struct _GdkEventCrossing GdkEventCrossing;
88 typedef struct _GdkEventConfigure GdkEventConfigure;
89 typedef struct _GdkEventProperty GdkEventProperty;
90 typedef struct _GdkEventSelection GdkEventSelection;
91 typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
92 typedef struct _GdkEventProximity GdkEventProximity;
93 typedef struct _GdkEventClient GdkEventClient;
94 typedef struct _GdkEventDND GdkEventDND;
95 typedef struct _GdkEventWindowState GdkEventWindowState;
96 typedef struct _GdkEventSetting GdkEventSetting;
97 typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
99 typedef union _GdkEvent GdkEvent;
103 * @event: the #GdkEvent to process.
104 * @data: user data set when the event handler was installed with
105 * gdk_event_handler_set().
107 * Specifies the type of function passed to gdk_event_handler_set() to
108 * handle all GDK events.
110 typedef void (*GdkEventFunc) (GdkEvent *event,
113 /* Event filtering */
118 * Used to represent native events (<type>XEvent</type>s for the X11
119 * backend, <type>MSG</type>s for Win32).
121 typedef void GdkXEvent; /* Can be cast to window system specific
122 * even type, XEvent on X11, MSG on Win32.
127 * @GDK_FILTER_CONTINUE: event not handled, continue processing.
128 * @GDK_FILTER_TRANSLATE: native event translated into a GDK event and stored
129 * in the <literal>event</literal> structure that was passed in.
130 * @GDK_FILTER_REMOVE: event handled, terminate processing.
132 * Specifies the result of applying a #GdkFilterFunc to a native event.
135 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
136 GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
137 stored in the "event" structure that was
139 GDK_FILTER_REMOVE /* Terminate processing, removing event */
144 * @xevent: the native event to filter.
145 * @event: the GDK event to which the X event will be translated.
146 * @data: user data set when the filter was installed.
148 * Specifies the type of function used to filter native events before they are
149 * converted to GDK events.
151 * When a filter is called, @event is unpopulated, except for
152 * <literal>event->window</literal>. The filter may translate the native
153 * event to a GDK event and store the result in @event, or handle it without
154 * translation. If the filter translates the event and processing should
155 * continue, it should return %GDK_FILTER_TRANSLATE.
157 * Returns: a #GdkFilterReturn value.
159 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
166 * @GDK_NOTHING: a special code to indicate a null event.
167 * @GDK_DELETE: the window manager has requested that the toplevel window be
168 * hidden or destroyed, usually when the user clicks on a special icon in the
170 * @GDK_DESTROY: the window has been destroyed.
171 * @GDK_EXPOSE: all or part of the window has become visible and needs to be
173 * @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
174 * @GDK_BUTTON_PRESS: a mouse button has been pressed.
175 * @GDK_2BUTTON_PRESS: a mouse button has been double-clicked (clicked twice
176 * within a short period of time). Note that each click also generates a
177 * %GDK_BUTTON_PRESS event.
178 * @GDK_3BUTTON_PRESS: a mouse button has been clicked 3 times in a short period
179 * of time. Note that each click also generates a %GDK_BUTTON_PRESS event.
180 * @GDK_BUTTON_RELEASE: a mouse button has been released.
181 * @GDK_KEY_PRESS: a key has been pressed.
182 * @GDK_KEY_RELEASE: a key has been released.
183 * @GDK_ENTER_NOTIFY: the pointer has entered the window.
184 * @GDK_LEAVE_NOTIFY: the pointer has left the window.
185 * @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the window.
186 * @GDK_CONFIGURE: the size, position or stacking order of the window has changed.
187 * Note that GTK+ discards these events for %GDK_WINDOW_CHILD windows.
188 * @GDK_MAP: the window has been mapped.
189 * @GDK_UNMAP: the window has been unmapped.
190 * @GDK_PROPERTY_NOTIFY: a property on the window has been changed or deleted.
191 * @GDK_SELECTION_CLEAR: the application has lost ownership of a selection.
192 * @GDK_SELECTION_REQUEST: another application has requested a selection.
193 * @GDK_SELECTION_NOTIFY: a selection has been received.
194 * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
195 * surface (e.g. a touchscreen or graphics tablet).
196 * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
198 * @GDK_DRAG_ENTER: the mouse has entered the window while a drag is in progress.
199 * @GDK_DRAG_LEAVE: the mouse has left the window while a drag is in progress.
200 * @GDK_DRAG_MOTION: the mouse has moved in the window while a drag is in
202 * @GDK_DRAG_STATUS: the status of the drag operation initiated by the window
204 * @GDK_DROP_START: a drop operation onto the window has started.
205 * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
206 * @GDK_CLIENT_EVENT: a message has been received from another application.
207 * @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
208 * @GDK_NO_EXPOSE: indicates that the source region was completely available
209 * when parts of a drawable were copied. This is not very useful.
210 * @GDK_SCROLL: the scroll wheel was turned
211 * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
212 * for the possible window states
213 * @GDK_SETTING: a setting has been modified.
214 * @GDK_OWNER_CHANGE: the owner of a selection has changed. This event type
216 * @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
218 * @GDK_DAMAGE: the content of the window has been changed. This event type
220 * @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
222 * Specifies the type of the event.
224 * Do not confuse these events with the signals that GTK+ widgets emit.
225 * Although many of these events result in corresponding signals being emitted,
226 * the events are often transformed or filtered along the way.
234 GDK_MOTION_NOTIFY = 3,
235 GDK_BUTTON_PRESS = 4,
236 GDK_2BUTTON_PRESS = 5,
237 GDK_3BUTTON_PRESS = 6,
238 GDK_BUTTON_RELEASE = 7,
241 GDK_ENTER_NOTIFY = 10,
242 GDK_LEAVE_NOTIFY = 11,
243 GDK_FOCUS_CHANGE = 12,
247 GDK_PROPERTY_NOTIFY = 16,
248 GDK_SELECTION_CLEAR = 17,
249 GDK_SELECTION_REQUEST = 18,
250 GDK_SELECTION_NOTIFY = 19,
251 GDK_PROXIMITY_IN = 20,
252 GDK_PROXIMITY_OUT = 21,
255 GDK_DRAG_MOTION = 24,
256 GDK_DRAG_STATUS = 25,
258 GDK_DROP_FINISHED = 27,
259 GDK_CLIENT_EVENT = 28,
260 GDK_VISIBILITY_NOTIFY = 29,
263 GDK_WINDOW_STATE = 32,
265 GDK_OWNER_CHANGE = 34,
266 GDK_GRAB_BROKEN = 35,
268 GDK_EVENT_LAST /* helper variable for decls */
272 * GdkVisibilityState:
273 * @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
274 * @GDK_VISIBILITY_PARTIAL: the window is partially visible.
275 * @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
277 * Specifies the visiblity status of a window for a #GdkEventVisibility.
281 GDK_VISIBILITY_UNOBSCURED,
282 GDK_VISIBILITY_PARTIAL,
283 GDK_VISIBILITY_FULLY_OBSCURED
284 } GdkVisibilityState;
287 * GdkScrollDirection:
288 * @GDK_SCROLL_UP: the window is scrolled up.
289 * @GDK_SCROLL_DOWN: the window is scrolled down.
290 * @GDK_SCROLL_LEFT: the window is scrolled to the left.
291 * @GDK_SCROLL_RIGHT: the window is scrolled to the right.
293 * Specifies the direction for #GdkEventScroll.
301 } GdkScrollDirection;
305 * @GDK_NOTIFY_ANCESTOR: the window is entered from an ancestor or
306 * left towards an ancestor.
307 * @GDK_NOTIFY_VIRTUAL: the pointer moves between an ancestor and an
308 * inferior of the window.
309 * @GDK_NOTIFY_INFERIOR: the window is entered from an inferior or
310 * left towards an inferior.
311 * @GDK_NOTIFY_NONLINEAR: the window is entered from or left towards
312 * a window which is neither an ancestor nor an inferior.
313 * @GDK_NOTIFY_NONLINEAR_VIRTUAL: the pointer moves between two windows
314 * which are not ancestors of each other and the window is part of
315 * the ancestor chain between one of these windows and their least
317 * @GDK_NOTIFY_UNKNOWN: an unknown type of enter/leave event occurred.
319 * Specifies the kind of crossing for #GdkEventCrossing.
321 * See the X11 protocol specification of <type>LeaveNotify</type> for
322 * full details of crossing event generation.
326 GDK_NOTIFY_ANCESTOR = 0,
327 GDK_NOTIFY_VIRTUAL = 1,
328 GDK_NOTIFY_INFERIOR = 2,
329 GDK_NOTIFY_NONLINEAR = 3,
330 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
331 GDK_NOTIFY_UNKNOWN = 5
336 * @GDK_CROSSING_NORMAL: crossing because of pointer motion.
337 * @GDK_CROSSING_GRAB: crossing because a grab is activated.
338 * @GDK_CROSSING_UNGRAB: crossing because a grab is deactivated.
339 * @GDK_CROSSING_GTK_GRAB: crossing because a GTK+ grab is activated.
340 * @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
341 * @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
342 * state (e.g. sensitivity).
344 * Specifies the crossing mode for #GdkEventCrossing.
351 GDK_CROSSING_GTK_GRAB,
352 GDK_CROSSING_GTK_UNGRAB,
353 GDK_CROSSING_STATE_CHANGED
358 * @GDK_PROPERTY_NEW_VALUE: the property value was changed.
359 * @GDK_PROPERTY_DELETE: the property was deleted.
361 * Specifies the type of a property change for a #GdkEventProperty.
365 GDK_PROPERTY_NEW_VALUE,
371 * @GDK_WINDOW_STATE_WITHDRAWN: the window is not shown.
372 * @GDK_WINDOW_STATE_ICONIFIED: the window is minimized.
373 * @GDK_WINDOW_STATE_MAXIMIZED: the window is maximized.
374 * @GDK_WINDOW_STATE_STICKY: the window is sticky.
375 * @GDK_WINDOW_STATE_FULLSCREEN: the window is maximized without
377 * @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
378 * @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
380 * Specifies the state of a toplevel window.
384 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
385 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
386 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
387 GDK_WINDOW_STATE_STICKY = 1 << 3,
388 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
389 GDK_WINDOW_STATE_ABOVE = 1 << 5,
390 GDK_WINDOW_STATE_BELOW = 1 << 6
395 * @GDK_SETTING_ACTION_NEW: a setting was added.
396 * @GDK_SETTING_ACTION_CHANGED: a setting was changed.
397 * @GDK_SETTING_ACTION_DELETED: a setting was deleted.
399 * Specifies the kind of modification applied to a setting in a
404 GDK_SETTING_ACTION_NEW,
405 GDK_SETTING_ACTION_CHANGED,
406 GDK_SETTING_ACTION_DELETED
411 * @GDK_OWNER_CHANGE_NEW_OWNER: some other app claimed the ownership
412 * @GDK_OWNER_CHANGE_DESTROY: the window was destroyed
413 * @GDK_OWNER_CHANGE_CLOSE: the client was closed
415 * Specifies why a selection ownership was changed.
419 GDK_OWNER_CHANGE_NEW_OWNER,
420 GDK_OWNER_CHANGE_DESTROY,
421 GDK_OWNER_CHANGE_CLOSE
426 * @type: the type of the event.
427 * @window: the window which received the event.
428 * @send_event: %TRUE if the event was sent explicitly (e.g. using
429 * <function>XSendEvent</function>).
431 * Contains the fields which are common to all event structs.
432 * Any event pointer can safely be cast to a pointer to a #GdkEventAny to
433 * access these fields.
444 * @type: the type of the event (%GDK_EXPOSE or %GDK_DAMAGE).
445 * @window: the window which received the event.
446 * @send_event: %TRUE if the event was sent explicitly (e.g. using
447 * <function>XSendEvent</function>).
448 * @area: bounding box of @region.
449 * @region: the region that needs to be redrawn.
450 * @count: the number of contiguous %GDK_EXPOSE events following this one.
451 * The only use for this is "exposure compression", i.e. handling all
452 * contiguous %GDK_EXPOSE events in one go, though GDK performs some
453 * exposure compression so this is not normally needed.
455 * Generated when all or part of a window becomes visible and needs to be
458 struct _GdkEventExpose
464 cairo_region_t *region;
465 gint count; /* If non-zero, how many more events follow. */
470 * @type: the type of the event (%GDK_NO_EXPOSE).
471 * @window: the window which received the event.
472 * @send_event: %TRUE if the event was sent explicitly (e.g. using
473 * <function>XSendEvent</function>).
475 * Generated when the area of a #GdkDrawable being copied was completely
478 struct _GdkEventNoExpose
486 * GdkEventVisibility:
487 * @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
488 * @window: the window which received the event.
489 * @send_event: %TRUE if the event was sent explicitly (e.g. using
490 * <function>XSendEvent</function>).
491 * @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
492 * %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
494 * Generated when the window visibility status has changed.
496 struct _GdkEventVisibility
501 GdkVisibilityState state;
506 * @type: the type of the event.
507 * @window: the window which received the event.
508 * @send_event: %TRUE if the event was sent explicitly (e.g. using
509 * <function>XSendEvent</function>).
510 * @time: the time of the event in milliseconds.
511 * @x: the x coordinate of the pointer relative to the window.
512 * @y: the y coordinate of the pointer relative to the window.
513 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
515 * @state: a bit-mask representing the state of the modifier keys (e.g.
516 * Control, Shift and Alt) and the pointer 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: a bit-mask representing the state of the modifier keys (e.g.
555 * Control, Shift and Alt) and the pointer buttons. See #GdkModifierType.
556 * @button: the button which was pressed or released, numbered from 1 to 5.
557 * Normally button 1 is the left mouse button, 2 is the middle button,
558 * and 3 is the right button. On 2-button mice, the middle button can
559 * often be simulated by pressing both mouse buttons together.
560 * @device: the device where the event originated.
561 * @x_root: the x coordinate of the pointer relative to the root of the
563 * @y_root: the y coordinate of the pointer relative to the root of the
566 * Used for button press and button release events. The
567 * @type field will be one of %GDK_BUTTON_PRESS,
568 * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
570 * Double and triple-clicks result in a sequence of events being received.
571 * For double-clicks the order of events will be:
573 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
574 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
575 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
576 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
577 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
579 * Note that the first click is received just like a normal
580 * button press, while the second click results in a %GDK_2BUTTON_PRESS
581 * being received just after the %GDK_BUTTON_PRESS.
583 * Triple-clicks are very similar to double-clicks, except that
584 * %GDK_3BUTTON_PRESS is inserted after the third click. The order of the
587 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
588 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
589 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
590 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
591 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
592 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
593 * <listitem><para>%GDK_3BUTTON_PRESS</para></listitem>
594 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
597 * For a double click to occur, the second button press must occur within
598 * 1/4 of a second of the first. For a triple click to occur, the third
599 * button press must also occur within 1/2 second of the first button press.
601 struct _GdkEventButton
613 gdouble x_root, y_root;
618 * @type: the type of the event (%GDK_SCROLL).
619 * @window: the window which received the event.
620 * @send_event: %TRUE if the event was sent explicitly (e.g. using
621 * <function>XSendEvent</function>).
622 * @time: the time of the event in milliseconds.
623 * @x: the x coordinate of the pointer relative to the window.
624 * @y: the y coordinate of the pointer relative to the window.
625 * @state: a bit-mask representing the state of the modifier keys (e.g.
626 * Control, Shift and Alt) and the pointer buttons. See #GdkModifierType.
627 * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
628 * %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT and %GDK_SCROLL_RIGHT).
629 * @device: the device where the event originated.
630 * @x_root: the x coordinate of the pointer relative to the root of the
632 * @y_root: the y coordinate of the pointer relative to the root of the
635 * Generated from button presses for the buttons 4 to 7. Wheel mice are
636 * usually configured to generate button press events for buttons 4 and 5
637 * when the wheel is turned.
639 struct _GdkEventScroll
648 GdkScrollDirection direction;
650 gdouble x_root, y_root;
655 * @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
656 * @window: the window which received the event.
657 * @send_event: %TRUE if the event was sent explicitly (e.g. using
658 * <function>XSendEvent</function>).
659 * @time: the time of the event in milliseconds.
660 * @state: a bit-mask representing the state of the modifier keys (e.g.
661 * Control, Shift and Alt) and the pointer buttons. See #GdkModifierType.
662 * @keyval: the key that was pressed or released. See the
663 * <filename><gdk/gdkkeysyms.h></filename> header file for a
664 * complete list of GDK key codes.
665 * @length: the length of @string.
666 * @string: a string containing the an approximation of the text that
667 * would result from this keypress. The only correct way to handle text
668 * input of text is using input methods (see #GtkIMContext), so this
669 * field is deprecated and should never be used.
670 * (gdk_unicode_to_keyval() provides a non-deprecated way of getting
671 * an approximate translation for a key.) The string is encoded in the
672 * encoding of the current locale (Note: this for backwards compatibility:
673 * strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
674 * In some cases, the translation of the key code will be a single
675 * NUL byte, in which case looking at @length is necessary to distinguish
676 * it from the an empty translation.
677 * @hardware_keycode: the raw code of the key that was pressed or released.
678 * @group: the keyboard group.
679 * @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
680 * modifier. Since 2.10
682 * Describes a key press or key release event.
694 guint16 hardware_keycode;
696 guint is_modifier : 1;
701 * @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
702 * @window: the window which received the event.
703 * @send_event: %TRUE if the event was sent explicitly (e.g. using
704 * <function>XSendEvent</function>).
705 * @subwindow: the window that was entered or left.
706 * @time: the time of the event in milliseconds.
707 * @x: the x coordinate of the pointer relative to the window.
708 * @y: the y coordinate of the pointer relative to the window.
709 * @x_root: the x coordinate of the pointer relative to the root of the screen.
710 * @y_root: the y coordinate of the pointer relative to the root of the screen.
711 * @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
712 * %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
713 * %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
714 * and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
716 * @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
717 * %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
718 * %GDK_NOTIFY_NONLINEAR_VIRTUAL).
719 * @focus: %TRUE if @window is the focus window or an inferior.
720 * @state: a bit-mask representing the state of the modifier keys (e.g. Control,
721 * Shift and Alt) and the pointer buttons. See #GdkModifierType.
723 * Generated when the pointer enters or leaves a window.
725 struct _GdkEventCrossing
730 GdkWindow *subwindow;
736 GdkCrossingMode mode;
737 GdkNotifyType detail;
744 * @type: the type of the event (%GDK_FOCUS_CHANGE).
745 * @window: the window which received the event.
746 * @send_event: %TRUE if the event was sent explicitly (e.g. using
747 * <function>XSendEvent</function>).
748 * @in: %TRUE if the window has gained the keyboard focus, %FALSE if
749 * it has lost the focus.
751 * Describes a change of keyboard focus.
753 struct _GdkEventFocus
763 * @type: the type of the event (%GDK_CONFIGURE).
764 * @window: the window which received the event.
765 * @send_event: %TRUE if the event was sent explicitly (e.g. using
766 * <function>XSendEvent</function>).
767 * @x: the new x coordinate of the window, relative to its parent.
768 * @y: the new y coordinate of the window, relative to its parent.
769 * @width: the new width of the window.
770 * @height: the new height of the window.
772 * Generated when a window size or position has changed.
774 struct _GdkEventConfigure
786 * @type: the type of the event (%GDK_PROPERTY_NOTIFY).
787 * @window: the window which received the event.
788 * @send_event: %TRUE if the event was sent explicitly (e.g. using
789 * <function>XSendEvent</function>).
790 * @atom: the property that was changed.
791 * @time: the time of the event in milliseconds.
792 * @state: whether the property was changed (%GDK_PROPERTY_NEW_VALUE) or
793 * deleted (%GDK_PROPERTY_DELETE).
795 * Describes a property change on a window.
797 struct _GdkEventProperty
809 * @type: the type of the event (%GDK_SELECTION_CLEAR,
810 * %GDK_SELECTION_NOTIFY or %GDK_SELECTION_REQUEST).
811 * @window: the window which received the event.
812 * @send_event: %TRUE if the event was sent explicitly (e.g. using
813 * <function>XSendEvent</function>).
814 * @selection: the selection.
815 * @target: the target to which the selection should be converted.
816 * @property: the property in which to place the result of the conversion.
817 * @time: the time of the event in milliseconds.
818 * @requestor: the native window on which to place @property.
820 * Generated when a selection is requested or ownership of a selection
821 * is taken over by another client application.
823 struct _GdkEventSelection
832 GdkNativeWindow requestor;
836 * GdkEventOwnerChange:
837 * @type: the type of the event (%GDK_OWNER_CHANGE).
838 * @window: the window which received the event.
839 * @send_event: %TRUE if the event was sent explicitly (e.g. using
840 * <function>XSendEvent</function>).
841 * @owner: the new owner of the selection.
842 * @reason: the reason for the ownership change as a #GdkOwnerChange value.
843 * @selection: the atom identifying the selection.
844 * @time: the timestamp of the event.
845 * @selection_time: the time at which the selection ownership was taken
848 * Generated when the owner of a selection changes. On X11, this
849 * information is only available if the X server supports the XFIXES
854 struct _GdkEventOwnerChange
859 GdkNativeWindow owner;
860 GdkOwnerChange reason;
863 guint32 selection_time;
868 * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
869 * @window: the window which received the event.
870 * @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
871 * @time: the time of the event in milliseconds.
872 * @device: the device where the event originated.
874 * Proximity events are generated when using GDK's wrapper for the
875 * XInput extension. The XInput extension is an add-on for standard X
876 * that allows you to use nonstandard devices such as graphics tablets.
877 * A proximity event indicates that the stylus has moved in or out of
878 * contact with the tablet, or perhaps that the user's finger has moved
879 * in or out of contact with a touch screen.
881 * This event type will be used pretty rarely. It only is important for
882 * XInput aware programs that are drawing their own cursor.
884 struct _GdkEventProximity
895 * @type: the type of the event (%GDK_CLIENT_EVENT).
896 * @window: the window which received the event.
897 * @send_event: %TRUE if the event was sent explicitly (e.g. using
898 * <function>XSendEvent</function>).
899 * @message_type: the type of the message, which can be defined by the
901 * @data_format: the format of the data, given as the number of bits in each
902 * data element, i.e. 8, 16, or 32. 8-bit data uses the b array of the
903 * data union, 16-bit data uses the s array, and 32-bit data uses the l
906 * An event sent by another client application.
908 struct _GdkEventClient
913 GdkAtom message_type;
924 * @type: the type of the event (%GDK_SETTING).
925 * @window: the window which received the event.
926 * @send_event: %TRUE if the event was sent explicitly (e.g. using
927 * <function>XSendEvent</function>).
928 * @action: what happened to the setting (%GDK_SETTING_ACTION_NEW,
929 * %GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
930 * @name: the name of the setting.
932 * Generated when a setting is modified.
934 struct _GdkEventSetting
939 GdkSettingAction action;
944 * GdkEventWindowState:
945 * @type: the type of the event (%GDK_WINDOW_STATE).
946 * @window: the window which received the event.
947 * @send_event: %TRUE if the event was sent explicitly (e.g. using
948 * <function>XSendEvent</function>).
949 * @changed_mask: mask specifying what flags have changed.
950 * @new_window_state: the new window state, a combination of
951 * #GdkWindowState bits.
953 * Generated when the state of a toplevel window changes.
955 struct _GdkEventWindowState
960 GdkWindowState changed_mask;
961 GdkWindowState new_window_state;
965 * GdkEventGrabBroken:
966 * @type: the type of the event (%GDK_GRAB_BROKEN)
967 * @window: the window which received the event, i.e. the window
968 * that previously owned the grab
969 * @send_event: %TRUE if the event was sent explicitly (e.g. using
970 * <function>XSendEvent</function>).
971 * @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
973 * @implicit: %TRUE if the broken grab was implicit
974 * @grab_window: If this event is caused by another grab in the same
975 * application, @grab_window contains the new grab window. Otherwise
976 * @grab_window is %NULL.
978 * Generated when a pointer or keyboard grab is broken. On X11, this happens
979 * when the grab window becomes unviewable (i.e. it or one of its ancestors
980 * is unmapped), or if the same application grabs the pointer or keyboard
981 * again. Note that implicit grabs (which are initiated by button presses)
982 * can also cause #GdkEventGrabBroken events.
986 struct _GdkEventGrabBroken {
992 GdkWindow *grab_window;
997 * @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
998 * %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
999 * %GDK_DROP_FINISHED).
1000 * @window: the window which received the event.
1001 * @send_event: %TRUE if the event was sent explicitly (e.g. using
1002 * <function>XSendEvent</function>).
1003 * @context: the #GdkDragContext for the current DND operation.
1004 * @time: the time of the event in milliseconds.
1005 * @x_root: the x coordinate of the pointer relative to the root of the
1006 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
1007 * @y_root: the y coordinate of the pointer relative to the root of the
1008 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
1010 * Generated during DND operations.
1012 struct _GdkEventDND {
1016 GdkDragContext *context;
1019 gshort x_root, y_root;
1025 * The #GdkEvent struct contains a union of all of the event structs,
1026 * and allows access to the data fields in a number of ways.
1028 * The event type is always the first field in all of the event structs, and
1029 * can always be accessed with the following code, no matter what type of
1034 * GdkEventType type;
1036 * type = event->type;
1038 * </informalexample>
1040 * To access other fields of the event structs, the pointer to the event
1041 * can be cast to the appropriate event struct pointer, or the union member
1042 * name can be used. For example if the event type is %GDK_BUTTON_PRESS
1043 * then the x coordinate of the button press can be accessed with:
1049 * x = ((GdkEventButton*)event)->x;
1051 * </informalexample>
1058 * x = event->button.x;
1060 * </informalexample>
1066 GdkEventExpose expose;
1067 GdkEventNoExpose no_expose;
1068 GdkEventVisibility visibility;
1069 GdkEventMotion motion;
1070 GdkEventButton button;
1071 GdkEventScroll scroll;
1073 GdkEventCrossing crossing;
1074 GdkEventFocus focus_change;
1075 GdkEventConfigure configure;
1076 GdkEventProperty property;
1077 GdkEventSelection selection;
1078 GdkEventOwnerChange owner_change;
1079 GdkEventProximity proximity;
1080 GdkEventClient client;
1082 GdkEventWindowState window_state;
1083 GdkEventSetting setting;
1084 GdkEventGrabBroken grab_broken;
1087 GType gdk_event_get_type (void) G_GNUC_CONST;
1089 gboolean gdk_events_pending (void);
1090 GdkEvent* gdk_event_get (void);
1092 GdkEvent* gdk_event_peek (void);
1093 void gdk_event_put (const GdkEvent *event);
1095 GdkEvent* gdk_event_new (GdkEventType type);
1096 GdkEvent* gdk_event_copy (const GdkEvent *event);
1097 void gdk_event_free (GdkEvent *event);
1099 guint32 gdk_event_get_time (const GdkEvent *event);
1100 gboolean gdk_event_get_state (const GdkEvent *event,
1101 GdkModifierType *state);
1102 gboolean gdk_event_get_coords (const GdkEvent *event,
1105 gboolean gdk_event_get_root_coords (const GdkEvent *event,
1108 gboolean gdk_event_get_axis (const GdkEvent *event,
1109 GdkAxisUse axis_use,
1111 void gdk_event_set_device (GdkEvent *event,
1113 GdkDevice* gdk_event_get_device (const GdkEvent *event);
1114 void gdk_event_request_motions (const GdkEventMotion *event);
1116 gboolean gdk_events_get_distance (GdkEvent *event1,
1119 gboolean gdk_events_get_angle (GdkEvent *event1,
1122 gboolean gdk_events_get_center (GdkEvent *event1,
1127 void gdk_event_handler_set (GdkEventFunc func,
1129 GDestroyNotify notify);
1131 void gdk_event_set_screen (GdkEvent *event,
1133 GdkScreen *gdk_event_get_screen (const GdkEvent *event);
1135 void gdk_set_show_events (gboolean show_events);
1136 gboolean gdk_get_show_events (void);
1138 #ifndef GDK_MULTIHEAD_SAFE
1140 gboolean gdk_setting_get (const gchar *name,
1142 void gdk_add_client_message_filter (GdkAtom message_type,
1145 gboolean gdk_event_send_client_message (GdkEvent *event,
1146 GdkNativeWindow winid);
1147 void gdk_event_send_clientmessage_toall (GdkEvent *event);
1149 #endif /* GDK_MULTIHEAD_SAFE */
1151 gboolean gdk_event_send_client_message_for_display (GdkDisplay *display,
1153 GdkNativeWindow winid);
1157 #endif /* __GDK_EVENTS_H__ */