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 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
31 #ifndef __GDK_TYPES_H__
32 #define __GDK_TYPES_H__
34 /* GDK uses "glib". (And so does GTK).
37 #include <pango/pango.h>
38 #include <glib-object.h>
41 /* The system specific file gdkconfig.h contains such configuration
42 * settings that are needed not only when compiling GDK (or GTK)
43 * itself, but also occasionally when compiling programs that use GDK
44 * (or GTK). One such setting is what windowing API backend is in use.
46 #include <gdkconfig.h>
48 /* some common magic values */
49 #define GDK_CURRENT_TIME 0L
52 * GDK_PARENT_RELATIVE:
54 * A special value, indicating that the background
55 * for a window should be inherited from the parent window.
57 #define GDK_PARENT_RELATIVE 1L
64 /* Type definitions for the basic structures.
66 typedef struct _GdkPoint GdkPoint;
71 * Defines the position and size of a rectangle. It is identical to
72 * #cairo_rectangle_int_t.
74 typedef cairo_rectangle_int_t GdkRectangle;
79 * An opaque type representing a string as an index into a table
80 * of strings on the X server.
82 typedef struct _GdkAtom *GdkAtom;
85 * GDK_ATOM_TO_POINTER:
88 * Converts a #GdkAtom into a pointer type.
90 #define GDK_ATOM_TO_POINTER(atom) (atom)
93 * GDK_POINTER_TO_ATOM:
94 * @ptr: a pointer containing a #GdkAtom.
96 * Extracts a #GdkAtom from a pointer. The #GdkAtom must have been
97 * stored in the pointer with GDK_ATOM_TO_POINTER().
99 #define GDK_POINTER_TO_ATOM(ptr) ((GdkAtom)(ptr))
101 #ifdef GDK_NATIVE_WINDOW_POINTER
102 #define GDK_GPOINTER_TO_NATIVE_WINDOW(p) ((GdkNativeWindow) (p))
104 #define GDK_GPOINTER_TO_NATIVE_WINDOW(p) GPOINTER_TO_UINT(p)
107 #define _GDK_MAKE_ATOM(val) ((GdkAtom)GUINT_TO_POINTER(val))
112 * A null value for #GdkAtom, used in a similar way as
113 * <literal>None</literal> in the Xlib API.
115 #define GDK_NONE _GDK_MAKE_ATOM (0)
117 #ifdef GDK_NATIVE_WINDOW_POINTER
118 typedef gpointer GdkNativeWindow;
120 typedef guint32 GdkNativeWindow;
123 /* Forward declarations of commonly used types
125 typedef struct _GdkColor GdkColor;
126 typedef struct _GdkRGBA GdkRGBA;
127 typedef struct _GdkCursor GdkCursor;
128 typedef struct _GdkVisual GdkVisual;
130 typedef struct _GdkDrawable GdkDrawable;
135 * An opaque structure representing an onscreen drawable.
137 typedef struct _GdkDrawable GdkWindow;
138 typedef struct _GdkDisplay GdkDisplay;
139 typedef struct _GdkScreen GdkScreen;
143 * @GDK_LSB_FIRST: The values are stored with the least-significant byte
144 * first. For instance, the 32-bit value 0xffeecc would be stored
145 * in memory as 0xcc, 0xee, 0xff, 0x00.
146 * @GDK_MSB_FIRST: The values are stored with the most-significant byte
147 * first. For instance, the 32-bit value 0xffeecc would be stored
148 * in memory as 0x00, 0xcc, 0xee, 0xff.
150 * A set of values describing the possible byte-orders
151 * for storing pixel values in memory.
159 /* Types of modifiers.
163 * @GDK_SHIFT_MASK: the Shift key.
164 * @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
165 * X server this may either be CapsLock or ShiftLock).
166 * @GDK_CONTROL_MASK: the Control key.
167 * @GDK_MOD1_MASK: the fourth modifier key (it depends on the modifier
168 * mapping of the X server which key is interpreted as this modifier, but
169 * normally it is the Alt key).
170 * @GDK_MOD2_MASK: the fifth modifier key (it depends on the modifier
171 * mapping of the X server which key is interpreted as this modifier).
172 * @GDK_MOD3_MASK: the sixth modifier key (it depends on the modifier
173 * mapping of the X server which key is interpreted as this modifier).
174 * @GDK_MOD4_MASK: the seventh modifier key (it depends on the modifier
175 * mapping of the X server which key is interpreted as this modifier).
176 * @GDK_MOD5_MASK: the eighth modifier key (it depends on the modifier
177 * mapping of the X server which key is interpreted as this modifier).
178 * @GDK_BUTTON1_MASK: the first mouse button.
179 * @GDK_BUTTON2_MASK: the second mouse button.
180 * @GDK_BUTTON3_MASK: the third mouse button.
181 * @GDK_BUTTON4_MASK: the fourth mouse button.
182 * @GDK_BUTTON5_MASK: the fifth mouse button.
183 * @GDK_SUPER_MASK: the Super modifier. Since 2.10
184 * @GDK_HYPER_MASK: the Hyper modifier. Since 2.10
185 * @GDK_META_MASK: the Meta modifier. Since 2.10
186 * @GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
187 * between (keyval, modifiers) pairs from key press and release events.
188 * @GDK_MODIFIER_MASK: a mask covering all modifier types.
190 * A set of bit-flags to indicate the state of modifier keys and mouse buttons
191 * in various event types. Typical modifier keys are Shift, Control, Meta,
192 * Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
194 * Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
196 * Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
197 * to Mod2 - Mod5, and indicates this by setting %GDK_SUPER_MASK,
198 * %GDK_HYPER_MASK or %GDK_META_MASK in the state field of key events.
202 GDK_SHIFT_MASK = 1 << 0,
203 GDK_LOCK_MASK = 1 << 1,
204 GDK_CONTROL_MASK = 1 << 2,
205 GDK_MOD1_MASK = 1 << 3,
206 GDK_MOD2_MASK = 1 << 4,
207 GDK_MOD3_MASK = 1 << 5,
208 GDK_MOD4_MASK = 1 << 6,
209 GDK_MOD5_MASK = 1 << 7,
210 GDK_BUTTON1_MASK = 1 << 8,
211 GDK_BUTTON2_MASK = 1 << 9,
212 GDK_BUTTON3_MASK = 1 << 10,
213 GDK_BUTTON4_MASK = 1 << 11,
214 GDK_BUTTON5_MASK = 1 << 12,
216 /* The next few modifiers are used by XKB, so we skip to the end.
217 * Bits 15 - 25 are currently unused. Bit 29 is used internally.
220 GDK_SUPER_MASK = 1 << 26,
221 GDK_HYPER_MASK = 1 << 27,
222 GDK_META_MASK = 1 << 28,
224 GDK_RELEASE_MASK = 1 << 30,
226 GDK_MODIFIER_MASK = 0x5c001fff
233 GDK_ERROR_PARAM = -2,
240 * @GDK_GRAB_SUCCESS: the resource was successfully grabbed.
241 * @GDK_GRAB_ALREADY_GRABBED: the resource is actively grabbed by another client.
242 * @GDK_GRAB_INVALID_TIME: the resource was grabbed more recently than the
244 * @GDK_GRAB_NOT_VIEWABLE: the grab window or the @confine_to window are not
246 * @GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
248 * Returned by gdk_pointer_grab() and gdk_keyboard_grab() to indicate
249 * success or the reason for the failure of the grab attempt.
253 GDK_GRAB_SUCCESS = 0,
254 GDK_GRAB_ALREADY_GRABBED = 1,
255 GDK_GRAB_INVALID_TIME = 2,
256 GDK_GRAB_NOT_VIEWABLE = 3,
262 * @GDK_OWNERSHIP_NONE: All other devices' events are allowed.
263 * @GDK_OWNERSHIP_WINDOW: Other devices' events are blocked for the grab window.
264 * @GDK_OWNERSHIP_APPLICATION: Other devices' events are blocked for the whole application.
266 * Defines how device grabs interact with other devices.
271 GDK_OWNERSHIP_WINDOW,
272 GDK_OWNERSHIP_APPLICATION
275 /* Event masks. (Used to select what types of events a window
280 GDK_EXPOSURE_MASK = 1 << 1,
281 GDK_POINTER_MOTION_MASK = 1 << 2,
282 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
283 GDK_BUTTON_MOTION_MASK = 1 << 4,
284 GDK_BUTTON1_MOTION_MASK = 1 << 5,
285 GDK_BUTTON2_MOTION_MASK = 1 << 6,
286 GDK_BUTTON3_MOTION_MASK = 1 << 7,
287 GDK_BUTTON_PRESS_MASK = 1 << 8,
288 GDK_BUTTON_RELEASE_MASK = 1 << 9,
289 GDK_KEY_PRESS_MASK = 1 << 10,
290 GDK_KEY_RELEASE_MASK = 1 << 11,
291 GDK_ENTER_NOTIFY_MASK = 1 << 12,
292 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
293 GDK_FOCUS_CHANGE_MASK = 1 << 14,
294 GDK_STRUCTURE_MASK = 1 << 15,
295 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
296 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
297 GDK_PROXIMITY_IN_MASK = 1 << 18,
298 GDK_PROXIMITY_OUT_MASK = 1 << 19,
299 GDK_SUBSTRUCTURE_MASK = 1 << 20,
300 GDK_SCROLL_MASK = 1 << 21,
301 GDK_ALL_EVENTS_MASK = 0x3FFFFE
306 * @x: the x coordinate of the point.
307 * @y: the y coordinate of the point.
309 * Defines the x and y coordinates of a point.
321 #endif /* __GDK_TYPES_H__ */