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 window system specific
42 * even type, XEvent on X11, MSG on Win32.
46 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
47 GDK_FILTER_TRANSLATE, /* Translated event stored */
48 GDK_FILTER_REMOVE /* Terminate processing, removing event */
51 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
57 * Nothing: No event occurred.
58 * Delete: A window delete event was sent by the window manager.
59 * The specified window should be deleted.
60 * Destroy: A window has been destroyed.
61 * Expose: Part of a window has been uncovered.
62 * NoExpose: Same as expose, but no expose event was generated.
63 * VisibilityNotify: A window has become fully/partially/not obscured.
64 * MotionNotify: The mouse has moved.
65 * ButtonPress: A mouse button was pressed.
66 * ButtonRelease: A mouse button was release.
67 * KeyPress: A key was pressed.
68 * KeyRelease: A key was released.
69 * EnterNotify: A window was entered.
70 * LeaveNotify: A window was exited.
71 * FocusChange: The focus window has changed. (The focus window gets
73 * Resize: A window has been resized.
74 * Map: A window has been mapped. (It is now visible on the screen).
75 * Unmap: A window has been unmapped. (It is no longer visible on
77 * Scroll: A mouse wheel was scrolled either up or down.
85 GDK_MOTION_NOTIFY = 3,
87 GDK_2BUTTON_PRESS = 5,
88 GDK_3BUTTON_PRESS = 6,
89 GDK_BUTTON_RELEASE = 7,
92 GDK_ENTER_NOTIFY = 10,
93 GDK_LEAVE_NOTIFY = 11,
94 GDK_FOCUS_CHANGE = 12,
98 GDK_PROPERTY_NOTIFY = 16,
99 GDK_SELECTION_CLEAR = 17,
100 GDK_SELECTION_REQUEST = 18,
101 GDK_SELECTION_NOTIFY = 19,
102 GDK_PROXIMITY_IN = 20,
103 GDK_PROXIMITY_OUT = 21,
106 GDK_DRAG_MOTION = 24,
107 GDK_DRAG_STATUS = 25,
109 GDK_DROP_FINISHED = 27,
110 GDK_CLIENT_EVENT = 28,
111 GDK_VISIBILITY_NOTIFY = 29,
116 /* Event masks. (Used to select what types of events a window
121 GDK_EXPOSURE_MASK = 1 << 1,
122 GDK_POINTER_MOTION_MASK = 1 << 2,
123 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
124 GDK_BUTTON_MOTION_MASK = 1 << 4,
125 GDK_BUTTON1_MOTION_MASK = 1 << 5,
126 GDK_BUTTON2_MOTION_MASK = 1 << 6,
127 GDK_BUTTON3_MOTION_MASK = 1 << 7,
128 GDK_BUTTON_PRESS_MASK = 1 << 8,
129 GDK_BUTTON_RELEASE_MASK = 1 << 9,
130 GDK_KEY_PRESS_MASK = 1 << 10,
131 GDK_KEY_RELEASE_MASK = 1 << 11,
132 GDK_ENTER_NOTIFY_MASK = 1 << 12,
133 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
134 GDK_FOCUS_CHANGE_MASK = 1 << 14,
135 GDK_STRUCTURE_MASK = 1 << 15,
136 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
137 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
138 GDK_PROXIMITY_IN_MASK = 1 << 18,
139 GDK_PROXIMITY_OUT_MASK = 1 << 19,
140 GDK_SUBSTRUCTURE_MASK = 1 << 20,
141 GDK_SCROLL_MASK = 1 << 21,
142 GDK_ALL_EVENTS_MASK = 0x3FFFFE
147 GDK_VISIBILITY_UNOBSCURED,
148 GDK_VISIBILITY_PARTIAL,
149 GDK_VISIBILITY_FULLY_OBSCURED
150 } GdkVisibilityState;
158 } GdkScrollDirection;
160 /* Types of enter/leave notifications.
166 * Unknown: An unknown type of enter/leave event occurred.
170 GDK_NOTIFY_ANCESTOR = 0,
171 GDK_NOTIFY_VIRTUAL = 1,
172 GDK_NOTIFY_INFERIOR = 2,
173 GDK_NOTIFY_NONLINEAR = 3,
174 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
175 GDK_NOTIFY_UNKNOWN = 5
178 /* Enter/leave event modes.
192 GDK_PROPERTY_NEW_VALUE,
203 struct _GdkEventExpose
209 gint count; /* If non-zero, how many more events follow. */
212 struct _GdkEventNoExpose
217 /* XXX: does anyone need the X major_code or minor_code fields? */
220 struct _GdkEventVisibility
225 GdkVisibilityState state;
228 struct _GdkEventMotion
240 gdouble x_root, y_root;
243 struct _GdkEventButton
255 gdouble x_root, y_root;
258 struct _GdkEventScroll
267 GdkScrollDirection direction;
269 gdouble x_root, y_root;
284 struct _GdkEventCrossing
289 GdkWindow *subwindow;
295 GdkCrossingMode mode;
296 GdkNotifyType detail;
301 struct _GdkEventFocus
309 struct _GdkEventConfigure
319 struct _GdkEventProperty
329 struct _GdkEventSelection
338 GdkNativeWindow requestor;
341 /* This event type will be used pretty rarely. It only is important
342 for XInput aware programs that are drawing their own cursor */
344 struct _GdkEventProximity
353 struct _GdkEventClient
358 GdkAtom message_type;
367 /* Event types for DND */
369 struct _GdkEventDND {
373 GdkDragContext *context;
376 gshort x_root, y_root;
383 GdkEventExpose expose;
384 GdkEventNoExpose no_expose;
385 GdkEventVisibility visibility;
386 GdkEventMotion motion;
387 GdkEventButton button;
388 GdkEventScroll scroll;
390 GdkEventCrossing crossing;
391 GdkEventFocus focus_change;
392 GdkEventConfigure configure;
393 GdkEventProperty property;
394 GdkEventSelection selection;
395 GdkEventProximity proximity;
396 GdkEventClient client;
400 gboolean gdk_events_pending (void);
401 GdkEvent* gdk_event_get (void);
403 GdkEvent* gdk_event_peek (void);
404 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
405 void gdk_event_put (GdkEvent *event);
407 GdkEvent* gdk_event_copy (GdkEvent *event);
408 void gdk_event_free (GdkEvent *event);
409 guint32 gdk_event_get_time (GdkEvent *event);
410 gboolean gdk_event_get_axis (GdkEvent *event,
414 void gdk_event_handler_set (GdkEventFunc func,
416 GDestroyNotify notify);
418 void gdk_set_show_events (gboolean show_events);
419 gboolean gdk_get_show_events (void);
422 * The following function adds a global filter for all client
423 * messages of type message_type
425 void gdk_add_client_message_filter (GdkAtom message_type,
432 #endif /* __cplusplus */
434 #endif /* __GDK_EVENTS_H__ */