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)
14 typedef struct _GdkEventAny GdkEventAny;
15 typedef struct _GdkEventExpose GdkEventExpose;
16 typedef struct _GdkEventNoExpose GdkEventNoExpose;
17 typedef struct _GdkEventVisibility GdkEventVisibility;
18 typedef struct _GdkEventMotion GdkEventMotion;
19 typedef struct _GdkEventButton GdkEventButton;
20 typedef struct _GdkEventKey GdkEventKey;
21 typedef struct _GdkEventFocus GdkEventFocus;
22 typedef struct _GdkEventCrossing GdkEventCrossing;
23 typedef struct _GdkEventConfigure GdkEventConfigure;
24 typedef struct _GdkEventProperty GdkEventProperty;
25 typedef struct _GdkEventSelection GdkEventSelection;
26 typedef struct _GdkEventProximity GdkEventProximity;
27 typedef struct _GdkEventClient GdkEventClient;
29 typedef struct _GdkEventDND GdkEventDND;
31 typedef union _GdkEvent GdkEvent;
33 typedef void (*GdkEventFunc) (GdkEvent *event,
38 typedef void GdkXEvent; /* Can be cast to XEvent */
41 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
42 GDK_FILTER_TRANSLATE, /* Translated event stored */
43 GDK_FILTER_REMOVE /* Terminate processing, removing event */
46 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
52 * Nothing: No event occurred.
53 * Delete: A window delete event was sent by the window manager.
54 * The specified window should be deleted.
55 * Destroy: A window has been destroyed.
56 * Expose: Part of a window has been uncovered.
57 * NoExpose: Same as expose, but no expose event was generated.
58 * VisibilityNotify: A window has become fully/partially/not obscured.
59 * MotionNotify: The mouse has moved.
60 * ButtonPress: A mouse button was pressed.
61 * ButtonRelease: A mouse button was release.
62 * KeyPress: A key was pressed.
63 * KeyRelease: A key was released.
64 * EnterNotify: A window was entered.
65 * LeaveNotify: A window was exited.
66 * FocusChange: The focus window has changed. (The focus window gets
68 * Resize: A window has been resized.
69 * Map: A window has been mapped. (It is now visible on the screen).
70 * Unmap: A window has been unmapped. (It is no longer visible on
79 GDK_MOTION_NOTIFY = 3,
81 GDK_2BUTTON_PRESS = 5,
82 GDK_3BUTTON_PRESS = 6,
83 GDK_BUTTON_RELEASE = 7,
86 GDK_ENTER_NOTIFY = 10,
87 GDK_LEAVE_NOTIFY = 11,
88 GDK_FOCUS_CHANGE = 12,
92 GDK_PROPERTY_NOTIFY = 16,
93 GDK_SELECTION_CLEAR = 17,
94 GDK_SELECTION_REQUEST = 18,
95 GDK_SELECTION_NOTIFY = 19,
96 GDK_PROXIMITY_IN = 20,
97 GDK_PROXIMITY_OUT = 21,
100 GDK_DRAG_MOTION = 24,
101 GDK_DRAG_STATUS = 25,
103 GDK_DROP_FINISHED = 27,
104 GDK_CLIENT_EVENT = 28,
105 GDK_VISIBILITY_NOTIFY = 29,
109 /* Event masks. (Used to select what types of events a window
114 GDK_EXPOSURE_MASK = 1 << 1,
115 GDK_POINTER_MOTION_MASK = 1 << 2,
116 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
117 GDK_BUTTON_MOTION_MASK = 1 << 4,
118 GDK_BUTTON1_MOTION_MASK = 1 << 5,
119 GDK_BUTTON2_MOTION_MASK = 1 << 6,
120 GDK_BUTTON3_MOTION_MASK = 1 << 7,
121 GDK_BUTTON_PRESS_MASK = 1 << 8,
122 GDK_BUTTON_RELEASE_MASK = 1 << 9,
123 GDK_KEY_PRESS_MASK = 1 << 10,
124 GDK_KEY_RELEASE_MASK = 1 << 11,
125 GDK_ENTER_NOTIFY_MASK = 1 << 12,
126 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
127 GDK_FOCUS_CHANGE_MASK = 1 << 14,
128 GDK_STRUCTURE_MASK = 1 << 15,
129 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
130 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
131 GDK_PROXIMITY_IN_MASK = 1 << 18,
132 GDK_PROXIMITY_OUT_MASK = 1 << 19,
133 GDK_SUBSTRUCTURE_MASK = 1 << 20,
134 GDK_ALL_EVENTS_MASK = 0x0FFFFF
138 GDK_VISIBILITY_UNOBSCURED,
139 GDK_VISIBILITY_PARTIAL,
140 GDK_VISIBILITY_FULLY_OBSCURED
141 } GdkVisibilityState;
143 /* Types of enter/leave notifications.
149 * Unknown: An unknown type of enter/leave event occurred.
153 GDK_NOTIFY_ANCESTOR = 0,
154 GDK_NOTIFY_VIRTUAL = 1,
155 GDK_NOTIFY_INFERIOR = 2,
156 GDK_NOTIFY_NONLINEAR = 3,
157 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
158 GDK_NOTIFY_UNKNOWN = 5
161 /* Enter/leave event modes.
175 GDK_PROPERTY_NEW_VALUE,
186 struct _GdkEventExpose
192 gint count; /* If non-zero, how many more events follow. */
195 struct _GdkEventNoExpose
200 /* XXX: does anyone need the X major_code or minor_code fields? */
203 struct _GdkEventVisibility
208 GdkVisibilityState state;
211 struct _GdkEventMotion
224 GdkInputSource source;
226 gdouble x_root, y_root;
229 struct _GdkEventButton
242 GdkInputSource source;
244 gdouble x_root, y_root;
259 struct _GdkEventCrossing
264 GdkWindow *subwindow;
270 GdkCrossingMode mode;
271 GdkNotifyType detail;
276 struct _GdkEventFocus
284 struct _GdkEventConfigure
294 struct _GdkEventProperty
304 struct _GdkEventSelection
316 /* This event type will be used pretty rarely. It only is important
317 for XInput aware programs that are drawing their own cursor */
319 struct _GdkEventProximity
325 GdkInputSource source;
329 struct _GdkEventClient
334 GdkAtom message_type;
343 /* Event types for DND */
345 struct _GdkEventDND {
349 GdkDragContext *context;
352 gshort x_root, y_root;
359 GdkEventExpose expose;
360 GdkEventNoExpose no_expose;
361 GdkEventVisibility visibility;
362 GdkEventMotion motion;
363 GdkEventButton button;
365 GdkEventCrossing crossing;
366 GdkEventFocus focus_change;
367 GdkEventConfigure configure;
368 GdkEventProperty property;
369 GdkEventSelection selection;
370 GdkEventProximity proximity;
371 GdkEventClient client;
375 gboolean gdk_events_pending (void);
376 GdkEvent* gdk_event_get (void);
378 GdkEvent* gdk_event_peek (void);
379 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
380 void gdk_event_put (GdkEvent *event);
382 GdkEvent* gdk_event_copy (GdkEvent *event);
383 void gdk_event_free (GdkEvent *event);
384 guint32 gdk_event_get_time (GdkEvent *event);
386 void gdk_event_handler_set (GdkEventFunc func,
388 GDestroyNotify notify);
390 void gdk_set_show_events (gint show_events);
391 gint gdk_get_show_events (void);
394 * The following function adds a global filter for all client
395 * messages of type message_type
397 void gdk_add_client_message_filter (GdkAtom message_type,
404 #endif /* __cplusplus */
406 #endif /* __GDK_EVENTS_H__ */