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 <gdk/gdkconfig.h>
48 /* some common magic values */
53 * Represents the current time, and can be used anywhere a time is expected.
55 #define GDK_CURRENT_TIME 0L
58 * GDK_PARENT_RELATIVE:
60 * A special value, indicating that the background
61 * for a window should be inherited from the parent window.
63 #define GDK_PARENT_RELATIVE 1L
70 /* Type definitions for the basic structures.
72 typedef struct _GdkPoint GdkPoint;
77 * Defines the position and size of a rectangle. It is identical to
78 * #cairo_rectangle_int_t.
80 typedef cairo_rectangle_int_t GdkRectangle;
85 * An opaque type representing a string as an index into a table
86 * of strings on the X server.
88 typedef struct _GdkAtom *GdkAtom;
91 * GDK_ATOM_TO_POINTER:
94 * Converts a #GdkAtom into a pointer type.
96 #define GDK_ATOM_TO_POINTER(atom) (atom)
99 * GDK_POINTER_TO_ATOM:
100 * @ptr: a pointer containing a #GdkAtom.
102 * Extracts a #GdkAtom from a pointer. The #GdkAtom must have been
103 * stored in the pointer with GDK_ATOM_TO_POINTER().
105 #define GDK_POINTER_TO_ATOM(ptr) ((GdkAtom)(ptr))
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 /* Forward declarations of commonly used types */
118 typedef struct _GdkColor GdkColor;
119 typedef struct _GdkRGBA GdkRGBA;
120 typedef struct _GdkCursor GdkCursor;
121 typedef struct _GdkVisual GdkVisual;
122 typedef struct _GdkDevice GdkDevice;
123 typedef struct _GdkDragContext GdkDragContext;
125 typedef struct _GdkDisplayManager GdkDisplayManager;
126 typedef struct _GdkDeviceManager GdkDeviceManager;
127 typedef struct _GdkDisplay GdkDisplay;
128 typedef struct _GdkScreen GdkScreen;
129 typedef struct _GdkWindow GdkWindow;
130 typedef struct _GdkKeymap GdkKeymap;
131 typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
135 * @GDK_LSB_FIRST: The values are stored with the least-significant byte
136 * first. For instance, the 32-bit value 0xffeecc would be stored
137 * in memory as 0xcc, 0xee, 0xff, 0x00.
138 * @GDK_MSB_FIRST: The values are stored with the most-significant byte
139 * first. For instance, the 32-bit value 0xffeecc would be stored
140 * in memory as 0x00, 0xcc, 0xee, 0xff.
142 * A set of values describing the possible byte-orders
143 * for storing pixel values in memory.
151 /* Types of modifiers.
155 * @GDK_SHIFT_MASK: the Shift key.
156 * @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
157 * X server this may either be CapsLock or ShiftLock).
158 * @GDK_CONTROL_MASK: the Control key.
159 * @GDK_MOD1_MASK: the fourth modifier key (it depends on the modifier
160 * mapping of the X server which key is interpreted as this modifier, but
161 * normally it is the Alt key).
162 * @GDK_MOD2_MASK: the fifth modifier key (it depends on the modifier
163 * mapping of the X server which key is interpreted as this modifier).
164 * @GDK_MOD3_MASK: the sixth modifier key (it depends on the modifier
165 * mapping of the X server which key is interpreted as this modifier).
166 * @GDK_MOD4_MASK: the seventh modifier key (it depends on the modifier
167 * mapping of the X server which key is interpreted as this modifier).
168 * @GDK_MOD5_MASK: the eighth modifier key (it depends on the modifier
169 * mapping of the X server which key is interpreted as this modifier).
170 * @GDK_BUTTON1_MASK: the first mouse button.
171 * @GDK_BUTTON2_MASK: the second mouse button.
172 * @GDK_BUTTON3_MASK: the third mouse button.
173 * @GDK_BUTTON4_MASK: the fourth mouse button.
174 * @GDK_BUTTON5_MASK: the fifth mouse button.
175 * @GDK_MODIFIER_RESERVED_13_MASK: A reserved bit flag; do not use in your own code
176 * @GDK_SUPER_MASK: the Super modifier. Since 2.10
177 * @GDK_HYPER_MASK: the Hyper modifier. Since 2.10
178 * @GDK_META_MASK: the Meta modifier. Since 2.10
179 * @GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
180 * between (keyval, modifiers) pairs from key press and release events.
181 * @GDK_MODIFIER_MASK: a mask covering all modifier types.
183 * A set of bit-flags to indicate the state of modifier keys and mouse buttons
184 * in various event types. Typical modifier keys are Shift, Control, Meta,
185 * Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
187 * Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
189 * Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
190 * to Mod2 - Mod5, and indicates this by setting %GDK_SUPER_MASK,
191 * %GDK_HYPER_MASK or %GDK_META_MASK in the state field of key events.
193 * Note that GDK may add internal values to events which include
194 * reserved values such as %GDK_MODIFIER_RESERVED_13_MASK. Your code
195 * should preserve and ignore them. You can use %GDK_MODIFIER_MASK to
196 * remove all reserved values.
200 GDK_SHIFT_MASK = 1 << 0,
201 GDK_LOCK_MASK = 1 << 1,
202 GDK_CONTROL_MASK = 1 << 2,
203 GDK_MOD1_MASK = 1 << 3,
204 GDK_MOD2_MASK = 1 << 4,
205 GDK_MOD3_MASK = 1 << 5,
206 GDK_MOD4_MASK = 1 << 6,
207 GDK_MOD5_MASK = 1 << 7,
208 GDK_BUTTON1_MASK = 1 << 8,
209 GDK_BUTTON2_MASK = 1 << 9,
210 GDK_BUTTON3_MASK = 1 << 10,
211 GDK_BUTTON4_MASK = 1 << 11,
212 GDK_BUTTON5_MASK = 1 << 12,
214 GDK_MODIFIER_RESERVED_13_MASK = 1 << 13,
215 GDK_MODIFIER_RESERVED_14_MASK = 1 << 14,
216 GDK_MODIFIER_RESERVED_15_MASK = 1 << 15,
217 GDK_MODIFIER_RESERVED_16_MASK = 1 << 16,
218 GDK_MODIFIER_RESERVED_17_MASK = 1 << 17,
219 GDK_MODIFIER_RESERVED_18_MASK = 1 << 18,
220 GDK_MODIFIER_RESERVED_19_MASK = 1 << 19,
221 GDK_MODIFIER_RESERVED_20_MASK = 1 << 20,
222 GDK_MODIFIER_RESERVED_21_MASK = 1 << 21,
223 GDK_MODIFIER_RESERVED_22_MASK = 1 << 22,
224 GDK_MODIFIER_RESERVED_23_MASK = 1 << 23,
225 GDK_MODIFIER_RESERVED_24_MASK = 1 << 24,
226 GDK_MODIFIER_RESERVED_25_MASK = 1 << 25,
228 /* The next few modifiers are used by XKB, so we skip to the end.
229 * Bits 15 - 25 are currently unused. Bit 29 is used internally.
232 GDK_SUPER_MASK = 1 << 26,
233 GDK_HYPER_MASK = 1 << 27,
234 GDK_META_MASK = 1 << 28,
236 GDK_MODIFIER_RESERVED_29_MASK = 1 << 29,
238 GDK_RELEASE_MASK = 1 << 30,
240 /* Combination of GDK_SHIFT_MASK..GDK_BUTTON5_MASK + GDK_SUPER_MASK
241 + GDK_HYPER_MASK + GDK_META_MASK + GDK_RELEASE_MASK */
242 GDK_MODIFIER_MASK = 0x5c001fff
247 * @GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR: the primary modifier used to invoke
249 * @GDK_MODIFIER_INTENT_CONTEXT_MENU: the modifier used to invoke context menus.
250 * Note that mouse button 3 always triggers context menus. When this modifier
251 * is not 0, it <strong>additionally</strong> triggers context menus when used
252 * with mouse button 1.
253 * @GDK_MODIFIER_INTENT_EXTEND_SELECTION: the modifier used to extend selections
254 * using <modifier>-click or <modifier>-cursor-key
255 * @GDK_MODIFIER_INTENT_MODIFY_SELECTION: the modifier used to modify selections,
256 * which in most cases means toggling the clicked item into or out of the selection.
257 * @GDK_MODIFIER_INTENT_NO_TEXT_INPUT: when any of these modifiers is pressed, the
258 * key event cannot produce a symbol directly. This is meant to be used for
259 * input methods, and for use cases like typeahead search.
260 * @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
261 * groups (AltGr on X11/Windows and Option/Alt on OS X).
263 * This enum is used with gdk_keymap_get_modifier_mask() and
264 * gdk_get_modifier_mask() in order to determine what modifiers the
265 * currently used windowing system backend uses for particular
266 * purposes. For example, on X11/Windows, the Control key is used for
267 * invoking menu shortcuts (accelerators), whereas on Apple computers
268 * it's the Command key (which correspond to %GDK_CONTROL_MASK and
269 * %GDK_MOD2_MASK, respectively).
275 GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
276 GDK_MODIFIER_INTENT_CONTEXT_MENU,
277 GDK_MODIFIER_INTENT_EXTEND_SELECTION,
278 GDK_MODIFIER_INTENT_MODIFY_SELECTION,
279 GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
280 GDK_MODIFIER_INTENT_SHIFT_GROUP
287 GDK_ERROR_PARAM = -2,
294 * @GDK_GRAB_SUCCESS: the resource was successfully grabbed.
295 * @GDK_GRAB_ALREADY_GRABBED: the resource is actively grabbed by another client.
296 * @GDK_GRAB_INVALID_TIME: the resource was grabbed more recently than the
298 * @GDK_GRAB_NOT_VIEWABLE: the grab window or the @confine_to window are not
300 * @GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
302 * Returned by gdk_pointer_grab() and gdk_keyboard_grab() to indicate
303 * success or the reason for the failure of the grab attempt.
307 GDK_GRAB_SUCCESS = 0,
308 GDK_GRAB_ALREADY_GRABBED = 1,
309 GDK_GRAB_INVALID_TIME = 2,
310 GDK_GRAB_NOT_VIEWABLE = 3,
316 * @GDK_OWNERSHIP_NONE: All other devices' events are allowed.
317 * @GDK_OWNERSHIP_WINDOW: Other devices' events are blocked for the grab window.
318 * @GDK_OWNERSHIP_APPLICATION: Other devices' events are blocked for the whole application.
320 * Defines how device grabs interact with other devices.
325 GDK_OWNERSHIP_WINDOW,
326 GDK_OWNERSHIP_APPLICATION
331 * @GDK_EXPOSURE_MASK: receive expose events
332 * @GDK_POINTER_MOTION_MASK: receive all pointer motion events
333 * @GDK_POINTER_MOTION_HINT_MASK: see the explanation above
334 * @GDK_BUTTON_MOTION_MASK: receive pointer motion events while any button is pressed
335 * @GDK_BUTTON1_MOTION_MASK: receive pointer motion events while 1 button is pressed
336 * @GDK_BUTTON2_MOTION_MASK: receive pointer motion events while 2 button is pressed
337 * @GDK_BUTTON3_MOTION_MASK: receive pointer motion events while 3 button is pressed
338 * @GDK_BUTTON_PRESS_MASK: receive button press events
339 * @GDK_BUTTON_RELEASE_MASK: receive button release events
340 * @GDK_KEY_PRESS_MASK: receive key press events
341 * @GDK_KEY_RELEASE_MASK: receive key release events
342 * @GDK_ENTER_NOTIFY_MASK: receive window enter events
343 * @GDK_LEAVE_NOTIFY_MASK: receive window leave events
344 * @GDK_FOCUS_CHANGE_MASK: receive focus change events
345 * @GDK_STRUCTURE_MASK: receive events about window configuration change
346 * @GDK_PROPERTY_CHANGE_MASK: receive property change events
347 * @GDK_VISIBILITY_NOTIFY_MASK: receive visibility change events
348 * @GDK_PROXIMITY_IN_MASK: receive proximity in events
349 * @GDK_PROXIMITY_OUT_MASK: receive proximity out events
350 * @GDK_SUBSTRUCTURE_MASK: receive events about window configuration changes of
352 * @GDK_SCROLL_MASK: receive scroll events
353 * @GDK_ALL_EVENTS_MASK: the combination of all the above event masks.
355 * A set of bit-flags to indicate which events a window is to receive.
356 * Most of these masks map onto one or more of the #GdkEventType event types
359 * %GDK_POINTER_MOTION_HINT_MASK is a special mask which is used to reduce the
360 * number of %GDK_MOTION_NOTIFY events received. Normally a %GDK_MOTION_NOTIFY
361 * event is received each time the mouse moves. However, if the application
362 * spends a lot of time processing the event (updating the display, for example),
363 * it can lag behind the position of the mouse. When using
364 * %GDK_POINTER_MOTION_HINT_MASK, fewer %GDK_MOTION_NOTIFY events will be sent,
365 * some of which are marked as a hint (the is_hint member is %TRUE).
366 * To receive more motion events after a motion hint event, the application
367 * needs to asks for more, by calling gdk_event_request_motions().
371 GDK_EXPOSURE_MASK = 1 << 1,
372 GDK_POINTER_MOTION_MASK = 1 << 2,
373 GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
374 GDK_BUTTON_MOTION_MASK = 1 << 4,
375 GDK_BUTTON1_MOTION_MASK = 1 << 5,
376 GDK_BUTTON2_MOTION_MASK = 1 << 6,
377 GDK_BUTTON3_MOTION_MASK = 1 << 7,
378 GDK_BUTTON_PRESS_MASK = 1 << 8,
379 GDK_BUTTON_RELEASE_MASK = 1 << 9,
380 GDK_KEY_PRESS_MASK = 1 << 10,
381 GDK_KEY_RELEASE_MASK = 1 << 11,
382 GDK_ENTER_NOTIFY_MASK = 1 << 12,
383 GDK_LEAVE_NOTIFY_MASK = 1 << 13,
384 GDK_FOCUS_CHANGE_MASK = 1 << 14,
385 GDK_STRUCTURE_MASK = 1 << 15,
386 GDK_PROPERTY_CHANGE_MASK = 1 << 16,
387 GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
388 GDK_PROXIMITY_IN_MASK = 1 << 18,
389 GDK_PROXIMITY_OUT_MASK = 1 << 19,
390 GDK_SUBSTRUCTURE_MASK = 1 << 20,
391 GDK_SCROLL_MASK = 1 << 21,
392 GDK_ALL_EVENTS_MASK = 0x3FFFFE
397 * @x: the x coordinate of the point.
398 * @y: the y coordinate of the point.
400 * Defines the x and y coordinates of a point.
412 #endif /* __GDK_TYPES_H__ */