1 #include "../../kernel/openbox.h"
6 static guint translate_modifier(char *str)
8 if (!strcmp("Mod1", str) || !strcmp("A", str)) return Mod1Mask;
9 else if (!strcmp("Mod2", str)) return Mod2Mask;
10 else if (!strcmp("Mod3", str)) return Mod3Mask;
11 else if (!strcmp("Mod4", str) || !strcmp("W", str)) return Mod4Mask;
12 else if (!strcmp("Mod5", str)) return Mod5Mask;
13 else if (!strcmp("C", str)) return ControlMask;
14 else if (!strcmp("S", str)) return ShiftMask;
15 g_warning("Invalid modifier '%s' in binding.", str);
19 gboolean translate_button(char *str, guint *state, guint *button)
26 parsed = g_strsplit(str, "-", -1);
28 /* first, find the button (last token) */
30 for (i = 0; parsed[i] != NULL; ++i)
33 goto translation_fail;
35 /* figure out the mod mask */
37 for (i = 0; parsed[i] != l; ++i) {
38 guint m = translate_modifier(parsed[i]);
39 if (!m) goto translation_fail;
43 /* figure out the button */
46 g_warning("Invalid button '%s' in pointer binding.", l);
47 goto translation_fail;