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>
41 #define GDK_TYPE_EVENT (gdk_event_get_type ())
43 #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
44 #define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
47 typedef struct _GdkEventAny GdkEventAny;
48 typedef struct _GdkEventExpose GdkEventExpose;
49 typedef struct _GdkEventNoExpose GdkEventNoExpose;
50 typedef struct _GdkEventVisibility GdkEventVisibility;
51 typedef struct _GdkEventMotion GdkEventMotion;
52 typedef struct _GdkEventButton GdkEventButton;
53 typedef struct _GdkEventScroll GdkEventScroll;
54 typedef struct _GdkEventKey GdkEventKey;
55 typedef struct _GdkEventFocus GdkEventFocus;
56 typedef struct _GdkEventCrossing GdkEventCrossing;
57 typedef struct _GdkEventConfigure GdkEventConfigure;
58 typedef struct _GdkEventProperty GdkEventProperty;
59 typedef struct _GdkEventSelection GdkEventSelection;
60 typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
61 typedef struct _GdkEventProximity GdkEventProximity;
62 typedef struct _GdkEventClient GdkEventClient;
63 typedef struct _GdkEventDND GdkEventDND;
64 typedef struct _GdkEventWindowState GdkEventWindowState;
65 typedef struct _GdkEventSetting GdkEventSetting;
66 typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
68 typedef union _GdkEvent GdkEvent;
70 typedef void (*GdkEventFunc) (GdkEvent *event,
78 * Used to represent native events (<type>XEvent</type>s for the X11
79 * backend, <type>MSG</type>s for Win32).
81 typedef void GdkXEvent; /* Can be cast to window system specific
82 * even type, XEvent on X11, MSG on Win32.
87 * @GDK_FILTER_CONTINUE: event not handled, continue processing.
88 * @GDK_FILTER_TRANSLATE: native event translated into a GDK event and stored
89 * in the <literal>event</literal> structure that was passed in.
90 * @GDK_FILTER_REMOVE: event handled, terminate processing.
92 * Specifies the result of applying a #GdkFilterFunc to a native event.
95 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
96 GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
97 stored in the "event" structure that was
99 GDK_FILTER_REMOVE /* Terminate processing, removing event */
104 * @xevent: the native event to filter.
105 * @event: the GDK event to which the X event will be translated.
106 * @data: user data set when the filter was installed.
108 * Specifies the type of function used to filter native events before they are
109 * converted to GDK events.
111 * When a filter is called, @event is unpopulated, except for
112 * <literal>event->window</literal>. The filter may translate the native
113 * event to a GDK event and store the result in @event, or handle it without
114 * translation. If the filter translates the event and processing should
115 * continue, it should return %GDK_FILTER_TRANSLATE.
117 * Returns: a #GdkFilterReturn value.
119 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
125 * Nothing: No event occurred.
126 * Delete: A window delete event was sent by the window manager.
127 * The specified window should be deleted.
128 * Destroy: A window has been destroyed.
129 * Expose: Part of a window has been uncovered.
130 * NoExpose: Same as expose, but no expose event was generated.
131 * VisibilityNotify: A window has become fully/partially/not obscured.
132 * MotionNotify: The mouse has moved.
133 * ButtonPress: A mouse button was pressed.
134 * ButtonRelease: A mouse button was release.
135 * KeyPress: A key was pressed.
136 * KeyRelease: A key was released.
137 * EnterNotify: A window was entered.
138 * LeaveNotify: A window was exited.
139 * FocusChange: The focus window has changed. (The focus window gets
141 * Resize: A window has been resized.
142 * Map: A window has been mapped. (It is now visible on the screen).
143 * Unmap: A window has been unmapped. (It is no longer visible on
145 * Scroll: A mouse wheel was scrolled either up or down.
153 GDK_MOTION_NOTIFY = 3,
154 GDK_BUTTON_PRESS = 4,
155 GDK_2BUTTON_PRESS = 5,
156 GDK_3BUTTON_PRESS = 6,
157 GDK_BUTTON_RELEASE = 7,
160 GDK_ENTER_NOTIFY = 10,
161 GDK_LEAVE_NOTIFY = 11,
162 GDK_FOCUS_CHANGE = 12,
166 GDK_PROPERTY_NOTIFY = 16,
167 GDK_SELECTION_CLEAR = 17,
168 GDK_SELECTION_REQUEST = 18,
169 GDK_SELECTION_NOTIFY = 19,
170 GDK_PROXIMITY_IN = 20,
171 GDK_PROXIMITY_OUT = 21,
174 GDK_DRAG_MOTION = 24,
175 GDK_DRAG_STATUS = 25,
177 GDK_DROP_FINISHED = 27,
178 GDK_CLIENT_EVENT = 28,
179 GDK_VISIBILITY_NOTIFY = 29,
182 GDK_WINDOW_STATE = 32,
184 GDK_OWNER_CHANGE = 34,
185 GDK_GRAB_BROKEN = 35,
187 GDK_EVENT_LAST /* helper variable for decls */
192 GDK_VISIBILITY_UNOBSCURED,
193 GDK_VISIBILITY_PARTIAL,
194 GDK_VISIBILITY_FULLY_OBSCURED
195 } GdkVisibilityState;
203 } GdkScrollDirection;
205 /* Types of enter/leave notifications.
211 * Unknown: An unknown type of enter/leave event occurred.
215 GDK_NOTIFY_ANCESTOR = 0,
216 GDK_NOTIFY_VIRTUAL = 1,
217 GDK_NOTIFY_INFERIOR = 2,
218 GDK_NOTIFY_NONLINEAR = 3,
219 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
220 GDK_NOTIFY_UNKNOWN = 5
223 /* Enter/leave event modes.
233 GDK_CROSSING_GTK_GRAB,
234 GDK_CROSSING_GTK_UNGRAB,
235 GDK_CROSSING_STATE_CHANGED
240 GDK_PROPERTY_NEW_VALUE,
246 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
247 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
248 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
249 GDK_WINDOW_STATE_STICKY = 1 << 3,
250 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
251 GDK_WINDOW_STATE_ABOVE = 1 << 5,
252 GDK_WINDOW_STATE_BELOW = 1 << 6
257 GDK_SETTING_ACTION_NEW,
258 GDK_SETTING_ACTION_CHANGED,
259 GDK_SETTING_ACTION_DELETED
264 GDK_OWNER_CHANGE_NEW_OWNER,
265 GDK_OWNER_CHANGE_DESTROY,
266 GDK_OWNER_CHANGE_CLOSE
276 struct _GdkEventExpose
282 cairo_region_t *region;
283 gint count; /* If non-zero, how many more events follow. */
286 struct _GdkEventNoExpose
293 struct _GdkEventVisibility
298 GdkVisibilityState state;
301 struct _GdkEventMotion
313 gdouble x_root, y_root;
316 struct _GdkEventButton
328 gdouble x_root, y_root;
331 struct _GdkEventScroll
340 GdkScrollDirection direction;
342 gdouble x_root, y_root;
355 guint16 hardware_keycode;
357 guint is_modifier : 1;
360 struct _GdkEventCrossing
365 GdkWindow *subwindow;
371 GdkCrossingMode mode;
372 GdkNotifyType detail;
377 struct _GdkEventFocus
385 struct _GdkEventConfigure
395 struct _GdkEventProperty
405 struct _GdkEventSelection
414 GdkNativeWindow requestor;
417 struct _GdkEventOwnerChange
422 GdkNativeWindow owner;
423 GdkOwnerChange reason;
426 guint32 selection_time;
429 /* This event type will be used pretty rarely. It only is important
430 for XInput aware programs that are drawing their own cursor */
432 struct _GdkEventProximity
441 struct _GdkEventClient
446 GdkAtom message_type;
455 struct _GdkEventSetting
460 GdkSettingAction action;
464 struct _GdkEventWindowState
469 GdkWindowState changed_mask;
470 GdkWindowState new_window_state;
473 struct _GdkEventGrabBroken {
479 GdkWindow *grab_window;
482 /* Event types for DND */
484 struct _GdkEventDND {
488 GdkDragContext *context;
491 gshort x_root, y_root;
498 GdkEventExpose expose;
499 GdkEventNoExpose no_expose;
500 GdkEventVisibility visibility;
501 GdkEventMotion motion;
502 GdkEventButton button;
503 GdkEventScroll scroll;
505 GdkEventCrossing crossing;
506 GdkEventFocus focus_change;
507 GdkEventConfigure configure;
508 GdkEventProperty property;
509 GdkEventSelection selection;
510 GdkEventOwnerChange owner_change;
511 GdkEventProximity proximity;
512 GdkEventClient client;
514 GdkEventWindowState window_state;
515 GdkEventSetting setting;
516 GdkEventGrabBroken grab_broken;
519 GType gdk_event_get_type (void) G_GNUC_CONST;
521 gboolean gdk_events_pending (void);
522 GdkEvent* gdk_event_get (void);
524 GdkEvent* gdk_event_peek (void);
525 void gdk_event_put (const GdkEvent *event);
527 GdkEvent* gdk_event_new (GdkEventType type);
528 GdkEvent* gdk_event_copy (const GdkEvent *event);
529 void gdk_event_free (GdkEvent *event);
531 guint32 gdk_event_get_time (const GdkEvent *event);
532 gboolean gdk_event_get_state (const GdkEvent *event,
533 GdkModifierType *state);
534 gboolean gdk_event_get_coords (const GdkEvent *event,
537 gboolean gdk_event_get_root_coords (const GdkEvent *event,
540 gboolean gdk_event_get_axis (const GdkEvent *event,
543 void gdk_event_set_device (GdkEvent *event,
545 GdkDevice* gdk_event_get_device (const GdkEvent *event);
546 void gdk_event_request_motions (const GdkEventMotion *event);
548 gboolean gdk_events_get_distance (GdkEvent *event1,
551 gboolean gdk_events_get_angle (GdkEvent *event1,
554 gboolean gdk_events_get_center (GdkEvent *event1,
559 void gdk_event_handler_set (GdkEventFunc func,
561 GDestroyNotify notify);
563 void gdk_event_set_screen (GdkEvent *event,
565 GdkScreen *gdk_event_get_screen (const GdkEvent *event);
567 void gdk_set_show_events (gboolean show_events);
568 gboolean gdk_get_show_events (void);
570 #ifndef GDK_MULTIHEAD_SAFE
571 void gdk_add_client_message_filter (GdkAtom message_type,
575 gboolean gdk_setting_get (const gchar *name,
577 #endif /* GDK_MULTIHEAD_SAFE */
581 #endif /* __GDK_EVENTS_H__ */