kbproto unentanglement: Xkb{Wrap,Clamp,Redirect}IntoRange Signed-off-by: Daniel Stone <daniel@fooishbar.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index 0a478f2..0c5e49a 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -681,14 +681,17 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf)
}
switch (key->out_of_range_group_action) {
- case XkbClampIntoRange:
+ case RANGE_SATURATE:
write_buf(buf, "\n\t\t\tgroupsClamp,");
break;
- case XkbRedirectIntoRange:
+ case RANGE_REDIRECT:
write_buf(buf, "\n\t\t\tgroupsRedirect= Group%u,",
key->out_of_range_group_number + 1);
break;
+
+ default:
+ break;
}
if (key->explicit & XkbExplicitInterpretMask)
diff --git a/src/map.c b/src/map.c
index 8b751e6..384ff22 100644
--- a/src/map.c
+++ b/src/map.c
@@ -335,17 +335,17 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc)
return ret;
switch (key->out_of_range_group_action) {
- case XkbRedirectIntoRange:
+ case RANGE_REDIRECT:
ret = key->out_of_range_group_number;
if (ret >= key->num_groups)
ret = 0;
break;
- case XkbClampIntoRange:
+ case RANGE_SATURATE:
ret = key->num_groups - 1;
break;
- case XkbWrapIntoRange:
+ case RANGE_WRAP:
default:
ret %= key->num_groups;
break;
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 95f1348..ae0aef0 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -298,6 +298,13 @@ struct xkb_controls {
unsigned int axt_ctrls_values;
};
+/* Such an awkward name. Oh well. */
+enum xkb_range_exceed_type {
+ RANGE_SATURATE,
+ RANGE_WRAP,
+ RANGE_REDIRECT,
+};
+
struct xkb_key {
char name[XKB_KEY_NAME_LENGTH];
@@ -316,7 +323,7 @@ struct xkb_key {
/* How many levels the largest group has. */
xkb_level_index_t width;
- uint8_t out_of_range_group_action;
+ enum xkb_range_exceed_type out_of_range_group_action;
xkb_group_index_t out_of_range_group_number;
/* per level/group index into 'syms' */
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index f9cbe92..91b63d4 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -85,7 +85,7 @@ typedef struct _KeyInfo {
xkb_mod_mask_t vmodmap;
xkb_atom_t dfltType;
- uint8_t out_of_range_group_action;
+ enum xkb_range_exceed_type out_of_range_group_action;
xkb_group_index_t out_of_range_group_number;
} KeyInfo;
@@ -116,7 +116,7 @@ InitKeyInfo(KeyInfo *keyi, unsigned file_id)
keyi->dfltType = XKB_ATOM_NONE;
keyi->vmodmap = 0;
keyi->repeat = KEY_REPEAT_UNDEFINED;
- keyi->out_of_range_group_action = 0;
+ keyi->out_of_range_group_action = RANGE_WRAP;
keyi->out_of_range_group_number = 0;
}
@@ -1128,9 +1128,9 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
}
if (set)
- keyi->out_of_range_group_action = XkbWrapIntoRange;
+ keyi->out_of_range_group_action = RANGE_WRAP;
else
- keyi->out_of_range_group_action = XkbClampIntoRange;
+ keyi->out_of_range_group_action = RANGE_SATURATE;
keyi->defined |= KEY_FIELD_GROUPINFO;
}
@@ -1147,9 +1147,9 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
}
if (set)
- keyi->out_of_range_group_action = XkbClampIntoRange;
+ keyi->out_of_range_group_action = RANGE_SATURATE;
else
- keyi->out_of_range_group_action = XkbWrapIntoRange;
+ keyi->out_of_range_group_action = RANGE_WRAP;
keyi->defined |= KEY_FIELD_GROUPINFO;
}
@@ -1165,7 +1165,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
return false;
}
- keyi->out_of_range_group_action = XkbRedirectIntoRange;
+ keyi->out_of_range_group_action = RANGE_REDIRECT;
keyi->out_of_range_group_number = grp - 1;
keyi->defined |= KEY_FIELD_GROUPINFO;
}
@@ -1805,10 +1805,8 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
key->explicit |= XkbExplicitInterpretMask;
}
- if (keyi->defined & KEY_FIELD_GROUPINFO) {
- key->out_of_range_group_number = keyi->out_of_range_group_number;
- key->out_of_range_group_action = keyi->out_of_range_group_action;
- }
+ key->out_of_range_group_number = keyi->out_of_range_group_number;
+ key->out_of_range_group_action = keyi->out_of_range_group_action;
for (i = 0; i < nGroups; i++) {
/* assign kt_index[i] to the index of the type in map->types.