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, /* Native event translated into a GDK event and
52 stored in the "event" structure that was
54 GDK_FILTER_REMOVE /* Terminate processing, removing event */
57 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
63 * Nothing: No event occurred.
64 * Delete: A window delete event was sent by the window manager.
65 * The specified window should be deleted.
66 * Destroy: A window has been destroyed.
67 * Expose: Part of a window has been uncovered.
68 * NoExpose: Same as expose, but no expose event was generated.
69 * VisibilityNotify: A window has become fully/partially/not obscured.
70 * MotionNotify: The mouse has moved.
71 * ButtonPress: A mouse button was pressed.
72 * ButtonRelease: A mouse button was release.
73 * KeyPress: A key was pressed.
74 * KeyRelease: A key was released.
75 * EnterNotify: A window was entered.
76 * LeaveNotify: A window was exited.
77 * FocusChange: The focus window has changed. (The focus window gets
79 * Resize: A window has been resized.
80 * Map: A window has been mapped. (It is now visible on the screen).
81 * Unmap: A window has been unmapped. (It is no longer visible on
83 * Scroll: A mouse wheel was scrolled either up or down.
91 GDK_MOTION_NOTIFY = 3,
93 GDK_2BUTTON_PRESS = 5,
94 GDK_3BUTTON_PRESS = 6,
95 GDK_BUTTON_RELEASE = 7,
98 GDK_ENTER_NOTIFY = 10,
99 GDK_LEAVE_NOTIFY = 11,
100 GDK_FOCUS_CHANGE = 12,
104 GDK_PROPERTY_NOTIFY = 16,
105 GDK_SELECTION_CLEAR = 17,
106 GDK_SELECTION_REQUEST = 18,
107 GDK_SELECTION_NOTIFY = 19,
108 GDK_PROXIMITY_IN = 20,
109 GDK_PROXIMITY_OUT = 21,
112 GDK_DRAG_MOTION = 24,
113 GDK_DRAG_STATUS = 25,
115 GDK_DROP_FINISHED = 27,
116 GDK_CLIENT_EVENT = 28,
117 GDK_VISIBILITY_NOTIFY = 29,
120 GDK_WINDOW_STATE = 32,
124 /* Event masks. (Used to select what types of events a window
129 GDK_EXPOSURE_MASK = 1 << 1,
130 GDK_POINTER_MOTION_MASK = 1 << 2,
131 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
132 GDK_BUTTON_MOTION_MASK = 1 << 4,
133 GDK_BUTTON1_MOTION_MASK = 1 << 5,
134 GDK_BUTTON2_MOTION_MASK = 1 << 6,
135 GDK_BUTTON3_MOTION_MASK = 1 << 7,
136 GDK_BUTTON_PRESS_MASK = 1 << 8,
137 GDK_BUTTON_RELEASE_MASK = 1 << 9,
138 GDK_KEY_PRESS_MASK = 1 << 10,
139 GDK_KEY_RELEASE_MASK = 1 << 11,
140 GDK_ENTER_NOTIFY_MASK = 1 << 12,
141 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
142 GDK_FOCUS_CHANGE_MASK = 1 << 14,
143 GDK_STRUCTURE_MASK = 1 << 15,
144 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
145 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
146 GDK_PROXIMITY_IN_MASK = 1 << 18,
147 GDK_PROXIMITY_OUT_MASK = 1 << 19,
148 GDK_SUBSTRUCTURE_MASK = 1 << 20,
149 GDK_SCROLL_MASK = 1 << 21,
150 GDK_ALL_EVENTS_MASK = 0x3FFFFE
155 GDK_VISIBILITY_UNOBSCURED,
156 GDK_VISIBILITY_PARTIAL,
157 GDK_VISIBILITY_FULLY_OBSCURED
158 } GdkVisibilityState;
166 } GdkScrollDirection;
168 /* Types of enter/leave notifications.
174 * Unknown: An unknown type of enter/leave event occurred.
178 GDK_NOTIFY_ANCESTOR = 0,
179 GDK_NOTIFY_VIRTUAL = 1,
180 GDK_NOTIFY_INFERIOR = 2,
181 GDK_NOTIFY_NONLINEAR = 3,
182 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
183 GDK_NOTIFY_UNKNOWN = 5
186 /* Enter/leave event modes.
200 GDK_PROPERTY_NEW_VALUE,
206 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
207 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
208 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
209 GDK_WINDOW_STATE_STICKY = 1 << 3,
210 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4
215 GDK_SETTING_ACTION_NEW,
216 GDK_SETTING_ACTION_CHANGED,
217 GDK_SETTING_ACTION_DELETED
227 struct _GdkEventExpose
234 gint count; /* If non-zero, how many more events follow. */
237 struct _GdkEventNoExpose
244 struct _GdkEventVisibility
249 GdkVisibilityState state;
252 struct _GdkEventMotion
264 gdouble x_root, y_root;
267 struct _GdkEventButton
279 gdouble x_root, y_root;
282 struct _GdkEventScroll
291 GdkScrollDirection direction;
293 gdouble x_root, y_root;
306 guint16 hardware_keycode;
310 struct _GdkEventCrossing
315 GdkWindow *subwindow;
321 GdkCrossingMode mode;
322 GdkNotifyType detail;
327 struct _GdkEventFocus
335 struct _GdkEventConfigure
345 struct _GdkEventProperty
355 struct _GdkEventSelection
364 GdkNativeWindow requestor;
367 /* This event type will be used pretty rarely. It only is important
368 for XInput aware programs that are drawing their own cursor */
370 struct _GdkEventProximity
379 struct _GdkEventClient
384 GdkAtom message_type;
393 struct _GdkEventSetting
398 GdkSettingAction action;
402 struct _GdkEventWindowState
407 GdkWindowState changed_mask;
408 GdkWindowState new_window_state;
411 /* Event types for DND */
413 struct _GdkEventDND {
417 GdkDragContext *context;
420 gshort x_root, y_root;
427 GdkEventExpose expose;
428 GdkEventNoExpose no_expose;
429 GdkEventVisibility visibility;
430 GdkEventMotion motion;
431 GdkEventButton button;
432 GdkEventScroll scroll;
434 GdkEventCrossing crossing;
435 GdkEventFocus focus_change;
436 GdkEventConfigure configure;
437 GdkEventProperty property;
438 GdkEventSelection selection;
439 GdkEventProximity proximity;
440 GdkEventClient client;
442 GdkEventWindowState window_state;
443 GdkEventSetting setting;
446 GType gdk_event_get_type (void);
448 gboolean gdk_events_pending (void);
449 GdkEvent* gdk_event_get (void);
451 GdkEvent* gdk_event_peek (void);
452 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
453 void gdk_event_put (GdkEvent *event);
455 GdkEvent* gdk_event_new (GdkEventType type);
456 GdkEvent* gdk_event_copy (GdkEvent *event);
457 void gdk_event_free (GdkEvent *event);
459 guint32 gdk_event_get_time (GdkEvent *event);
460 gboolean gdk_event_get_state (GdkEvent *event,
461 GdkModifierType *state);
462 gboolean gdk_event_get_coords (GdkEvent *event,
465 gboolean gdk_event_get_root_coords (GdkEvent *event,
468 gboolean gdk_event_get_axis (GdkEvent *event,
471 void gdk_event_handler_set (GdkEventFunc func,
473 GDestroyNotify notify);
475 void gdk_event_set_screen (GdkEvent *event,
477 GdkScreen *gdk_event_get_screen (GdkEvent *event);
479 void gdk_set_show_events (gboolean show_events);
480 gboolean gdk_get_show_events (void);
482 #ifndef GDK_MULTIHEAD_SAFE
483 void gdk_add_client_message_filter (GdkAtom message_type,
487 gboolean gdk_setting_get (const gchar *name,
489 #endif /* GDK_MULTIHEAD_SAFE */
493 #endif /* __cplusplus */
495 #endif /* __GDK_EVENTS_H__ */