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 _GdkEventOwnerChange GdkEventOwnerChange;
33 typedef struct _GdkEventProximity GdkEventProximity;
34 typedef struct _GdkEventClient GdkEventClient;
35 typedef struct _GdkEventDND GdkEventDND;
36 typedef struct _GdkEventWindowState GdkEventWindowState;
37 typedef struct _GdkEventSetting GdkEventSetting;
39 typedef union _GdkEvent GdkEvent;
41 typedef void (*GdkEventFunc) (GdkEvent *event,
46 typedef void GdkXEvent; /* Can be cast to window system specific
47 * even type, XEvent on X11, MSG on Win32.
51 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
52 GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
53 stored in the "event" structure that was
55 GDK_FILTER_REMOVE /* Terminate processing, removing event */
58 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
64 * Nothing: No event occurred.
65 * Delete: A window delete event was sent by the window manager.
66 * The specified window should be deleted.
67 * Destroy: A window has been destroyed.
68 * Expose: Part of a window has been uncovered.
69 * NoExpose: Same as expose, but no expose event was generated.
70 * VisibilityNotify: A window has become fully/partially/not obscured.
71 * MotionNotify: The mouse has moved.
72 * ButtonPress: A mouse button was pressed.
73 * ButtonRelease: A mouse button was release.
74 * KeyPress: A key was pressed.
75 * KeyRelease: A key was released.
76 * EnterNotify: A window was entered.
77 * LeaveNotify: A window was exited.
78 * FocusChange: The focus window has changed. (The focus window gets
80 * Resize: A window has been resized.
81 * Map: A window has been mapped. (It is now visible on the screen).
82 * Unmap: A window has been unmapped. (It is no longer visible on
84 * Scroll: A mouse wheel was scrolled either up or down.
92 GDK_MOTION_NOTIFY = 3,
94 GDK_2BUTTON_PRESS = 5,
95 GDK_3BUTTON_PRESS = 6,
96 GDK_BUTTON_RELEASE = 7,
99 GDK_ENTER_NOTIFY = 10,
100 GDK_LEAVE_NOTIFY = 11,
101 GDK_FOCUS_CHANGE = 12,
105 GDK_PROPERTY_NOTIFY = 16,
106 GDK_SELECTION_CLEAR = 17,
107 GDK_SELECTION_REQUEST = 18,
108 GDK_SELECTION_NOTIFY = 19,
109 GDK_PROXIMITY_IN = 20,
110 GDK_PROXIMITY_OUT = 21,
113 GDK_DRAG_MOTION = 24,
114 GDK_DRAG_STATUS = 25,
116 GDK_DROP_FINISHED = 27,
117 GDK_CLIENT_EVENT = 28,
118 GDK_VISIBILITY_NOTIFY = 29,
121 GDK_WINDOW_STATE = 32,
123 GDK_OWNER_CHANGE = 34
126 /* Event masks. (Used to select what types of events a window
131 GDK_EXPOSURE_MASK = 1 << 1,
132 GDK_POINTER_MOTION_MASK = 1 << 2,
133 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
134 GDK_BUTTON_MOTION_MASK = 1 << 4,
135 GDK_BUTTON1_MOTION_MASK = 1 << 5,
136 GDK_BUTTON2_MOTION_MASK = 1 << 6,
137 GDK_BUTTON3_MOTION_MASK = 1 << 7,
138 GDK_BUTTON_PRESS_MASK = 1 << 8,
139 GDK_BUTTON_RELEASE_MASK = 1 << 9,
140 GDK_KEY_PRESS_MASK = 1 << 10,
141 GDK_KEY_RELEASE_MASK = 1 << 11,
142 GDK_ENTER_NOTIFY_MASK = 1 << 12,
143 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
144 GDK_FOCUS_CHANGE_MASK = 1 << 14,
145 GDK_STRUCTURE_MASK = 1 << 15,
146 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
147 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
148 GDK_PROXIMITY_IN_MASK = 1 << 18,
149 GDK_PROXIMITY_OUT_MASK = 1 << 19,
150 GDK_SUBSTRUCTURE_MASK = 1 << 20,
151 GDK_SCROLL_MASK = 1 << 21,
152 GDK_ALL_EVENTS_MASK = 0x3FFFFE
157 GDK_VISIBILITY_UNOBSCURED,
158 GDK_VISIBILITY_PARTIAL,
159 GDK_VISIBILITY_FULLY_OBSCURED
160 } GdkVisibilityState;
168 } GdkScrollDirection;
170 /* Types of enter/leave notifications.
176 * Unknown: An unknown type of enter/leave event occurred.
180 GDK_NOTIFY_ANCESTOR = 0,
181 GDK_NOTIFY_VIRTUAL = 1,
182 GDK_NOTIFY_INFERIOR = 2,
183 GDK_NOTIFY_NONLINEAR = 3,
184 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
185 GDK_NOTIFY_UNKNOWN = 5
188 /* Enter/leave event modes.
202 GDK_PROPERTY_NEW_VALUE,
208 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
209 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
210 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
211 GDK_WINDOW_STATE_STICKY = 1 << 3,
212 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
213 GDK_WINDOW_STATE_ABOVE = 1 << 5,
214 GDK_WINDOW_STATE_BELOW = 1 << 6
219 GDK_SETTING_ACTION_NEW,
220 GDK_SETTING_ACTION_CHANGED,
221 GDK_SETTING_ACTION_DELETED
226 GDK_OWNER_CHANGE_NEW_OWNER,
227 GDK_OWNER_CHANGE_DESTROY,
228 GDK_OWNER_CHANGE_CLOSE
238 struct _GdkEventExpose
245 gint count; /* If non-zero, how many more events follow. */
248 struct _GdkEventNoExpose
255 struct _GdkEventVisibility
260 GdkVisibilityState state;
263 struct _GdkEventMotion
275 gdouble x_root, y_root;
278 struct _GdkEventButton
290 gdouble x_root, y_root;
293 struct _GdkEventScroll
302 GdkScrollDirection direction;
304 gdouble x_root, y_root;
317 guint16 hardware_keycode;
321 struct _GdkEventCrossing
326 GdkWindow *subwindow;
332 GdkCrossingMode mode;
333 GdkNotifyType detail;
338 struct _GdkEventFocus
346 struct _GdkEventConfigure
356 struct _GdkEventProperty
366 struct _GdkEventSelection
375 GdkNativeWindow requestor;
378 struct _GdkEventOwnerChange
383 GdkNativeWindow owner;
384 GdkOwnerChange reason;
387 guint32 selection_time;
390 /* This event type will be used pretty rarely. It only is important
391 for XInput aware programs that are drawing their own cursor */
393 struct _GdkEventProximity
402 struct _GdkEventClient
407 GdkAtom message_type;
416 struct _GdkEventSetting
421 GdkSettingAction action;
425 struct _GdkEventWindowState
430 GdkWindowState changed_mask;
431 GdkWindowState new_window_state;
434 /* Event types for DND */
436 struct _GdkEventDND {
440 GdkDragContext *context;
443 gshort x_root, y_root;
450 GdkEventExpose expose;
451 GdkEventNoExpose no_expose;
452 GdkEventVisibility visibility;
453 GdkEventMotion motion;
454 GdkEventButton button;
455 GdkEventScroll scroll;
457 GdkEventCrossing crossing;
458 GdkEventFocus focus_change;
459 GdkEventConfigure configure;
460 GdkEventProperty property;
461 GdkEventSelection selection;
462 GdkEventOwnerChange owner_change;
463 GdkEventProximity proximity;
464 GdkEventClient client;
466 GdkEventWindowState window_state;
467 GdkEventSetting setting;
470 GType gdk_event_get_type (void) G_GNUC_CONST;
472 gboolean gdk_events_pending (void);
473 GdkEvent* gdk_event_get (void);
475 GdkEvent* gdk_event_peek (void);
476 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
477 void gdk_event_put (GdkEvent *event);
479 GdkEvent* gdk_event_new (GdkEventType type);
480 GdkEvent* gdk_event_copy (GdkEvent *event);
481 void gdk_event_free (GdkEvent *event);
483 guint32 gdk_event_get_time (GdkEvent *event);
484 gboolean gdk_event_get_state (GdkEvent *event,
485 GdkModifierType *state);
486 gboolean gdk_event_get_coords (GdkEvent *event,
489 gboolean gdk_event_get_root_coords (GdkEvent *event,
492 gboolean gdk_event_get_axis (GdkEvent *event,
495 void gdk_event_handler_set (GdkEventFunc func,
497 GDestroyNotify notify);
499 void gdk_event_set_screen (GdkEvent *event,
501 GdkScreen *gdk_event_get_screen (GdkEvent *event);
503 void gdk_set_show_events (gboolean show_events);
504 gboolean gdk_get_show_events (void);
506 #ifndef GDK_MULTIHEAD_SAFE
507 void gdk_add_client_message_filter (GdkAtom message_type,
511 gboolean gdk_setting_get (const gchar *name,
513 #endif /* GDK_MULTIHEAD_SAFE */
517 #endif /* __cplusplus */
519 #endif /* __GDK_EVENTS_H__ */