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>
master
Ran Benita 2012-07-28 23:21:46 +03:00
parent 09dac54b97
commit 82ee45b374
2 changed files with 12 additions and 14 deletions

View File

@ -51,7 +51,7 @@ typedef struct _LEDInfo {
struct list entry; struct list entry;
xkb_atom_t name; xkb_atom_t name;
unsigned char indicator; xkb_led_index_t indicator;
unsigned char flags; unsigned char flags;
unsigned char which_mods; unsigned char which_mods;
unsigned char real_mods; unsigned char real_mods;
@ -69,8 +69,6 @@ typedef struct _LEDInfo {
#define _LED_Automatic (1 << 5) #define _LED_Automatic (1 << 5)
#define _LED_DrivesKbd (1 << 6) #define _LED_DrivesKbd (1 << 6)
#define _LED_NotBound 255
typedef struct _GroupCompatInfo { typedef struct _GroupCompatInfo {
unsigned file_id; unsigned file_id;
enum merge_mode merge; enum merge_mode merge;
@ -147,7 +145,7 @@ static void
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo * info) ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo * info)
{ {
info->name = xkb_atom_intern(ctx, "default"); 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->flags = info->which_mods = info->real_mods = 0;
info->vmods = 0; info->vmods = 0;
info->which_groups = info->groups = 0; info->which_groups = info->groups = 0;
@ -874,7 +872,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
return false; return false;
} }
led->indicator = (unsigned char) ndx; led->indicator = (xkb_led_index_t) ndx;
led->defined |= _LED_Index; led->defined |= _LED_Index;
} }
else { else {
@ -1121,13 +1119,13 @@ CopyInterps(CompatInfo *info, bool needSymbol, unsigned pred)
static void static void
BindIndicators(CompatInfo *info, struct list *unbound_leds) BindIndicators(CompatInfo *info, struct list *unbound_leds)
{ {
int i; xkb_led_index_t i;
LEDInfo *led, *next_led; LEDInfo *led, *next_led;
struct xkb_indicator_map *map; struct xkb_indicator_map *map;
struct xkb_keymap *keymap = info->keymap; struct xkb_keymap *keymap = info->keymap;
list_foreach(led, unbound_leds, entry) { list_foreach(led, unbound_leds, entry) {
if (led->indicator == _LED_NotBound) { if (led->indicator == XKB_LED_INVALID) {
for (i = 0; i < XkbNumIndicators; i++) { for (i = 0; i < XkbNumIndicators; i++) {
if (keymap->indicator_names[i] && if (keymap->indicator_names[i] &&
streq(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) { list_foreach(led, unbound_leds, entry) {
if (led->indicator == _LED_NotBound) { if (led->indicator == XKB_LED_INVALID) {
for (i = 0; i < XkbNumIndicators; i++) { for (i = 0; i < XkbNumIndicators; i++) {
if (keymap->indicator_names[i] == NULL) { if (keymap->indicator_names[i] == NULL) {
keymap->indicator_names[i] = 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, log_err(info->keymap->ctx,
"No unnamed indicators found; " "No unnamed indicators found; "
"Virtual indicator map \"%s\" not bound\n", "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) { list_foreach_safe(led, next_led, unbound_leds, entry) {
if (led->indicator == _LED_NotBound) { if (led->indicator == XKB_LED_INVALID) {
free(led); free(led);
continue; continue;
} }
@ -1210,7 +1208,7 @@ CopyIndicatorMapDefs(CompatInfo *info)
if (led->which_mods == 0 && (led->real_mods || led->vmods)) if (led->which_mods == 0 && (led->real_mods || led->vmods))
led->which_mods = XkbIM_UseEffective; led->which_mods = XkbIM_UseEffective;
if (led->indicator == _LED_NotBound) { if (led->indicator == XKB_LED_INVALID) {
list_append(&led->entry, &unbound_leds); list_append(&led->entry, &unbound_leds);
continue; continue;
} }

View File

@ -42,7 +42,7 @@ typedef struct _IndicatorNameInfo {
unsigned file_id; unsigned file_id;
struct list entry; struct list entry;
int ndx; xkb_led_index_t ndx;
xkb_atom_t name; xkb_atom_t name;
bool virtual; bool virtual;
} IndicatorNameInfo; } IndicatorNameInfo;
@ -111,7 +111,7 @@ NextIndicatorName(KeyNamesInfo * info)
} }
static IndicatorNameInfo * static IndicatorNameInfo *
FindIndicatorByIndex(KeyNamesInfo * info, int ndx) FindIndicatorByIndex(KeyNamesInfo * info, xkb_led_index_t ndx)
{ {
IndicatorNameInfo *old; IndicatorNameInfo *old;
@ -716,7 +716,7 @@ HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
} }
InitIndicatorNameInfo(&ii, info); InitIndicatorNameInfo(&ii, info);
ii.ndx = def->ndx; ii.ndx = (xkb_led_index_t) def->ndx;
if (!ExprResolveString(info->keymap->ctx, def->name, &str)) { if (!ExprResolveString(info->keymap->ctx, def->name, &str)) {
char buf[20]; char buf[20];