diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/eggaccelerators.c | 129 | ||||
-rw-r--r-- | src/eggaccelerators.h | 3 |
2 files changed, 0 insertions, 132 deletions
diff --git a/src/eggaccelerators.c b/src/eggaccelerators.c index 63329a3..6043661 100644 --- a/src/eggaccelerators.c +++ b/src/eggaccelerators.c @@ -330,135 +330,6 @@ egg_accelerator_parse_virtual (const gchar *accelerator, return !bad_keyval; } - -/** - * egg_virtual_accelerator_name: - * @accelerator_key: accelerator keyval - * @accelerator_mods: accelerator modifier mask - * @returns: a newly-allocated accelerator name - * - * Converts an accelerator keyval and modifier mask - * into a string parseable by egg_accelerator_parse_virtual(). - * For example, if you pass in #GDK_q and #EGG_VIRTUAL_CONTROL_MASK, - * this function returns "<Control>q". - * - * The caller of this function must free the returned string. - */ -gchar* -egg_virtual_accelerator_name (guint accelerator_key, - EggVirtualModifierType accelerator_mods) -{ - static const gchar text_release[] = "<Release>"; - static const gchar text_shift[] = "<Shift>"; - static const gchar text_control[] = "<Control>"; - static const gchar text_mod1[] = "<Alt>"; - static const gchar text_mod2[] = "<Mod2>"; - static const gchar text_mod3[] = "<Mod3>"; - static const gchar text_mod4[] = "<Mod4>"; - static const gchar text_mod5[] = "<Mod5>"; - static const gchar text_meta[] = "<Meta>"; - static const gchar text_super[] = "<Super>"; - static const gchar text_hyper[] = "<Hyper>"; - guint l; - gchar *keyval_name; - gchar *accelerator; - - accelerator_mods &= EGG_VIRTUAL_MODIFIER_MASK; - - keyval_name = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key)); - if (!keyval_name) - keyval_name = ""; - - l = 0; - if (accelerator_mods & EGG_VIRTUAL_RELEASE_MASK) - l += sizeof (text_release) - 1; - if (accelerator_mods & EGG_VIRTUAL_SHIFT_MASK) - l += sizeof (text_shift) - 1; - if (accelerator_mods & EGG_VIRTUAL_CONTROL_MASK) - l += sizeof (text_control) - 1; - if (accelerator_mods & EGG_VIRTUAL_ALT_MASK) - l += sizeof (text_mod1) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD2_MASK) - l += sizeof (text_mod2) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD3_MASK) - l += sizeof (text_mod3) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD4_MASK) - l += sizeof (text_mod4) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD5_MASK) - l += sizeof (text_mod5) - 1; - if (accelerator_mods & EGG_VIRTUAL_META_MASK) - l += sizeof (text_meta) - 1; - if (accelerator_mods & EGG_VIRTUAL_HYPER_MASK) - l += sizeof (text_hyper) - 1; - if (accelerator_mods & EGG_VIRTUAL_SUPER_MASK) - l += sizeof (text_super) - 1; - l += strlen (keyval_name); - - accelerator = g_new (gchar, l + 1); - - l = 0; - accelerator[l] = 0; - if (accelerator_mods & EGG_VIRTUAL_RELEASE_MASK) - { - strcpy (accelerator + l, text_release); - l += sizeof (text_release) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_SHIFT_MASK) - { - strcpy (accelerator + l, text_shift); - l += sizeof (text_shift) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_CONTROL_MASK) - { - strcpy (accelerator + l, text_control); - l += sizeof (text_control) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_ALT_MASK) - { - strcpy (accelerator + l, text_mod1); - l += sizeof (text_mod1) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD2_MASK) - { - strcpy (accelerator + l, text_mod2); - l += sizeof (text_mod2) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD3_MASK) - { - strcpy (accelerator + l, text_mod3); - l += sizeof (text_mod3) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD4_MASK) - { - strcpy (accelerator + l, text_mod4); - l += sizeof (text_mod4) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD5_MASK) - { - strcpy (accelerator + l, text_mod5); - l += sizeof (text_mod5) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_META_MASK) - { - strcpy (accelerator + l, text_meta); - l += sizeof (text_meta) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_HYPER_MASK) - { - strcpy (accelerator + l, text_hyper); - l += sizeof (text_hyper) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_SUPER_MASK) - { - strcpy (accelerator + l, text_super); - l += sizeof (text_super) - 1; - } - - strcpy (accelerator + l, keyval_name); - - return accelerator; -} - void egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap, EggVirtualModifierType virtual_mods, diff --git a/src/eggaccelerators.h b/src/eggaccelerators.h index 1da4a07..5cc86ea 100644 --- a/src/eggaccelerators.h +++ b/src/eggaccelerators.h @@ -76,9 +76,6 @@ void egg_keymap_virtualize_modifiers (GdkKeymap *keymap, GdkModifierType concrete_mods, EggVirtualModifierType *virtual_mods); -gchar* egg_virtual_accelerator_name (guint accelerator_key, - EggVirtualModifierType accelerator_mods); - G_END_DECLS |