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,
208 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4
213 GDK_SETTING_ACTION_NEW,
214 GDK_SETTING_ACTION_CHANGED,
215 GDK_SETTING_ACTION_DELETED
225 struct _GdkEventExpose
232 gint count; /* If non-zero, how many more events follow. */
235 struct _GdkEventNoExpose
240 /* XXX: does anyone need the X major_code or minor_code fields? */
243 struct _GdkEventVisibility
248 GdkVisibilityState state;
251 struct _GdkEventMotion
263 gdouble x_root, y_root;
266 struct _GdkEventButton
278 gdouble x_root, y_root;
281 struct _GdkEventScroll
290 GdkScrollDirection direction;
292 gdouble x_root, y_root;
305 guint16 hardware_keycode;
309 struct _GdkEventCrossing
314 GdkWindow *subwindow;
320 GdkCrossingMode mode;
321 GdkNotifyType detail;
326 struct _GdkEventFocus
334 struct _GdkEventConfigure
344 struct _GdkEventProperty
354 struct _GdkEventSelection
363 GdkNativeWindow requestor;
366 /* This event type will be used pretty rarely. It only is important
367 for XInput aware programs that are drawing their own cursor */
369 struct _GdkEventProximity
378 struct _GdkEventClient
383 GdkAtom message_type;
392 struct _GdkEventSetting
397 GdkSettingAction action;
401 struct _GdkEventWindowState
406 GdkWindowState changed_mask;
407 GdkWindowState new_window_state;
410 /* Event types for DND */
412 struct _GdkEventDND {
416 GdkDragContext *context;
419 gshort x_root, y_root;
426 GdkEventExpose expose;
427 GdkEventNoExpose no_expose;
428 GdkEventVisibility visibility;
429 GdkEventMotion motion;
430 GdkEventButton button;
431 GdkEventScroll scroll;
433 GdkEventCrossing crossing;
434 GdkEventFocus focus_change;
435 GdkEventConfigure configure;
436 GdkEventProperty property;
437 GdkEventSelection selection;
438 GdkEventProximity proximity;
439 GdkEventClient client;
441 GdkEventWindowState window_state;
442 GdkEventSetting setting;
445 GType gdk_event_get_type (void);
447 gboolean gdk_events_pending (void);
448 GdkEvent* gdk_event_get (void);
450 GdkEvent* gdk_event_peek (void);
451 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
452 void gdk_event_put (GdkEvent *event);
454 GdkEvent* gdk_event_copy (GdkEvent *event);
455 void gdk_event_free (GdkEvent *event);
457 guint32 gdk_event_get_time (GdkEvent *event);
458 gboolean gdk_event_get_state (GdkEvent *event,
459 GdkModifierType *state);
460 gboolean gdk_event_get_coords (GdkEvent *event,
463 gboolean gdk_event_get_root_coords (GdkEvent *event,
466 gboolean gdk_event_get_axis (GdkEvent *event,
469 void gdk_event_handler_set (GdkEventFunc func,
471 GDestroyNotify notify);
473 void gdk_event_set_screen (GdkEvent *event,
475 GdkScreen *gdk_event_get_screen (GdkEvent *event);
477 void gdk_set_show_events (gboolean show_events);
478 gboolean gdk_get_show_events (void);
480 #ifndef GDK_MULTIHEAD_SAFE
481 void gdk_add_client_message_filter (GdkAtom message_type,
485 gboolean gdk_setting_get (const gchar *name,
487 #endif /* GDK_MULTIHEAD_SAFE */
491 #endif /* __cplusplus */
493 #endif /* __GDK_EVENTS_H__ */