From 3e01e149eb58177405d2aea84ffb057f924cd128 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Mon, 27 Feb 2006 22:44:47 +0000 Subject: Patch from Thomas Thurman to prevent setting cycle_windows to keybindings 2006-02-27 Elijah Newren Patch from Thomas Thurman to prevent setting cycle_windows to keybindings that won't work. #329676 * src/prefs.c (update_binding): Make sure that bindings which require a modifier key are set to a keybinding with one or else that the binding is reverted. * src/ui.[ch] (meta_ui_accelerator_name): New function --- src/ui.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/ui.c') diff --git a/src/ui.c b/src/ui.c index 3640cb0f..3f10044c 100644 --- a/src/ui.c +++ b/src/ui.c @@ -788,6 +788,43 @@ meta_ui_parse_accelerator (const char *accel, return TRUE; } +/* Caller responsible for freeing return string of meta_ui_accelerator_name! */ +gchar* +meta_ui_accelerator_name (unsigned int keysym, + MetaVirtualModifier mask) +{ + EggVirtualModifierType mods = 0; + + if (keysym == 0 && mask == 0) + { + return strdup ("disabled"); + } + + if (mask & META_VIRTUAL_SHIFT_MASK) + mods |= EGG_VIRTUAL_SHIFT_MASK; + if (mask & META_VIRTUAL_CONTROL_MASK) + mods |= EGG_VIRTUAL_CONTROL_MASK; + if (mask & META_VIRTUAL_ALT_MASK) + mods |= EGG_VIRTUAL_ALT_MASK; + if (mask & META_VIRTUAL_MOD2_MASK) + mods |= EGG_VIRTUAL_MOD2_MASK; + if (mask & META_VIRTUAL_MOD3_MASK) + mods |= EGG_VIRTUAL_MOD3_MASK; + if (mask & META_VIRTUAL_MOD4_MASK) + mods |= EGG_VIRTUAL_MOD4_MASK; + if (mask & META_VIRTUAL_MOD5_MASK) + mods |= EGG_VIRTUAL_MOD5_MASK; + if (mask & META_VIRTUAL_SUPER_MASK) + mods |= EGG_VIRTUAL_SUPER_MASK; + if (mask & META_VIRTUAL_HYPER_MASK) + mods |= EGG_VIRTUAL_HYPER_MASK; + if (mask & META_VIRTUAL_META_MASK) + mods |= EGG_VIRTUAL_META_MASK; + + return egg_virtual_accelerator_name (keysym, mods); + +} + gboolean meta_ui_parse_modifier (const char *accel, MetaVirtualModifier *mask) -- cgit v1.2.1