1 #ifndef __GDK_EVENTS_H__
2 #define __GDK_EVENTS_H__
4 #include <gdk/gdktypes.h>
5 #include <gdk/gdkdnd.h>
6 #include <gdk/gdkinput.h>
10 #endif /* __cplusplus */
12 #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
13 #define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
16 typedef struct _GdkEventAny GdkEventAny;
17 typedef struct _GdkEventExpose GdkEventExpose;
18 typedef struct _GdkEventNoExpose GdkEventNoExpose;
19 typedef struct _GdkEventVisibility GdkEventVisibility;
20 typedef struct _GdkEventMotion GdkEventMotion;
21 typedef struct _GdkEventButton GdkEventButton;
22 typedef struct _GdkEventScroll GdkEventScroll;
23 typedef struct _GdkEventKey GdkEventKey;
24 typedef struct _GdkEventFocus GdkEventFocus;
25 typedef struct _GdkEventCrossing GdkEventCrossing;
26 typedef struct _GdkEventConfigure GdkEventConfigure;
27 typedef struct _GdkEventProperty GdkEventProperty;
28 typedef struct _GdkEventSelection GdkEventSelection;
29 typedef struct _GdkEventProximity GdkEventProximity;
30 typedef struct _GdkEventClient GdkEventClient;
32 typedef struct _GdkEventDND GdkEventDND;
34 typedef union _GdkEvent GdkEvent;
36 typedef void (*GdkEventFunc) (GdkEvent *event,
41 typedef void GdkXEvent; /* Can be cast to XEvent */
44 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
45 GDK_FILTER_TRANSLATE, /* Translated event stored */
46 GDK_FILTER_REMOVE /* Terminate processing, removing event */
49 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
55 * Nothing: No event occurred.
56 * Delete: A window delete event was sent by the window manager.
57 * The specified window should be deleted.
58 * Destroy: A window has been destroyed.
59 * Expose: Part of a window has been uncovered.
60 * NoExpose: Same as expose, but no expose event was generated.
61 * VisibilityNotify: A window has become fully/partially/not obscured.
62 * MotionNotify: The mouse has moved.
63 * ButtonPress: A mouse button was pressed.
64 * ButtonRelease: A mouse button was release.
65 * KeyPress: A key was pressed.
66 * KeyRelease: A key was released.
67 * EnterNotify: A window was entered.
68 * LeaveNotify: A window was exited.
69 * FocusChange: The focus window has changed. (The focus window gets
71 * Resize: A window has been resized.
72 * Map: A window has been mapped. (It is now visible on the screen).
73 * Unmap: A window has been unmapped. (It is no longer visible on
75 * Scroll: A mouse wheel was scrolled either up or down.
83 GDK_MOTION_NOTIFY = 3,
85 GDK_2BUTTON_PRESS = 5,
86 GDK_3BUTTON_PRESS = 6,
87 GDK_BUTTON_RELEASE = 7,
90 GDK_ENTER_NOTIFY = 10,
91 GDK_LEAVE_NOTIFY = 11,
92 GDK_FOCUS_CHANGE = 12,
96 GDK_PROPERTY_NOTIFY = 16,
97 GDK_SELECTION_CLEAR = 17,
98 GDK_SELECTION_REQUEST = 18,
99 GDK_SELECTION_NOTIFY = 19,
100 GDK_PROXIMITY_IN = 20,
101 GDK_PROXIMITY_OUT = 21,
104 GDK_DRAG_MOTION = 24,
105 GDK_DRAG_STATUS = 25,
107 GDK_DROP_FINISHED = 27,
108 GDK_CLIENT_EVENT = 28,
109 GDK_VISIBILITY_NOTIFY = 29,
114 /* Event masks. (Used to select what types of events a window
119 GDK_EXPOSURE_MASK = 1 << 1,
120 GDK_POINTER_MOTION_MASK = 1 << 2,
121 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
122 GDK_BUTTON_MOTION_MASK = 1 << 4,
123 GDK_BUTTON1_MOTION_MASK = 1 << 5,
124 GDK_BUTTON2_MOTION_MASK = 1 << 6,
125 GDK_BUTTON3_MOTION_MASK = 1 << 7,
126 GDK_BUTTON_PRESS_MASK = 1 << 8,
127 GDK_BUTTON_RELEASE_MASK = 1 << 9,
128 GDK_KEY_PRESS_MASK = 1 << 10,
129 GDK_KEY_RELEASE_MASK = 1 << 11,
130 GDK_ENTER_NOTIFY_MASK = 1 << 12,
131 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
132 GDK_FOCUS_CHANGE_MASK = 1 << 14,
133 GDK_STRUCTURE_MASK = 1 << 15,
134 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
135 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
136 GDK_PROXIMITY_IN_MASK = 1 << 18,
137 GDK_PROXIMITY_OUT_MASK = 1 << 19,
138 GDK_SUBSTRUCTURE_MASK = 1 << 20,
139 GDK_SCROLL_MASK = 1 << 21,
140 GDK_ALL_EVENTS_MASK = 0x3FFFFE
145 GDK_VISIBILITY_UNOBSCURED,
146 GDK_VISIBILITY_PARTIAL,
147 GDK_VISIBILITY_FULLY_OBSCURED
148 } GdkVisibilityState;
156 } GdkScrollDirection;
158 /* Types of enter/leave notifications.
164 * Unknown: An unknown type of enter/leave event occurred.
168 GDK_NOTIFY_ANCESTOR = 0,
169 GDK_NOTIFY_VIRTUAL = 1,
170 GDK_NOTIFY_INFERIOR = 2,
171 GDK_NOTIFY_NONLINEAR = 3,
172 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
173 GDK_NOTIFY_UNKNOWN = 5
176 /* Enter/leave event modes.
190 GDK_PROPERTY_NEW_VALUE,
201 struct _GdkEventExpose
207 gint count; /* If non-zero, how many more events follow. */
210 struct _GdkEventNoExpose
215 /* XXX: does anyone need the X major_code or minor_code fields? */
218 struct _GdkEventVisibility
223 GdkVisibilityState state;
226 struct _GdkEventMotion
239 GdkInputSource source;
241 gdouble x_root, y_root;
244 struct _GdkEventButton
257 GdkInputSource source;
259 gdouble x_root, y_root;
262 struct _GdkEventScroll
274 GdkScrollDirection direction;
275 GdkInputSource source;
277 gdouble x_root, y_root;
292 struct _GdkEventCrossing
297 GdkWindow *subwindow;
303 GdkCrossingMode mode;
304 GdkNotifyType detail;
309 struct _GdkEventFocus
317 struct _GdkEventConfigure
327 struct _GdkEventProperty
337 struct _GdkEventSelection
349 /* This event type will be used pretty rarely. It only is important
350 for XInput aware programs that are drawing their own cursor */
352 struct _GdkEventProximity
358 GdkInputSource source;
362 struct _GdkEventClient
367 GdkAtom message_type;
376 /* Event types for DND */
378 struct _GdkEventDND {
382 GdkDragContext *context;
385 gshort x_root, y_root;
392 GdkEventExpose expose;
393 GdkEventNoExpose no_expose;
394 GdkEventVisibility visibility;
395 GdkEventMotion motion;
396 GdkEventButton button;
397 GdkEventScroll scroll;
399 GdkEventCrossing crossing;
400 GdkEventFocus focus_change;
401 GdkEventConfigure configure;
402 GdkEventProperty property;
403 GdkEventSelection selection;
404 GdkEventProximity proximity;
405 GdkEventClient client;
409 gboolean gdk_events_pending (void);
410 GdkEvent* gdk_event_get (void);
412 GdkEvent* gdk_event_peek (void);
413 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
414 void gdk_event_put (GdkEvent *event);
416 GdkEvent* gdk_event_copy (GdkEvent *event);
417 void gdk_event_free (GdkEvent *event);
418 guint32 gdk_event_get_time (GdkEvent *event);
420 void gdk_event_handler_set (GdkEventFunc func,
422 GDestroyNotify notify);
424 void gdk_set_show_events (gboolean show_events);
425 gboolean gdk_get_show_events (void);
428 * The following function adds a global filter for all client
429 * messages of type message_type
431 void gdk_add_client_message_filter (GdkAtom message_type,
438 #endif /* __cplusplus */
440 #endif /* __GDK_EVENTS_H__ */