1 /* GDK - The GIMP Drawing Kit 2 * Copyright (C) 2000 Red Hat, Inc. 3 * 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. 8 * 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. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 /* 19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS 20 * file for a list of people on the GTK+ Team. See the ChangeLog 21 * files for a list of changes. These files are distributed with 22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 23 */ 24 25 #ifndef __GDK_KEYS_H__ 26 #define __GDK_KEYS_H__ 27 28 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION) 29 #error "Only <gdk/gdk.h> can be included directly." 30 #endif 31 32 #include <gdk/gdkversionmacros.h> 33 #include <gdk/gdktypes.h> 34 35 G_BEGIN_DECLS 36 37 38 typedef struct _GdkKeymapKey GdkKeymapKey; 39 40 /** 41 * GdkKeymapKey: 42 * @keycode: the hardware keycode. This is an identifying number for a 43 * physical key. 44 * @group: indicates movement in a horizontal direction. Usually groups are used 45 * for two different languages. In group 0, a key might have two English 46 * characters, and in group 1 it might have two Hebrew characters. The Hebrew 47 * characters will be printed on the key next to the English characters. 48 * @level: indicates which symbol on the key will be used, in a vertical direction. 49 * So on a standard US keyboard, the key with the number “1” on it also has the 50 * exclamation point ("!") character on it. The level indicates whether to use 51 * the “1” or the “!” symbol. The letter keys are considered to have a lowercase 52 * letter at level 0, and an uppercase letter at level 1, though only the 53 * uppercase letter is printed. 54 * 55 * A #GdkKeymapKey is a hardware key that can be mapped to a keyval. 56 */ 57 struct _GdkKeymapKey 58 { 59 guint keycode; 60 gint group; 61 gint level; 62 }; 63 64 65 #define GDK_TYPE_KEYMAP (gdk_keymap_get_type ()) 66 #define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap)) 67 #define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP)) 68 69 /** 70 * GdkKeymap: 71 * 72 * A #GdkKeymap defines the translation from keyboard state 73 * (including a hardware key, a modifier mask, and active keyboard group) 74 * to a keyval. This translation has two phases. The first phase is 75 * to determine the effective keyboard group and level for the keyboard 76 * state; the second phase is to look up the keycode/group/level triplet 77 * in the keymap and see what keyval it corresponds to. 78 */ 79 80 GDK_AVAILABLE_IN_ALL 81 GType gdk_keymap_get_type (void) G_GNUC_CONST; 82 83 GDK_DEPRECATED_IN_3_22_FOR(gdk_keymap_get_for_display) 84 GdkKeymap* gdk_keymap_get_default (void); 85 GDK_AVAILABLE_IN_ALL 86 GdkKeymap* gdk_keymap_get_for_display (GdkDisplay *display); 87 88 GDK_AVAILABLE_IN_ALL 89 guint gdk_keymap_lookup_key (GdkKeymap *keymap, 90 const GdkKeymapKey *key); 91 GDK_AVAILABLE_IN_ALL 92 gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap, 93 guint hardware_keycode, 94 GdkModifierType state, 95 gint group, 96 guint *keyval, 97 gint *effective_group, 98 gint *level, 99 GdkModifierType *consumed_modifiers); 100 GDK_AVAILABLE_IN_ALL 101 gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap, 102 guint keyval, 103 GdkKeymapKey **keys, 104 gint *n_keys); 105 GDK_AVAILABLE_IN_ALL 106 gboolean gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap, 107 guint hardware_keycode, 108 GdkKeymapKey **keys, 109 guint **keyvals, 110 gint *n_entries); 111 112 GDK_AVAILABLE_IN_ALL 113 PangoDirection gdk_keymap_get_direction (GdkKeymap *keymap); 114 GDK_AVAILABLE_IN_ALL 115 gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap); 116 GDK_AVAILABLE_IN_ALL 117 gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap); 118 GDK_AVAILABLE_IN_ALL 119 gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap); 120 GDK_AVAILABLE_IN_3_18 121 gboolean gdk_keymap_get_scroll_lock_state (GdkKeymap *keymap); 122 GDK_AVAILABLE_IN_3_4 123 guint gdk_keymap_get_modifier_state (GdkKeymap *keymap); 124 GDK_AVAILABLE_IN_ALL 125 void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap, 126 GdkModifierType *state); 127 GDK_AVAILABLE_IN_ALL 128 gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap, 129 GdkModifierType *state); 130 GDK_AVAILABLE_IN_3_4 131 GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap, 132 GdkModifierIntent intent); 133 134 135 /* Key values 136 */ 137 GDK_AVAILABLE_IN_ALL 138 gchar* gdk_keyval_name (guint keyval) G_GNUC_CONST; 139 140 GDK_AVAILABLE_IN_ALL 141 guint gdk_keyval_from_name (const gchar *keyval_name); 142 GDK_AVAILABLE_IN_ALL 143 void gdk_keyval_convert_case (guint symbol, 144 guint *lower, 145 guint *upper); 146 GDK_AVAILABLE_IN_ALL 147 guint gdk_keyval_to_upper (guint keyval) G_GNUC_CONST; 148 GDK_AVAILABLE_IN_ALL 149 guint gdk_keyval_to_lower (guint keyval) G_GNUC_CONST; 150 GDK_AVAILABLE_IN_ALL 151 gboolean gdk_keyval_is_upper (guint keyval) G_GNUC_CONST; 152 GDK_AVAILABLE_IN_ALL 153 gboolean gdk_keyval_is_lower (guint keyval) G_GNUC_CONST; 154 155 GDK_AVAILABLE_IN_ALL 156 guint32 gdk_keyval_to_unicode (guint keyval) G_GNUC_CONST; 157 GDK_AVAILABLE_IN_ALL 158 guint gdk_unicode_to_keyval (guint32 wc) G_GNUC_CONST; 159 160 161 G_END_DECLS 162 163 #endif /* __GDK_KEYS_H__ */ 164