Use xkb_led_index_t throughout And use XKB_LED_INVALID instead of _LED_Unbound, which served the same purpose here. Signed-off-by: Ran Benita <ran234@gmail.com>
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
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 501a816..2b31fe8 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -51,7 +51,7 @@ typedef struct _LEDInfo {
struct list entry;
xkb_atom_t name;
- unsigned char indicator;
+ xkb_led_index_t indicator;
unsigned char flags;
unsigned char which_mods;
unsigned char real_mods;
@@ -69,8 +69,6 @@ typedef struct _LEDInfo {
#define _LED_Automatic (1 << 5)
#define _LED_DrivesKbd (1 << 6)
-#define _LED_NotBound 255
-
typedef struct _GroupCompatInfo {
unsigned file_id;
enum merge_mode merge;
@@ -147,7 +145,7 @@ static void
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo * info)
{
info->name = xkb_atom_intern(ctx, "default");
- info->indicator = _LED_NotBound;
+ info->indicator = XKB_LED_INVALID;
info->flags = info->which_mods = info->real_mods = 0;
info->vmods = 0;
info->which_groups = info->groups = 0;
@@ -874,7 +872,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
return false;
}
- led->indicator = (unsigned char) ndx;
+ led->indicator = (xkb_led_index_t) ndx;
led->defined |= _LED_Index;
}
else {
@@ -1121,13 +1119,13 @@ CopyInterps(CompatInfo *info, bool needSymbol, unsigned pred)
static void
BindIndicators(CompatInfo *info, struct list *unbound_leds)
{
- int i;
+ xkb_led_index_t i;
LEDInfo *led, *next_led;
struct xkb_indicator_map *map;
struct xkb_keymap *keymap = info->keymap;
list_foreach(led, unbound_leds, entry) {
- if (led->indicator == _LED_NotBound) {
+ if (led->indicator == XKB_LED_INVALID) {
for (i = 0; i < XkbNumIndicators; i++) {
if (keymap->indicator_names[i] &&
streq(keymap->indicator_names[i],
@@ -1140,7 +1138,7 @@ BindIndicators(CompatInfo *info, struct list *unbound_leds)
}
list_foreach(led, unbound_leds, entry) {
- if (led->indicator == _LED_NotBound) {
+ if (led->indicator == XKB_LED_INVALID) {
for (i = 0; i < XkbNumIndicators; i++) {
if (keymap->indicator_names[i] == NULL) {
keymap->indicator_names[i] =
@@ -1150,7 +1148,7 @@ BindIndicators(CompatInfo *info, struct list *unbound_leds)
}
}
- if (led->indicator == _LED_NotBound) {
+ if (led->indicator == XKB_LED_INVALID) {
log_err(info->keymap->ctx,
"No unnamed indicators found; "
"Virtual indicator map \"%s\" not bound\n",
@@ -1161,7 +1159,7 @@ BindIndicators(CompatInfo *info, struct list *unbound_leds)
}
list_foreach_safe(led, next_led, unbound_leds, entry) {
- if (led->indicator == _LED_NotBound) {
+ if (led->indicator == XKB_LED_INVALID) {
free(led);
continue;
}
@@ -1210,7 +1208,7 @@ CopyIndicatorMapDefs(CompatInfo *info)
if (led->which_mods == 0 && (led->real_mods || led->vmods))
led->which_mods = XkbIM_UseEffective;
- if (led->indicator == _LED_NotBound) {
+ if (led->indicator == XKB_LED_INVALID) {
list_append(&led->entry, &unbound_leds);
continue;
}
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index cfd09a6..646a585 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -42,7 +42,7 @@ typedef struct _IndicatorNameInfo {
unsigned file_id;
struct list entry;
- int ndx;
+ xkb_led_index_t ndx;
xkb_atom_t name;
bool virtual;
} IndicatorNameInfo;
@@ -111,7 +111,7 @@ NextIndicatorName(KeyNamesInfo * info)
}
static IndicatorNameInfo *
-FindIndicatorByIndex(KeyNamesInfo * info, int ndx)
+FindIndicatorByIndex(KeyNamesInfo * info, xkb_led_index_t ndx)
{
IndicatorNameInfo *old;
@@ -716,7 +716,7 @@ HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
}
InitIndicatorNameInfo(&ii, info);
- ii.ndx = def->ndx;
+ ii.ndx = (xkb_led_index_t) def->ndx;
if (!ExprResolveString(info->keymap->ctx, def->name, &str)) {
char buf[20];