This is an automated email from the git hooks/post-receive script. olivier pushed a commit to branch xfce-4.12 in repository xfce/xfwm4.
commit 867ab66ceae1b75f9ea1df4591a1b73588221d89 Author: Olivier Fourdan <[email protected]> Date: Sat Apr 30 19:13:07 2016 +0200 keyboard: Ignore unsupported modifiers Bug: 10760 If a given keyboard modifier is not supported, ignore the shortcut. Signed-off-by: Olivier Fourdan <[email protected]> --- src/keyboard.c | 44 ++++++++++++++++++++++++++++++++------------ src/keyboard.h | 3 ++- src/settings.c | 6 +++++- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index fa35265..c32ed18 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -73,29 +73,44 @@ getKeycode (Display *dpy, const char *str) return XKeysymToKeycode (dpy, keysym); } -guint -getModifierMap (const char *str) +static gboolean +addModifierMap (guint *map, guint mask) { - guint map; + if (!mask) + { + return FALSE; + } + + *map |= mask; - gtk_accelerator_parse (str, NULL, &map); + return TRUE; +} - if ((map & GDK_SUPER_MASK) == GDK_SUPER_MASK) +gboolean +getModifierMap (const char *str, guint *map) +{ + gboolean ret; + + ret = TRUE; + gtk_accelerator_parse (str, NULL, map); + + ret = TRUE; + if ((*map & GDK_SUPER_MASK) == GDK_SUPER_MASK) { - map |= SuperMask; + ret &= addModifierMap (map, SuperMask); } - if ((map & GDK_HYPER_MASK) == GDK_HYPER_MASK) + if ((*map & GDK_HYPER_MASK) == GDK_HYPER_MASK) { - map |= HyperMask; + ret &= addModifierMap (map, HyperMask); } - if ((map & GDK_META_MASK) == GDK_META_MASK) + if ((*map & GDK_META_MASK) == GDK_META_MASK) { - map |= MetaMask; + ret &= addModifierMap (map, MetaMask); } - return map & MODIFIER_MASK & ~IGNORE_MASK; + return ret; } void @@ -119,8 +134,13 @@ parseKeyString (Display * dpy, MyKey * key, const char *str) return; } + if (!getModifierMap (str, &key->modifier)) + { + g_message (_("Unsupported keyboard modifier '%s'"), str); + key->modifier = 0; + return; + } key->keycode = getKeycode (dpy, str); - key->modifier = getModifierMap (str); TRACE ("keycode = 0x%x, modifier = 0x%x", key->keycode, key->modifier); } diff --git a/src/keyboard.h b/src/keyboard.h index f505832..1e8210b 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -45,7 +45,8 @@ extern unsigned int ScrollLockMask; extern unsigned int SuperMask; extern unsigned int HyperMask; -guint getModifierMap (const char *); +gboolean getModifierMap (const char *, + guint *); void parseKeyString (Display *, MyKey *, const char *); diff --git a/src/settings.c b/src/settings.c index 20348b0..ce2f8c0 100644 --- a/src/settings.c +++ b/src/settings.c @@ -155,7 +155,11 @@ set_easy_click (ScreenInfo *screen_info, const char *modifier) else { modstr = g_strdup_printf ("<%s>", modifier); - screen_info->params->easy_click = getModifierMap (modstr); + if (!getModifierMap (modstr, &screen_info->params->easy_click)) + { + g_message (_("Unsupported keyboard modifier '%s'"), modstr); + screen_info->params->easy_click = 0; + } g_free (modstr); } } -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list [email protected] https://mail.xfce.org/mailman/listinfo/xfce4-commits
