diff options
Diffstat (limited to 'src/eggaccelerators.c')
-rw-r--r-- | src/eggaccelerators.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/eggaccelerators.c b/src/eggaccelerators.c index 3038ce9..63329a3 100644 --- a/src/eggaccelerators.c +++ b/src/eggaccelerators.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ #include "eggaccelerators.h" @@ -196,7 +196,7 @@ is_hyper (const gchar *string) * can represent various keyboard keys (numlock, meta, hyper, etc.), * the virtual modifier represents the keyboard key, the concrete * modifier the actual Mod2-Mod5 bits in the key press event. - * + * * Returns: %TRUE on success. */ gboolean @@ -208,7 +208,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, GdkModifierType mods; gint len; gboolean bad_keyval; - + if (accelerator_key) *accelerator_key = 0; if (accelerator_mods) @@ -217,7 +217,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, g_return_val_if_fail (accelerator != NULL, FALSE); bad_keyval = FALSE; - + keyval = 0; mods = 0; len = strlen (accelerator); @@ -300,7 +300,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, else { gchar last_ch; - + last_ch = *accelerator; while (last_ch && last_ch != '>') { @@ -313,15 +313,15 @@ egg_accelerator_parse_virtual (const gchar *accelerator, else { keyval = gdk_keyval_from_name (accelerator); - + if (keyval == 0) bad_keyval = TRUE; - + accelerator += len; - len -= len; + len -= len; } } - + if (accelerator_key) *accelerator_key = gdk_keyval_to_lower (keyval); if (accelerator_mods) @@ -336,7 +336,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, * @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, @@ -453,7 +453,7 @@ egg_virtual_accelerator_name (guint accelerator_key, strcpy (accelerator + l, text_super); l += sizeof (text_super) - 1; } - + strcpy (accelerator + l, keyval_name); return accelerator; @@ -470,11 +470,11 @@ egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap, g_return_if_fail (GDK_IS_KEYMAP (keymap)); g_return_if_fail (concrete_mods != NULL); - + modmap = egg_keymap_get_modmap (keymap); - + /* Not so sure about this algorithm. */ - + concrete = 0; i = 0; while (i < EGG_MODMAP_ENTRY_LAST) @@ -496,14 +496,14 @@ egg_keymap_virtualize_modifiers (GdkKeymap *keymap, GdkModifierType virtual; int i; const EggModmap *modmap; - + g_return_if_fail (GDK_IS_KEYMAP (keymap)); g_return_if_fail (virtual_mods != NULL); modmap = egg_keymap_get_modmap (keymap); - + /* Not so sure about this algorithm. */ - + virtual = 0; i = 0; while (i < EGG_MODMAP_ENTRY_LAST) @@ -511,12 +511,12 @@ egg_keymap_virtualize_modifiers (GdkKeymap *keymap, if ((1 << i) & concrete_mods) { EggVirtualModifierType cleaned; - + cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK | EGG_VIRTUAL_MOD3_MASK | EGG_VIRTUAL_MOD4_MASK | EGG_VIRTUAL_MOD5_MASK); - + if (cleaned != 0) { virtual |= cleaned; @@ -529,10 +529,10 @@ egg_keymap_virtualize_modifiers (GdkKeymap *keymap, virtual |= modmap->mapping[i]; } } - + ++i; } - + *virtual_mods = virtual; } @@ -548,7 +548,7 @@ reload_modmap (GdkKeymap *keymap, xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ()); memset (modmap->mapping, 0, sizeof (modmap->mapping)); - + /* there are 8 modifiers, and the first 3 are shift, shift lock, * and control */ @@ -565,7 +565,7 @@ reload_modmap (GdkKeymap *keymap, int n_entries; int j; EggVirtualModifierType mask; - + keys = NULL; keyvals = NULL; n_entries = 0; @@ -573,11 +573,11 @@ reload_modmap (GdkKeymap *keymap, gdk_keymap_get_entries_for_keycode (keymap, keycode, &keys, &keyvals, &n_entries); - + mask = 0; j = 0; while (j < n_entries) - { + { if (keyvals[j] == GDK_KEY_Num_Lock) mask |= EGG_VIRTUAL_NUM_LOCK_MASK; else if (keyvals[j] == GDK_KEY_Scroll_Lock) @@ -593,19 +593,19 @@ reload_modmap (GdkKeymap *keymap, mask |= EGG_VIRTUAL_SUPER_MASK; else if (keyvals[j] == GDK_KEY_Mode_switch) mask |= EGG_VIRTUAL_MODE_SWITCH_MASK; - + ++j; } /* Mod1Mask is 1 << 3 for example, i.e. the * fourth modifier, i / keyspermod is the modifier * index - */ + */ modmap->mapping[i/xmodmap->max_keypermod] |= mask; - + g_free (keyvals); - g_free (keys); - + g_free (keys); + ++i; } @@ -618,7 +618,7 @@ reload_modmap (GdkKeymap *keymap, modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK; modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK; modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK; - + XFreeModifiermap (xmodmap); } @@ -630,7 +630,7 @@ egg_keymap_get_modmap (GdkKeymap *keymap) /* This is all a hack, much simpler when we can just * modify GDK directly. */ - + modmap = g_object_get_data (G_OBJECT (keymap), "egg-modmap"); @@ -641,9 +641,9 @@ egg_keymap_get_modmap (GdkKeymap *keymap) /* FIXME modify keymap change events with an event filter * and force a reload if we get one */ - + reload_modmap (keymap, modmap); - + g_object_set_data_full (G_OBJECT (keymap), "egg-modmap", modmap, @@ -651,6 +651,6 @@ egg_keymap_get_modmap (GdkKeymap *keymap) } g_assert (modmap != NULL); - + return modmap; } |