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 _GdkEventClient GdkEventClient;
93 typedef struct _GdkEventDND GdkEventDND;
94 typedef struct _GdkEventWindowState GdkEventWindowState;
95 typedef struct _GdkEventSetting GdkEventSetting;
96 typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
98 typedef union _GdkEvent GdkEvent;
102 * @event: the #GdkEvent to process.
103 * @data: user data set when the event handler was installed with
104 * gdk_event_handler_set().
106 * Specifies the type of function passed to gdk_event_handler_set() to
107 * handle all GDK events.
109 typedef void (*GdkEventFunc) (GdkEvent *event,
112 /* Event filtering */
117 * Used to represent native events (<type>XEvent</type>s for the X11
118 * backend, <type>MSG</type>s for Win32).
120 typedef void GdkXEvent; /* Can be cast to window system specific
121 * even type, XEvent on X11, MSG on Win32.
126 * @GDK_FILTER_CONTINUE: event not handled, continue processing.
127 * @GDK_FILTER_TRANSLATE: native event translated into a GDK event and stored
128 * in the <literal>event</literal> structure that was passed in.
129 * @GDK_FILTER_REMOVE: event handled, terminate processing.
131 * Specifies the result of applying a #GdkFilterFunc to a native event.
134 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
135 GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
136 stored in the "event" structure that was
138 GDK_FILTER_REMOVE /* Terminate processing, removing event */
143 * @xevent: the native event to filter.
144 * @event: the GDK event to which the X event will be translated.
145 * @data: user data set when the filter was installed.
147 * Specifies the type of function used to filter native events before they are
148 * converted to GDK events.
150 * When a filter is called, @event is unpopulated, except for
151 * <literal>event->window</literal>. The filter may translate the native
152 * event to a GDK event and store the result in @event, or handle it without
153 * translation. If the filter translates the event and processing should
154 * continue, it should return %GDK_FILTER_TRANSLATE.
156 * Returns: a #GdkFilterReturn value.
158 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
165 * @GDK_NOTHING: a special code to indicate a null event.
166 * @GDK_DELETE: the window manager has requested that the toplevel window be
167 * hidden or destroyed, usually when the user clicks on a special icon in the
169 * @GDK_DESTROY: the window has been destroyed.
170 * @GDK_EXPOSE: all or part of the window has become visible and needs to be
172 * @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
173 * @GDK_BUTTON_PRESS: a mouse button has been pressed.
174 * @GDK_2BUTTON_PRESS: a mouse button has been double-clicked (clicked twice
175 * within a short period of time). Note that each click also generates a
176 * %GDK_BUTTON_PRESS event.
177 * @GDK_3BUTTON_PRESS: a mouse button has been clicked 3 times in a short period
178 * of time. Note that each click also generates a %GDK_BUTTON_PRESS event.
179 * @GDK_BUTTON_RELEASE: a mouse button has been released.
180 * @GDK_KEY_PRESS: a key has been pressed.
181 * @GDK_KEY_RELEASE: a key has been released.
182 * @GDK_ENTER_NOTIFY: the pointer has entered the window.
183 * @GDK_LEAVE_NOTIFY: the pointer has left the window.
184 * @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the window.
185 * @GDK_CONFIGURE: the size, position or stacking order of the window has changed.
186 * Note that GTK+ discards these events for %GDK_WINDOW_CHILD windows.
187 * @GDK_MAP: the window has been mapped.
188 * @GDK_UNMAP: the window has been unmapped.
189 * @GDK_PROPERTY_NOTIFY: a property on the window has been changed or deleted.
190 * @GDK_SELECTION_CLEAR: the application has lost ownership of a selection.
191 * @GDK_SELECTION_REQUEST: another application has requested a selection.
192 * @GDK_SELECTION_NOTIFY: a selection has been received.
193 * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
194 * surface (e.g. a touchscreen or graphics tablet).
195 * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
197 * @GDK_DRAG_ENTER: the mouse has entered the window while a drag is in progress.
198 * @GDK_DRAG_LEAVE: the mouse has left the window while a drag is in progress.
199 * @GDK_DRAG_MOTION: the mouse has moved in the window while a drag is in
201 * @GDK_DRAG_STATUS: the status of the drag operation initiated by the window
203 * @GDK_DROP_START: a drop operation onto the window has started.
204 * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
205 * @GDK_CLIENT_EVENT: a message has been received from another application.
206 * @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
207 * @GDK_SCROLL: the scroll wheel was turned
208 * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
209 * for the possible window states
210 * @GDK_SETTING: a setting has been modified.
211 * @GDK_OWNER_CHANGE: the owner of a selection has changed. This event type
213 * @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
215 * @GDK_DAMAGE: the content of the window has been changed. This event type
217 * @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
219 * Specifies the type of the event.
221 * Do not confuse these events with the signals that GTK+ widgets emit.
222 * Although many of these events result in corresponding signals being emitted,
223 * the events are often transformed or filtered along the way.
231 GDK_MOTION_NOTIFY = 3,
232 GDK_BUTTON_PRESS = 4,
233 GDK_2BUTTON_PRESS = 5,
234 GDK_3BUTTON_PRESS = 6,
235 GDK_BUTTON_RELEASE = 7,
238 GDK_ENTER_NOTIFY = 10,
239 GDK_LEAVE_NOTIFY = 11,
240 GDK_FOCUS_CHANGE = 12,
244 GDK_PROPERTY_NOTIFY = 16,
245 GDK_SELECTION_CLEAR = 17,
246 GDK_SELECTION_REQUEST = 18,
247 GDK_SELECTION_NOTIFY = 19,
248 GDK_PROXIMITY_IN = 20,
249 GDK_PROXIMITY_OUT = 21,
252 GDK_DRAG_MOTION = 24,
253 GDK_DRAG_STATUS = 25,
255 GDK_DROP_FINISHED = 27,
256 GDK_CLIENT_EVENT = 28,
257 GDK_VISIBILITY_NOTIFY = 29,
259 GDK_WINDOW_STATE = 32,
261 GDK_OWNER_CHANGE = 34,
262 GDK_GRAB_BROKEN = 35,
264 GDK_EVENT_LAST /* helper variable for decls */
268 * GdkVisibilityState:
269 * @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
270 * @GDK_VISIBILITY_PARTIAL: the window is partially visible.
271 * @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
273 * Specifies the visiblity status of a window for a #GdkEventVisibility.
277 GDK_VISIBILITY_UNOBSCURED,
278 GDK_VISIBILITY_PARTIAL,
279 GDK_VISIBILITY_FULLY_OBSCURED
280 } GdkVisibilityState;
283 * GdkScrollDirection:
284 * @GDK_SCROLL_UP: the window is scrolled up.
285 * @GDK_SCROLL_DOWN: the window is scrolled down.
286 * @GDK_SCROLL_LEFT: the window is scrolled to the left.
287 * @GDK_SCROLL_RIGHT: the window is scrolled to the right.
289 * Specifies the direction for #GdkEventScroll.
297 } GdkScrollDirection;
301 * @GDK_NOTIFY_ANCESTOR: the window is entered from an ancestor or
302 * left towards an ancestor.
303 * @GDK_NOTIFY_VIRTUAL: the pointer moves between an ancestor and an
304 * inferior of the window.
305 * @GDK_NOTIFY_INFERIOR: the window is entered from an inferior or
306 * left towards an inferior.
307 * @GDK_NOTIFY_NONLINEAR: the window is entered from or left towards
308 * a window which is neither an ancestor nor an inferior.
309 * @GDK_NOTIFY_NONLINEAR_VIRTUAL: the pointer moves between two windows
310 * which are not ancestors of each other and the window is part of
311 * the ancestor chain between one of these windows and their least
313 * @GDK_NOTIFY_UNKNOWN: an unknown type of enter/leave event occurred.
315 * Specifies the kind of crossing for #GdkEventCrossing.
317 * See the X11 protocol specification of <type>LeaveNotify</type> for
318 * full details of crossing event generation.
322 GDK_NOTIFY_ANCESTOR = 0,
323 GDK_NOTIFY_VIRTUAL = 1,
324 GDK_NOTIFY_INFERIOR = 2,
325 GDK_NOTIFY_NONLINEAR = 3,
326 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
327 GDK_NOTIFY_UNKNOWN = 5
332 * @GDK_CROSSING_NORMAL: crossing because of pointer motion.
333 * @GDK_CROSSING_GRAB: crossing because a grab is activated.
334 * @GDK_CROSSING_UNGRAB: crossing because a grab is deactivated.
335 * @GDK_CROSSING_GTK_GRAB: crossing because a GTK+ grab is activated.
336 * @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
337 * @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
338 * state (e.g. sensitivity).
340 * Specifies the crossing mode for #GdkEventCrossing.
347 GDK_CROSSING_GTK_GRAB,
348 GDK_CROSSING_GTK_UNGRAB,
349 GDK_CROSSING_STATE_CHANGED
354 * @GDK_PROPERTY_NEW_VALUE: the property value was changed.
355 * @GDK_PROPERTY_DELETE: the property was deleted.
357 * Specifies the type of a property change for a #GdkEventProperty.
361 GDK_PROPERTY_NEW_VALUE,
367 * @GDK_WINDOW_STATE_WITHDRAWN: the window is not shown.
368 * @GDK_WINDOW_STATE_ICONIFIED: the window is minimized.
369 * @GDK_WINDOW_STATE_MAXIMIZED: the window is maximized.
370 * @GDK_WINDOW_STATE_STICKY: the window is sticky.
371 * @GDK_WINDOW_STATE_FULLSCREEN: the window is maximized without
373 * @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
374 * @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
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
391 * @GDK_SETTING_ACTION_NEW: a setting was added.
392 * @GDK_SETTING_ACTION_CHANGED: a setting was changed.
393 * @GDK_SETTING_ACTION_DELETED: a setting was deleted.
395 * Specifies the kind of modification applied to a setting in a
400 GDK_SETTING_ACTION_NEW,
401 GDK_SETTING_ACTION_CHANGED,
402 GDK_SETTING_ACTION_DELETED
407 * @GDK_OWNER_CHANGE_NEW_OWNER: some other app claimed the ownership
408 * @GDK_OWNER_CHANGE_DESTROY: the window was destroyed
409 * @GDK_OWNER_CHANGE_CLOSE: the client was closed
411 * Specifies why a selection ownership was changed.
415 GDK_OWNER_CHANGE_NEW_OWNER,
416 GDK_OWNER_CHANGE_DESTROY,
417 GDK_OWNER_CHANGE_CLOSE
422 * @type: the type of the event.
423 * @window: the window which received the event.
424 * @send_event: %TRUE if the event was sent explicitly (e.g. using
425 * <function>XSendEvent</function>).
427 * Contains the fields which are common to all event structs.
428 * Any event pointer can safely be cast to a pointer to a #GdkEventAny to
429 * access these fields.
440 * @type: the type of the event (%GDK_EXPOSE or %GDK_DAMAGE).
441 * @window: the window which received the event.
442 * @send_event: %TRUE if the event was sent explicitly (e.g. using
443 * <function>XSendEvent</function>).
444 * @area: bounding box of @region.
445 * @region: the region that needs to be redrawn.
446 * @count: the number of contiguous %GDK_EXPOSE events following this one.
447 * The only use for this is "exposure compression", i.e. handling all
448 * contiguous %GDK_EXPOSE events in one go, though GDK performs some
449 * exposure compression so this is not normally needed.
451 * Generated when all or part of a window becomes visible and needs to be
454 struct _GdkEventExpose
460 cairo_region_t *region;
461 gint count; /* If non-zero, how many more events follow. */
465 * GdkEventVisibility:
466 * @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
467 * @window: the window which received the event.
468 * @send_event: %TRUE if the event was sent explicitly (e.g. using
469 * <function>XSendEvent</function>).
470 * @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
471 * %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
473 * Generated when the window visibility status has changed.
475 struct _GdkEventVisibility
480 GdkVisibilityState state;
485 * @type: the type of the event.
486 * @window: the window which received the event.
487 * @send_event: %TRUE if the event was sent explicitly (e.g. using
488 * <function>XSendEvent</function>).
489 * @time: the time of the event in milliseconds.
490 * @x: the x coordinate of the pointer relative to the window.
491 * @y: the y coordinate of the pointer relative to the window.
492 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
494 * @state: a bit-mask representing the state of the modifier keys (e.g.
495 * Control, Shift and Alt) and the pointer buttons. See #GdkModifierType.
496 * @is_hint: set to 1 if this event is just a hint, see the
497 * %GDK_POINTER_MOTION_HINT_MASK value of #GdkEventMask.
498 * @device: the device where the event originated.
499 * @x_root: the x coordinate of the pointer relative to the root of the
501 * @y_root: the y coordinate of the pointer relative to the root of the
504 * Generated when the pointer moves.
506 struct _GdkEventMotion
518 gdouble x_root, y_root;
523 * @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
524 * %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
525 * @window: the window which received the event.
526 * @send_event: %TRUE if the event was sent explicitly (e.g. using
527 * <function>XSendEvent</function>).
528 * @time: the time of the event in milliseconds.
529 * @x: the x coordinate of the pointer relative to the window.
530 * @y: the y coordinate of the pointer relative to the window.
531 * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
533 * @state: a bit-mask representing the state of the modifier keys (e.g.
534 * Control, Shift and Alt) and the pointer buttons. See #GdkModifierType.
535 * @button: the button which was pressed or released, numbered from 1 to 5.
536 * Normally button 1 is the left mouse button, 2 is the middle button,
537 * and 3 is the right button. On 2-button mice, the middle button can
538 * often be simulated by pressing both mouse buttons together.
539 * @device: the device where the event originated.
540 * @x_root: the x coordinate of the pointer relative to the root of the
542 * @y_root: the y coordinate of the pointer relative to the root of the
545 * Used for button press and button release events. The
546 * @type field will be one of %GDK_BUTTON_PRESS,
547 * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
549 * Double and triple-clicks result in a sequence of events being received.
550 * For double-clicks the order of events will be:
552 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
553 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
554 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
555 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
556 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
558 * Note that the first click is received just like a normal
559 * button press, while the second click results in a %GDK_2BUTTON_PRESS
560 * being received just after the %GDK_BUTTON_PRESS.
562 * Triple-clicks are very similar to double-clicks, except that
563 * %GDK_3BUTTON_PRESS is inserted after the third click. The order of the
566 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
567 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
568 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
569 * <listitem><para>%GDK_2BUTTON_PRESS</para></listitem>
570 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
571 * <listitem><para>%GDK_BUTTON_PRESS</para></listitem>
572 * <listitem><para>%GDK_3BUTTON_PRESS</para></listitem>
573 * <listitem><para>%GDK_BUTTON_RELEASE</para></listitem>
576 * For a double click to occur, the second button press must occur within
577 * 1/4 of a second of the first. For a triple click to occur, the third
578 * button press must also occur within 1/2 second of the first button press.
580 struct _GdkEventButton
592 gdouble x_root, y_root;
597 * @type: the type of the event (%GDK_SCROLL).
598 * @window: the window which received the event.
599 * @send_event: %TRUE if the event was sent explicitly (e.g. using
600 * <function>XSendEvent</function>).
601 * @time: the time of the event in milliseconds.
602 * @x: the x coordinate of the pointer relative to the window.
603 * @y: the y coordinate of the pointer relative to the window.
604 * @state: a bit-mask representing the state of the modifier keys (e.g.
605 * Control, Shift and Alt) and the pointer buttons. See #GdkModifierType.
606 * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
607 * %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT and %GDK_SCROLL_RIGHT).
608 * @device: the device where the event originated.
609 * @x_root: the x coordinate of the pointer relative to the root of the
611 * @y_root: the y coordinate of the pointer relative to the root of the
614 * Generated from button presses for the buttons 4 to 7. Wheel mice are
615 * usually configured to generate button press events for buttons 4 and 5
616 * when the wheel is turned.
618 struct _GdkEventScroll
627 GdkScrollDirection direction;
629 gdouble x_root, y_root;
634 * @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
635 * @window: the window which received the event.
636 * @send_event: %TRUE if the event was sent explicitly (e.g. using
637 * <function>XSendEvent</function>).
638 * @time: the time of the event in milliseconds.
639 * @state: a bit-mask representing the state of the modifier keys (e.g.
640 * Control, Shift and Alt) and the pointer buttons. See #GdkModifierType.
641 * @keyval: the key that was pressed or released. See the
642 * <filename><gdk/gdkkeysyms.h></filename> header file for a
643 * complete list of GDK key codes.
644 * @length: the length of @string.
645 * @string: a string containing the an approximation of the text that
646 * would result from this keypress. The only correct way to handle text
647 * input of text is using input methods (see #GtkIMContext), so this
648 * field is deprecated and should never be used.
649 * (gdk_unicode_to_keyval() provides a non-deprecated way of getting
650 * an approximate translation for a key.) The string is encoded in the
651 * encoding of the current locale (Note: this for backwards compatibility:
652 * strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
653 * In some cases, the translation of the key code will be a single
654 * NUL byte, in which case looking at @length is necessary to distinguish
655 * it from the an empty translation.
656 * @hardware_keycode: the raw code of the key that was pressed or released.
657 * @group: the keyboard group.
658 * @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
659 * modifier. Since 2.10
661 * Describes a key press or key release event.
673 guint16 hardware_keycode;
675 guint is_modifier : 1;
680 * @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
681 * @window: the window which received the event.
682 * @send_event: %TRUE if the event was sent explicitly (e.g. using
683 * <function>XSendEvent</function>).
684 * @subwindow: the window that was entered or left.
685 * @time: the time of the event in milliseconds.
686 * @x: the x coordinate of the pointer relative to the window.
687 * @y: the y coordinate of the pointer relative to the window.
688 * @x_root: the x coordinate of the pointer relative to the root of the screen.
689 * @y_root: the y coordinate of the pointer relative to the root of the screen.
690 * @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
691 * %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
692 * %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
693 * and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
695 * @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
696 * %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
697 * %GDK_NOTIFY_NONLINEAR_VIRTUAL).
698 * @focus: %TRUE if @window is the focus window or an inferior.
699 * @state: a bit-mask representing the state of the modifier keys (e.g. Control,
700 * Shift and Alt) and the pointer buttons. See #GdkModifierType.
702 * Generated when the pointer enters or leaves a window.
704 struct _GdkEventCrossing
709 GdkWindow *subwindow;
715 GdkCrossingMode mode;
716 GdkNotifyType detail;
723 * @type: the type of the event (%GDK_FOCUS_CHANGE).
724 * @window: the window which received the event.
725 * @send_event: %TRUE if the event was sent explicitly (e.g. using
726 * <function>XSendEvent</function>).
727 * @in: %TRUE if the window has gained the keyboard focus, %FALSE if
728 * it has lost the focus.
730 * Describes a change of keyboard focus.
732 struct _GdkEventFocus
742 * @type: the type of the event (%GDK_CONFIGURE).
743 * @window: the window which received the event.
744 * @send_event: %TRUE if the event was sent explicitly (e.g. using
745 * <function>XSendEvent</function>).
746 * @x: the new x coordinate of the window, relative to its parent.
747 * @y: the new y coordinate of the window, relative to its parent.
748 * @width: the new width of the window.
749 * @height: the new height of the window.
751 * Generated when a window size or position has changed.
753 struct _GdkEventConfigure
765 * @type: the type of the event (%GDK_PROPERTY_NOTIFY).
766 * @window: the window which received the event.
767 * @send_event: %TRUE if the event was sent explicitly (e.g. using
768 * <function>XSendEvent</function>).
769 * @atom: the property that was changed.
770 * @time: the time of the event in milliseconds.
771 * @state: whether the property was changed (%GDK_PROPERTY_NEW_VALUE) or
772 * deleted (%GDK_PROPERTY_DELETE).
774 * Describes a property change on a window.
776 struct _GdkEventProperty
788 * @type: the type of the event (%GDK_SELECTION_CLEAR,
789 * %GDK_SELECTION_NOTIFY or %GDK_SELECTION_REQUEST).
790 * @window: the window which received the event.
791 * @send_event: %TRUE if the event was sent explicitly (e.g. using
792 * <function>XSendEvent</function>).
793 * @selection: the selection.
794 * @target: the target to which the selection should be converted.
795 * @property: the property in which to place the result of the conversion.
796 * @time: the time of the event in milliseconds.
797 * @requestor: the native window on which to place @property.
799 * Generated when a selection is requested or ownership of a selection
800 * is taken over by another client application.
802 struct _GdkEventSelection
811 GdkNativeWindow requestor;
815 * GdkEventOwnerChange:
816 * @type: the type of the event (%GDK_OWNER_CHANGE).
817 * @window: the window which received the event.
818 * @send_event: %TRUE if the event was sent explicitly (e.g. using
819 * <function>XSendEvent</function>).
820 * @owner: the new owner of the selection.
821 * @reason: the reason for the ownership change as a #GdkOwnerChange value.
822 * @selection: the atom identifying the selection.
823 * @time: the timestamp of the event.
824 * @selection_time: the time at which the selection ownership was taken
827 * Generated when the owner of a selection changes. On X11, this
828 * information is only available if the X server supports the XFIXES
833 struct _GdkEventOwnerChange
838 GdkNativeWindow owner;
839 GdkOwnerChange reason;
842 guint32 selection_time;
847 * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
848 * @window: the window which received the event.
849 * @send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
850 * @time: the time of the event in milliseconds.
851 * @device: the device where the event originated.
853 * Proximity events are generated when using GDK's wrapper for the
854 * XInput extension. The XInput extension is an add-on for standard X
855 * that allows you to use nonstandard devices such as graphics tablets.
856 * A proximity event indicates that the stylus has moved in or out of
857 * contact with the tablet, or perhaps that the user's finger has moved
858 * in or out of contact with a touch screen.
860 * This event type will be used pretty rarely. It only is important for
861 * XInput aware programs that are drawing their own cursor.
863 struct _GdkEventProximity
874 * @type: the type of the event (%GDK_CLIENT_EVENT).
875 * @window: the window which received the event.
876 * @send_event: %TRUE if the event was sent explicitly (e.g. using
877 * <function>XSendEvent</function>).
878 * @message_type: the type of the message, which can be defined by the
880 * @data_format: the format of the data, given as the number of bits in each
881 * data element, i.e. 8, 16, or 32. 8-bit data uses the b array of the
882 * data union, 16-bit data uses the s array, and 32-bit data uses the l
885 * An event sent by another client application.
887 struct _GdkEventClient
892 GdkAtom message_type;
903 * @type: the type of the event (%GDK_SETTING).
904 * @window: the window which received the event.
905 * @send_event: %TRUE if the event was sent explicitly (e.g. using
906 * <function>XSendEvent</function>).
907 * @action: what happened to the setting (%GDK_SETTING_ACTION_NEW,
908 * %GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
909 * @name: the name of the setting.
911 * Generated when a setting is modified.
913 struct _GdkEventSetting
918 GdkSettingAction action;
923 * GdkEventWindowState:
924 * @type: the type of the event (%GDK_WINDOW_STATE).
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 * @changed_mask: mask specifying what flags have changed.
929 * @new_window_state: the new window state, a combination of
930 * #GdkWindowState bits.
932 * Generated when the state of a toplevel window changes.
934 struct _GdkEventWindowState
939 GdkWindowState changed_mask;
940 GdkWindowState new_window_state;
944 * GdkEventGrabBroken:
945 * @type: the type of the event (%GDK_GRAB_BROKEN)
946 * @window: the window which received the event, i.e. the window
947 * that previously owned the grab
948 * @send_event: %TRUE if the event was sent explicitly (e.g. using
949 * <function>XSendEvent</function>).
950 * @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
952 * @implicit: %TRUE if the broken grab was implicit
953 * @grab_window: If this event is caused by another grab in the same
954 * application, @grab_window contains the new grab window. Otherwise
955 * @grab_window is %NULL.
957 * Generated when a pointer or keyboard grab is broken. On X11, this happens
958 * when the grab window becomes unviewable (i.e. it or one of its ancestors
959 * is unmapped), or if the same application grabs the pointer or keyboard
960 * again. Note that implicit grabs (which are initiated by button presses)
961 * can also cause #GdkEventGrabBroken events.
965 struct _GdkEventGrabBroken {
971 GdkWindow *grab_window;
976 * @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
977 * %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
978 * %GDK_DROP_FINISHED).
979 * @window: the window which received the event.
980 * @send_event: %TRUE if the event was sent explicitly (e.g. using
981 * <function>XSendEvent</function>).
982 * @context: the #GdkDragContext for the current DND operation.
983 * @time: the time of the event in milliseconds.
984 * @x_root: the x coordinate of the pointer relative to the root of the
985 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
986 * @y_root: the y coordinate of the pointer relative to the root of the
987 * screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
989 * Generated during DND operations.
991 struct _GdkEventDND {
995 GdkDragContext *context;
998 gshort x_root, y_root;
1004 * The #GdkEvent struct contains a union of all of the event structs,
1005 * and allows access to the data fields in a number of ways.
1007 * The event type is always the first field in all of the event structs, and
1008 * can always be accessed with the following code, no matter what type of
1013 * GdkEventType type;
1015 * type = event->type;
1017 * </informalexample>
1019 * To access other fields of the event structs, the pointer to the event
1020 * can be cast to the appropriate event struct pointer, or the union member
1021 * name can be used. For example if the event type is %GDK_BUTTON_PRESS
1022 * then the x coordinate of the button press can be accessed with:
1028 * x = ((GdkEventButton*)event)->x;
1030 * </informalexample>
1037 * x = event->button.x;
1039 * </informalexample>
1045 GdkEventExpose expose;
1046 GdkEventVisibility visibility;
1047 GdkEventMotion motion;
1048 GdkEventButton button;
1049 GdkEventScroll scroll;
1051 GdkEventCrossing crossing;
1052 GdkEventFocus focus_change;
1053 GdkEventConfigure configure;
1054 GdkEventProperty property;
1055 GdkEventSelection selection;
1056 GdkEventOwnerChange owner_change;
1057 GdkEventProximity proximity;
1058 GdkEventClient client;
1060 GdkEventWindowState window_state;
1061 GdkEventSetting setting;
1062 GdkEventGrabBroken grab_broken;
1065 GType gdk_event_get_type (void) G_GNUC_CONST;
1067 gboolean gdk_events_pending (void);
1068 GdkEvent* gdk_event_get (void);
1070 GdkEvent* gdk_event_peek (void);
1071 void gdk_event_put (const GdkEvent *event);
1073 GdkEvent* gdk_event_new (GdkEventType type);
1074 GdkEvent* gdk_event_copy (const GdkEvent *event);
1075 void gdk_event_free (GdkEvent *event);
1077 guint32 gdk_event_get_time (const GdkEvent *event);
1078 gboolean gdk_event_get_state (const GdkEvent *event,
1079 GdkModifierType *state);
1080 gboolean gdk_event_get_coords (const GdkEvent *event,
1083 gboolean gdk_event_get_root_coords (const GdkEvent *event,
1086 gboolean gdk_event_get_axis (const GdkEvent *event,
1087 GdkAxisUse axis_use,
1089 void gdk_event_set_device (GdkEvent *event,
1091 GdkDevice* gdk_event_get_device (const GdkEvent *event);
1092 void gdk_event_request_motions (const GdkEventMotion *event);
1094 gboolean gdk_events_get_distance (GdkEvent *event1,
1097 gboolean gdk_events_get_angle (GdkEvent *event1,
1100 gboolean gdk_events_get_center (GdkEvent *event1,
1105 void gdk_event_handler_set (GdkEventFunc func,
1107 GDestroyNotify notify);
1109 void gdk_event_set_screen (GdkEvent *event,
1111 GdkScreen *gdk_event_get_screen (const GdkEvent *event);
1113 void gdk_set_show_events (gboolean show_events);
1114 gboolean gdk_get_show_events (void);
1116 #ifndef GDK_MULTIHEAD_SAFE
1118 gboolean gdk_setting_get (const gchar *name,
1120 void gdk_add_client_message_filter (GdkAtom message_type,
1123 gboolean gdk_event_send_client_message (GdkEvent *event,
1124 GdkNativeWindow winid);
1125 void gdk_event_send_clientmessage_toall (GdkEvent *event);
1127 #endif /* GDK_MULTIHEAD_SAFE */
1129 gboolean gdk_event_send_client_message_for_display (GdkDisplay *display,
1131 GdkNativeWindow winid);
1135 #endif /* __GDK_EVENTS_H__ */