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 _GdkEventScroll GdkEventScroll;
21 typedef struct _GdkEventKey GdkEventKey;
22 typedef struct _GdkEventFocus GdkEventFocus;
23 typedef struct _GdkEventCrossing GdkEventCrossing;
24 typedef struct _GdkEventConfigure GdkEventConfigure;
25 typedef struct _GdkEventProperty GdkEventProperty;
26 typedef struct _GdkEventSelection GdkEventSelection;
27 typedef struct _GdkEventProximity GdkEventProximity;
28 typedef struct _GdkEventClient GdkEventClient;
30 typedef struct _GdkEventDND GdkEventDND;
32 typedef union _GdkEvent GdkEvent;
34 typedef void (*GdkEventFunc) (GdkEvent *event,
39 typedef void GdkXEvent; /* Can be cast to XEvent */
42 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
43 GDK_FILTER_TRANSLATE, /* Translated event stored */
44 GDK_FILTER_REMOVE /* Terminate processing, removing event */
47 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
53 * Nothing: No event occurred.
54 * Delete: A window delete event was sent by the window manager.
55 * The specified window should be deleted.
56 * Destroy: A window has been destroyed.
57 * Expose: Part of a window has been uncovered.
58 * NoExpose: Same as expose, but no expose event was generated.
59 * VisibilityNotify: A window has become fully/partially/not obscured.
60 * MotionNotify: The mouse has moved.
61 * ButtonPress: A mouse button was pressed.
62 * ButtonRelease: A mouse button was release.
63 * KeyPress: A key was pressed.
64 * KeyRelease: A key was released.
65 * EnterNotify: A window was entered.
66 * LeaveNotify: A window was exited.
67 * FocusChange: The focus window has changed. (The focus window gets
69 * Resize: A window has been resized.
70 * Map: A window has been mapped. (It is now visible on the screen).
71 * Unmap: A window has been unmapped. (It is no longer visible on
73 * Scroll: A mouse wheel was scrolled either up or down.
81 GDK_MOTION_NOTIFY = 3,
83 GDK_2BUTTON_PRESS = 5,
84 GDK_3BUTTON_PRESS = 6,
85 GDK_BUTTON_RELEASE = 7,
88 GDK_ENTER_NOTIFY = 10,
89 GDK_LEAVE_NOTIFY = 11,
90 GDK_FOCUS_CHANGE = 12,
94 GDK_PROPERTY_NOTIFY = 16,
95 GDK_SELECTION_CLEAR = 17,
96 GDK_SELECTION_REQUEST = 18,
97 GDK_SELECTION_NOTIFY = 19,
98 GDK_PROXIMITY_IN = 20,
99 GDK_PROXIMITY_OUT = 21,
102 GDK_DRAG_MOTION = 24,
103 GDK_DRAG_STATUS = 25,
105 GDK_DROP_FINISHED = 27,
106 GDK_CLIENT_EVENT = 28,
107 GDK_VISIBILITY_NOTIFY = 29,
112 /* Event masks. (Used to select what types of events a window
117 GDK_EXPOSURE_MASK = 1 << 1,
118 GDK_POINTER_MOTION_MASK = 1 << 2,
119 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
120 GDK_BUTTON_MOTION_MASK = 1 << 4,
121 GDK_BUTTON1_MOTION_MASK = 1 << 5,
122 GDK_BUTTON2_MOTION_MASK = 1 << 6,
123 GDK_BUTTON3_MOTION_MASK = 1 << 7,
124 GDK_BUTTON_PRESS_MASK = 1 << 8,
125 GDK_BUTTON_RELEASE_MASK = 1 << 9,
126 GDK_KEY_PRESS_MASK = 1 << 10,
127 GDK_KEY_RELEASE_MASK = 1 << 11,
128 GDK_ENTER_NOTIFY_MASK = 1 << 12,
129 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
130 GDK_FOCUS_CHANGE_MASK = 1 << 14,
131 GDK_STRUCTURE_MASK = 1 << 15,
132 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
133 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
134 GDK_PROXIMITY_IN_MASK = 1 << 18,
135 GDK_PROXIMITY_OUT_MASK = 1 << 19,
136 GDK_SUBSTRUCTURE_MASK = 1 << 20,
137 GDK_SCROLL_MASK = 1 << 21,
138 GDK_ALL_EVENTS_MASK = 0x3FFFFE
143 GDK_VISIBILITY_UNOBSCURED,
144 GDK_VISIBILITY_PARTIAL,
145 GDK_VISIBILITY_FULLY_OBSCURED
146 } GdkVisibilityState;
154 } GdkScrollDirection;
156 /* Types of enter/leave notifications.
162 * Unknown: An unknown type of enter/leave event occurred.
166 GDK_NOTIFY_ANCESTOR = 0,
167 GDK_NOTIFY_VIRTUAL = 1,
168 GDK_NOTIFY_INFERIOR = 2,
169 GDK_NOTIFY_NONLINEAR = 3,
170 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
171 GDK_NOTIFY_UNKNOWN = 5
174 /* Enter/leave event modes.
188 GDK_PROPERTY_NEW_VALUE,
199 struct _GdkEventExpose
205 gint count; /* If non-zero, how many more events follow. */
208 struct _GdkEventNoExpose
213 /* XXX: does anyone need the X major_code or minor_code fields? */
216 struct _GdkEventVisibility
221 GdkVisibilityState state;
224 struct _GdkEventMotion
237 GdkInputSource source;
239 gdouble x_root, y_root;
242 struct _GdkEventButton
255 GdkInputSource source;
257 gdouble x_root, y_root;
260 struct _GdkEventScroll
272 GdkScrollDirection direction;
273 GdkInputSource source;
275 gdouble x_root, y_root;
290 struct _GdkEventCrossing
295 GdkWindow *subwindow;
301 GdkCrossingMode mode;
302 GdkNotifyType detail;
307 struct _GdkEventFocus
315 struct _GdkEventConfigure
325 struct _GdkEventProperty
335 struct _GdkEventSelection
347 /* This event type will be used pretty rarely. It only is important
348 for XInput aware programs that are drawing their own cursor */
350 struct _GdkEventProximity
356 GdkInputSource source;
360 struct _GdkEventClient
365 GdkAtom message_type;
374 /* Event types for DND */
376 struct _GdkEventDND {
380 GdkDragContext *context;
383 gshort x_root, y_root;
390 GdkEventExpose expose;
391 GdkEventNoExpose no_expose;
392 GdkEventVisibility visibility;
393 GdkEventMotion motion;
394 GdkEventButton button;
395 GdkEventScroll scroll;
397 GdkEventCrossing crossing;
398 GdkEventFocus focus_change;
399 GdkEventConfigure configure;
400 GdkEventProperty property;
401 GdkEventSelection selection;
402 GdkEventProximity proximity;
403 GdkEventClient client;
407 gboolean gdk_events_pending (void);
408 GdkEvent* gdk_event_get (void);
410 GdkEvent* gdk_event_peek (void);
411 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
412 void gdk_event_put (GdkEvent *event);
414 GdkEvent* gdk_event_copy (GdkEvent *event);
415 void gdk_event_free (GdkEvent *event);
416 guint32 gdk_event_get_time (GdkEvent *event);
418 void gdk_event_handler_set (GdkEventFunc func,
420 GDestroyNotify notify);
422 void gdk_set_show_events (gboolean show_events);
423 gboolean gdk_get_show_events (void);
426 * The following function adds a global filter for all client
427 * messages of type message_type
429 void gdk_add_client_message_filter (GdkAtom message_type,
436 #endif /* __cplusplus */
438 #endif /* __GDK_EVENTS_H__ */