1 #ifndef __GDK_EVENTS_H__
2 #define __GDK_EVENTS_H__
4 #include <gdk/gdkcolor.h>
5 #include <gdk/gdktypes.h>
6 #include <gdk/gdkdnd.h>
7 #include <gdk/gdkinput.h>
11 #endif /* __cplusplus */
13 #define GDK_TYPE_EVENT (gdk_event_get_type ())
15 #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
16 #define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
19 typedef struct _GdkEventAny GdkEventAny;
20 typedef struct _GdkEventExpose GdkEventExpose;
21 typedef struct _GdkEventNoExpose GdkEventNoExpose;
22 typedef struct _GdkEventVisibility GdkEventVisibility;
23 typedef struct _GdkEventMotion GdkEventMotion;
24 typedef struct _GdkEventButton GdkEventButton;
25 typedef struct _GdkEventScroll GdkEventScroll;
26 typedef struct _GdkEventKey GdkEventKey;
27 typedef struct _GdkEventFocus GdkEventFocus;
28 typedef struct _GdkEventCrossing GdkEventCrossing;
29 typedef struct _GdkEventConfigure GdkEventConfigure;
30 typedef struct _GdkEventProperty GdkEventProperty;
31 typedef struct _GdkEventSelection GdkEventSelection;
32 typedef struct _GdkEventProximity GdkEventProximity;
33 typedef struct _GdkEventClient GdkEventClient;
34 typedef struct _GdkEventDND GdkEventDND;
35 typedef struct _GdkEventWindowState GdkEventWindowState;
36 typedef struct _GdkEventSetting GdkEventSetting;
38 typedef union _GdkEvent GdkEvent;
40 typedef void (*GdkEventFunc) (GdkEvent *event,
45 typedef void GdkXEvent; /* Can be cast to window system specific
46 * even type, XEvent on X11, MSG on Win32.
50 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
51 GDK_FILTER_TRANSLATE, /* Translated event stored */
52 GDK_FILTER_REMOVE /* Terminate processing, removing event */
55 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
61 * Nothing: No event occurred.
62 * Delete: A window delete event was sent by the window manager.
63 * The specified window should be deleted.
64 * Destroy: A window has been destroyed.
65 * Expose: Part of a window has been uncovered.
66 * NoExpose: Same as expose, but no expose event was generated.
67 * VisibilityNotify: A window has become fully/partially/not obscured.
68 * MotionNotify: The mouse has moved.
69 * ButtonPress: A mouse button was pressed.
70 * ButtonRelease: A mouse button was release.
71 * KeyPress: A key was pressed.
72 * KeyRelease: A key was released.
73 * EnterNotify: A window was entered.
74 * LeaveNotify: A window was exited.
75 * FocusChange: The focus window has changed. (The focus window gets
77 * Resize: A window has been resized.
78 * Map: A window has been mapped. (It is now visible on the screen).
79 * Unmap: A window has been unmapped. (It is no longer visible on
81 * Scroll: A mouse wheel was scrolled either up or down.
89 GDK_MOTION_NOTIFY = 3,
91 GDK_2BUTTON_PRESS = 5,
92 GDK_3BUTTON_PRESS = 6,
93 GDK_BUTTON_RELEASE = 7,
96 GDK_ENTER_NOTIFY = 10,
97 GDK_LEAVE_NOTIFY = 11,
98 GDK_FOCUS_CHANGE = 12,
102 GDK_PROPERTY_NOTIFY = 16,
103 GDK_SELECTION_CLEAR = 17,
104 GDK_SELECTION_REQUEST = 18,
105 GDK_SELECTION_NOTIFY = 19,
106 GDK_PROXIMITY_IN = 20,
107 GDK_PROXIMITY_OUT = 21,
110 GDK_DRAG_MOTION = 24,
111 GDK_DRAG_STATUS = 25,
113 GDK_DROP_FINISHED = 27,
114 GDK_CLIENT_EVENT = 28,
115 GDK_VISIBILITY_NOTIFY = 29,
118 GDK_WINDOW_STATE = 32,
122 /* Event masks. (Used to select what types of events a window
127 GDK_EXPOSURE_MASK = 1 << 1,
128 GDK_POINTER_MOTION_MASK = 1 << 2,
129 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
130 GDK_BUTTON_MOTION_MASK = 1 << 4,
131 GDK_BUTTON1_MOTION_MASK = 1 << 5,
132 GDK_BUTTON2_MOTION_MASK = 1 << 6,
133 GDK_BUTTON3_MOTION_MASK = 1 << 7,
134 GDK_BUTTON_PRESS_MASK = 1 << 8,
135 GDK_BUTTON_RELEASE_MASK = 1 << 9,
136 GDK_KEY_PRESS_MASK = 1 << 10,
137 GDK_KEY_RELEASE_MASK = 1 << 11,
138 GDK_ENTER_NOTIFY_MASK = 1 << 12,
139 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
140 GDK_FOCUS_CHANGE_MASK = 1 << 14,
141 GDK_STRUCTURE_MASK = 1 << 15,
142 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
143 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
144 GDK_PROXIMITY_IN_MASK = 1 << 18,
145 GDK_PROXIMITY_OUT_MASK = 1 << 19,
146 GDK_SUBSTRUCTURE_MASK = 1 << 20,
147 GDK_SCROLL_MASK = 1 << 21,
148 GDK_ALL_EVENTS_MASK = 0x3FFFFE
153 GDK_VISIBILITY_UNOBSCURED,
154 GDK_VISIBILITY_PARTIAL,
155 GDK_VISIBILITY_FULLY_OBSCURED
156 } GdkVisibilityState;
164 } GdkScrollDirection;
166 /* Types of enter/leave notifications.
172 * Unknown: An unknown type of enter/leave event occurred.
176 GDK_NOTIFY_ANCESTOR = 0,
177 GDK_NOTIFY_VIRTUAL = 1,
178 GDK_NOTIFY_INFERIOR = 2,
179 GDK_NOTIFY_NONLINEAR = 3,
180 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
181 GDK_NOTIFY_UNKNOWN = 5
184 /* Enter/leave event modes.
198 GDK_PROPERTY_NEW_VALUE,
204 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
205 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
206 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
207 GDK_WINDOW_STATE_STICKY = 1 << 3
212 GDK_SETTING_ACTION_NEW,
213 GDK_SETTING_ACTION_CHANGED,
214 GDK_SETTING_ACTION_DELETED
224 struct _GdkEventExpose
231 gint count; /* If non-zero, how many more events follow. */
234 struct _GdkEventNoExpose
239 /* XXX: does anyone need the X major_code or minor_code fields? */
242 struct _GdkEventVisibility
247 GdkVisibilityState state;
250 struct _GdkEventMotion
262 gdouble x_root, y_root;
265 struct _GdkEventButton
277 gdouble x_root, y_root;
280 struct _GdkEventScroll
289 GdkScrollDirection direction;
291 gdouble x_root, y_root;
304 guint16 hardware_keycode;
308 struct _GdkEventCrossing
313 GdkWindow *subwindow;
319 GdkCrossingMode mode;
320 GdkNotifyType detail;
325 struct _GdkEventFocus
333 struct _GdkEventConfigure
343 struct _GdkEventProperty
353 struct _GdkEventSelection
362 GdkNativeWindow requestor;
365 /* This event type will be used pretty rarely. It only is important
366 for XInput aware programs that are drawing their own cursor */
368 struct _GdkEventProximity
377 struct _GdkEventClient
382 GdkAtom message_type;
391 struct _GdkEventSetting
396 GdkSettingAction action;
400 struct _GdkEventWindowState
405 GdkWindowState changed_mask;
406 GdkWindowState new_window_state;
409 /* Event types for DND */
411 struct _GdkEventDND {
415 GdkDragContext *context;
418 gshort x_root, y_root;
425 GdkEventExpose expose;
426 GdkEventNoExpose no_expose;
427 GdkEventVisibility visibility;
428 GdkEventMotion motion;
429 GdkEventButton button;
430 GdkEventScroll scroll;
432 GdkEventCrossing crossing;
433 GdkEventFocus focus_change;
434 GdkEventConfigure configure;
435 GdkEventProperty property;
436 GdkEventSelection selection;
437 GdkEventProximity proximity;
438 GdkEventClient client;
440 GdkEventWindowState window_state;
441 GdkEventSetting setting;
444 GType gdk_event_get_type (void);
446 gboolean gdk_events_pending (void);
447 GdkEvent* gdk_event_get (void);
449 GdkEvent* gdk_event_peek (void);
450 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
451 void gdk_event_put (GdkEvent *event);
453 GdkEvent* gdk_event_copy (GdkEvent *event);
454 void gdk_event_free (GdkEvent *event);
456 guint32 gdk_event_get_time (GdkEvent *event);
457 gboolean gdk_event_get_state (GdkEvent *event,
458 GdkModifierType *state);
459 gboolean gdk_event_get_axis (GdkEvent *event,
463 void gdk_event_handler_set (GdkEventFunc func,
465 GDestroyNotify notify);
467 void gdk_set_show_events (gboolean show_events);
468 gboolean gdk_get_show_events (void);
471 * The following function adds a global filter for all client
472 * messages of type message_type
474 void gdk_add_client_message_filter (GdkAtom message_type,
478 gboolean gdk_setting_get (const gchar *name,
483 #endif /* __cplusplus */
485 #endif /* __GDK_EVENTS_H__ */