diff options
author | Havoc Pennington <hp@pobox.com> | 2000-12-06 05:31:30 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-12-06 05:31:30 +0000 |
commit | 36aac0177bfe4dfed46cfcf8568256fe5b05f9b0 (patch) | |
tree | 5091a09100b1743bf733d47dde7db34e9b673fc6 /gdk/gdkkeys.h | |
parent | 3bc53c742d676a974987ad084f8617a1ab6068fd (diff) | |
download | gtk+-36aac0177bfe4dfed46cfcf8568256fe5b05f9b0.tar.gz |
add gdkkeys.[hc]
2000-12-03 Havoc Pennington <hp@pobox.com>
* gdk/Makefile.am: add gdkkeys.[hc]
* gdk/gdkkeys.h, gdk/gdkkeys.c: Move all the keyval stuff to these
files from gdk.h, gdk.c; add GdkKeymap type and operations on it.
* acconfig.h, configure.in: add checks and command line options
for XKB
* gdk/x11/gdkkeys-x11.c: Implement the above functions
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Put the keycode
and group in the key event
* gdk/gdkevents.h (struct _GdkEventKey): Add a hardware_keycode
field with the low-level hardware key code, and a group
field with the keyboard group
* gdk/x11/gdkprivate-x11.h: include config.h for HAVE_XKB,
and declare a couple globals used for keymap handling
* gtk/gtkimcontextsimple.c: Implement ISO 14755 input method,
hold down Shift-Control and type a hex number to get a Unicode
character corresponding to the hex number
(gtk_im_context_simple_get_preedit_string): Fix cursor position
(return bytes not chars)
Diffstat (limited to 'gdk/gdkkeys.h')
-rw-r--r-- | gdk/gdkkeys.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/gdk/gdkkeys.h b/gdk/gdkkeys.h new file mode 100644 index 0000000000..20d50348cd --- /dev/null +++ b/gdk/gdkkeys.h @@ -0,0 +1,120 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GDK_KEYS_H__ +#define __GDK_KEYS_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _GdkKeymapKey GdkKeymapKey; + +/* GdkKeymapKey is a hardware key that can be mapped to a keyval */ +struct _GdkKeymapKey +{ + guint keycode; + gint group; + gint level; +}; + +/* A GdkKeymap defines the translation from keyboard state + * (including a hardware key, a modifier mask, and active keyboard group) + * to a keyval. This translation has two phases. The first phase is + * to determine the effective keyboard group and level for the keyboard + * state; the second phase is to look up the keycode/group/level triplet + * in the keymap and see what keyval it corresponds to. + */ + +typedef struct _GdkKeymap GdkKeymap; +typedef struct _GdkKeymapClass GdkKeymapClass; + +#define GDK_TYPE_KEYMAP (gdk_keymap_get_type ()) +#define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap)) +#define GDK_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_KEYMAP, GdkKeymapClass)) +#define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP)) +#define GDK_IS_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_KEYMAP)) +#define GDK_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_KEYMAP, GdkKeymapClass)) + + +struct _GdkKeymap +{ + GObject parent_instance; +}; + +struct _GdkKeymapClass +{ + GObjectClass parent_class; +}; + +GType gdk_keymap_get_type (void) G_GNUC_CONST; + +GdkKeymap* gdk_keymap_get_default (void); + + +guint gdk_keymap_lookup_key (GdkKeymap *keymap, + const GdkKeymapKey *key); +gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap, + guint hardware_keycode, + GdkModifierType state, + gint group, + guint *keyval, + gint *effective_group, + gint *level, + GdkModifierType *unused_modifiers); +gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap, + guint keyval, + GdkKeymapKey **keys, + gint *n_keys); +gboolean gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap, + guint hardware_keycode, + GdkKeymapKey **keys, + guint **keyvals, + gint *n_entries); + +/* Key values + */ +gchar* gdk_keyval_name (guint keyval) G_GNUC_CONST; +guint gdk_keyval_from_name (const gchar *keyval_name); +void gdk_keyval_convert_case (guint symbol, + guint *lower, + guint *upper); +guint gdk_keyval_to_upper (guint keyval) G_GNUC_CONST; +guint gdk_keyval_to_lower (guint keyval) G_GNUC_CONST; +gboolean gdk_keyval_is_upper (guint keyval) G_GNUC_CONST; +gboolean gdk_keyval_is_lower (guint keyval) G_GNUC_CONST; + +guint32 gdk_keyval_to_unicode (guint keyval) G_GNUC_CONST; +guint gdk_unicode_to_keyval (guint32 wc) G_GNUC_CONST; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_KEYS_H__ */ |