1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #ifndef __GDK_EVENTS_H__
28 #define __GDK_EVENTS_H__
30 #include <gdk/gdkcolor.h>
31 #include <gdk/gdktypes.h>
32 #include <gdk/gdkdnd.h>
33 #include <gdk/gdkinput.h>
37 #define GDK_TYPE_EVENT (gdk_event_get_type ())
39 #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
40 #define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
43 typedef struct _GdkEventAny GdkEventAny;
44 typedef struct _GdkEventExpose GdkEventExpose;
45 typedef struct _GdkEventNoExpose GdkEventNoExpose;
46 typedef struct _GdkEventVisibility GdkEventVisibility;
47 typedef struct _GdkEventMotion GdkEventMotion;
48 typedef struct _GdkEventButton GdkEventButton;
49 typedef struct _GdkEventScroll GdkEventScroll;
50 typedef struct _GdkEventKey GdkEventKey;
51 typedef struct _GdkEventFocus GdkEventFocus;
52 typedef struct _GdkEventCrossing GdkEventCrossing;
53 typedef struct _GdkEventConfigure GdkEventConfigure;
54 typedef struct _GdkEventProperty GdkEventProperty;
55 typedef struct _GdkEventSelection GdkEventSelection;
56 typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
57 typedef struct _GdkEventProximity GdkEventProximity;
58 typedef struct _GdkEventClient GdkEventClient;
59 typedef struct _GdkEventDND GdkEventDND;
60 typedef struct _GdkEventWindowState GdkEventWindowState;
61 typedef struct _GdkEventSetting GdkEventSetting;
62 typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
64 typedef union _GdkEvent GdkEvent;
66 typedef void (*GdkEventFunc) (GdkEvent *event,
71 typedef void GdkXEvent; /* Can be cast to window system specific
72 * even type, XEvent on X11, MSG on Win32.
76 GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
77 GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
78 stored in the "event" structure that was
80 GDK_FILTER_REMOVE /* Terminate processing, removing event */
83 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
89 * Nothing: No event occurred.
90 * Delete: A window delete event was sent by the window manager.
91 * The specified window should be deleted.
92 * Destroy: A window has been destroyed.
93 * Expose: Part of a window has been uncovered.
94 * NoExpose: Same as expose, but no expose event was generated.
95 * VisibilityNotify: A window has become fully/partially/not obscured.
96 * MotionNotify: The mouse has moved.
97 * ButtonPress: A mouse button was pressed.
98 * ButtonRelease: A mouse button was release.
99 * KeyPress: A key was pressed.
100 * KeyRelease: A key was released.
101 * EnterNotify: A window was entered.
102 * LeaveNotify: A window was exited.
103 * FocusChange: The focus window has changed. (The focus window gets
105 * Resize: A window has been resized.
106 * Map: A window has been mapped. (It is now visible on the screen).
107 * Unmap: A window has been unmapped. (It is no longer visible on
109 * Scroll: A mouse wheel was scrolled either up or down.
117 GDK_MOTION_NOTIFY = 3,
118 GDK_BUTTON_PRESS = 4,
119 GDK_2BUTTON_PRESS = 5,
120 GDK_3BUTTON_PRESS = 6,
121 GDK_BUTTON_RELEASE = 7,
124 GDK_ENTER_NOTIFY = 10,
125 GDK_LEAVE_NOTIFY = 11,
126 GDK_FOCUS_CHANGE = 12,
130 GDK_PROPERTY_NOTIFY = 16,
131 GDK_SELECTION_CLEAR = 17,
132 GDK_SELECTION_REQUEST = 18,
133 GDK_SELECTION_NOTIFY = 19,
134 GDK_PROXIMITY_IN = 20,
135 GDK_PROXIMITY_OUT = 21,
138 GDK_DRAG_MOTION = 24,
139 GDK_DRAG_STATUS = 25,
141 GDK_DROP_FINISHED = 27,
142 GDK_CLIENT_EVENT = 28,
143 GDK_VISIBILITY_NOTIFY = 29,
146 GDK_WINDOW_STATE = 32,
148 GDK_OWNER_CHANGE = 34,
149 GDK_GRAB_BROKEN = 35,
153 /* Event masks. (Used to select what types of events a window
158 GDK_EXPOSURE_MASK = 1 << 1,
159 GDK_POINTER_MOTION_MASK = 1 << 2,
160 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
161 GDK_BUTTON_MOTION_MASK = 1 << 4,
162 GDK_BUTTON1_MOTION_MASK = 1 << 5,
163 GDK_BUTTON2_MOTION_MASK = 1 << 6,
164 GDK_BUTTON3_MOTION_MASK = 1 << 7,
165 GDK_BUTTON_PRESS_MASK = 1 << 8,
166 GDK_BUTTON_RELEASE_MASK = 1 << 9,
167 GDK_KEY_PRESS_MASK = 1 << 10,
168 GDK_KEY_RELEASE_MASK = 1 << 11,
169 GDK_ENTER_NOTIFY_MASK = 1 << 12,
170 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
171 GDK_FOCUS_CHANGE_MASK = 1 << 14,
172 GDK_STRUCTURE_MASK = 1 << 15,
173 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
174 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
175 GDK_PROXIMITY_IN_MASK = 1 << 18,
176 GDK_PROXIMITY_OUT_MASK = 1 << 19,
177 GDK_SUBSTRUCTURE_MASK = 1 << 20,
178 GDK_SCROLL_MASK = 1 << 21,
179 GDK_ALL_EVENTS_MASK = 0x3FFFFE
184 GDK_VISIBILITY_UNOBSCURED,
185 GDK_VISIBILITY_PARTIAL,
186 GDK_VISIBILITY_FULLY_OBSCURED
187 } GdkVisibilityState;
195 } GdkScrollDirection;
197 /* Types of enter/leave notifications.
203 * Unknown: An unknown type of enter/leave event occurred.
207 GDK_NOTIFY_ANCESTOR = 0,
208 GDK_NOTIFY_VIRTUAL = 1,
209 GDK_NOTIFY_INFERIOR = 2,
210 GDK_NOTIFY_NONLINEAR = 3,
211 GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
212 GDK_NOTIFY_UNKNOWN = 5
215 /* Enter/leave event modes.
229 GDK_PROPERTY_NEW_VALUE,
235 GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
236 GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
237 GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
238 GDK_WINDOW_STATE_STICKY = 1 << 3,
239 GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
240 GDK_WINDOW_STATE_ABOVE = 1 << 5,
241 GDK_WINDOW_STATE_BELOW = 1 << 6
246 GDK_SETTING_ACTION_NEW,
247 GDK_SETTING_ACTION_CHANGED,
248 GDK_SETTING_ACTION_DELETED
253 GDK_OWNER_CHANGE_NEW_OWNER,
254 GDK_OWNER_CHANGE_DESTROY,
255 GDK_OWNER_CHANGE_CLOSE
265 struct _GdkEventExpose
272 gint count; /* If non-zero, how many more events follow. */
275 struct _GdkEventNoExpose
282 struct _GdkEventVisibility
287 GdkVisibilityState state;
290 struct _GdkEventMotion
302 gdouble x_root, y_root;
305 struct _GdkEventButton
317 gdouble x_root, y_root;
320 struct _GdkEventScroll
329 GdkScrollDirection direction;
331 gdouble x_root, y_root;
344 guint16 hardware_keycode;
346 guint is_modifier : 1;
349 struct _GdkEventCrossing
354 GdkWindow *subwindow;
360 GdkCrossingMode mode;
361 GdkNotifyType detail;
366 struct _GdkEventFocus
374 struct _GdkEventConfigure
384 struct _GdkEventProperty
394 struct _GdkEventSelection
403 GdkNativeWindow requestor;
406 struct _GdkEventOwnerChange
411 GdkNativeWindow owner;
412 GdkOwnerChange reason;
415 guint32 selection_time;
418 /* This event type will be used pretty rarely. It only is important
419 for XInput aware programs that are drawing their own cursor */
421 struct _GdkEventProximity
430 struct _GdkEventClient
435 GdkAtom message_type;
444 struct _GdkEventSetting
449 GdkSettingAction action;
453 struct _GdkEventWindowState
458 GdkWindowState changed_mask;
459 GdkWindowState new_window_state;
462 struct _GdkEventGrabBroken {
468 GdkWindow *grab_window;
471 /* Event types for DND */
473 struct _GdkEventDND {
477 GdkDragContext *context;
480 gshort x_root, y_root;
487 GdkEventExpose expose;
488 GdkEventNoExpose no_expose;
489 GdkEventVisibility visibility;
490 GdkEventMotion motion;
491 GdkEventButton button;
492 GdkEventScroll scroll;
494 GdkEventCrossing crossing;
495 GdkEventFocus focus_change;
496 GdkEventConfigure configure;
497 GdkEventProperty property;
498 GdkEventSelection selection;
499 GdkEventOwnerChange owner_change;
500 GdkEventProximity proximity;
501 GdkEventClient client;
503 GdkEventWindowState window_state;
504 GdkEventSetting setting;
505 GdkEventGrabBroken grab_broken;
508 GType gdk_event_get_type (void) G_GNUC_CONST;
510 gboolean gdk_events_pending (void);
511 GdkEvent* gdk_event_get (void);
513 GdkEvent* gdk_event_peek (void);
514 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
515 void gdk_event_put (const GdkEvent *event);
517 GdkEvent* gdk_event_new (GdkEventType type);
518 GdkEvent* gdk_event_copy (const GdkEvent *event);
519 void gdk_event_free (GdkEvent *event);
521 guint32 gdk_event_get_time (const GdkEvent *event);
522 gboolean gdk_event_get_state (const GdkEvent *event,
523 GdkModifierType *state);
524 gboolean gdk_event_get_coords (const GdkEvent *event,
527 gboolean gdk_event_get_root_coords (const GdkEvent *event,
530 gboolean gdk_event_get_axis (const GdkEvent *event,
533 void gdk_event_request_motions (const GdkEventMotion *event);
534 void gdk_event_handler_set (GdkEventFunc func,
536 GDestroyNotify notify);
538 void gdk_event_set_screen (GdkEvent *event,
540 GdkScreen *gdk_event_get_screen (const GdkEvent *event);
542 void gdk_set_show_events (gboolean show_events);
543 gboolean gdk_get_show_events (void);
545 #ifndef GDK_MULTIHEAD_SAFE
546 void gdk_add_client_message_filter (GdkAtom message_type,
550 gboolean gdk_setting_get (const gchar *name,
552 #endif /* GDK_MULTIHEAD_SAFE */
556 #endif /* __GDK_EVENTS_H__ */