Commit 830fe67132e9b3ca30fb36e84301b329fea9c653

Daniel Stone 2012-09-10T20:07:54

kbproto unentanglement: XkbIM_* Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index 9217877..cca6313 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -169,8 +169,6 @@ get_indicator_state_text(uint8_t which)
 
     memset(ret, 0, GET_TEXT_BUF_SIZE);
 
-    which &= XkbIM_UseAnyMods;
-
     if (which == 0) {
         strcpy(ret, "0");
         return NULL;
@@ -343,7 +341,7 @@ write_indicator_map(struct xkb_keymap *keymap, struct buf *buf, int num)
               xkb_atom_text(keymap->ctx, keymap->indicators[num].name));
 
     if (led->which_groups) {
-        if (led->which_groups != XkbIM_UseEffective) {
+        if (led->which_groups != XKB_STATE_EFFECTIVE) {
             write_buf(buf, "\t\t\twhichGroupState= %s;\n",
                       get_indicator_state_text(led->which_groups));
         }
@@ -352,7 +350,7 @@ write_indicator_map(struct xkb_keymap *keymap, struct buf *buf, int num)
     }
 
     if (led->which_mods) {
-        if (led->which_mods != XkbIM_UseEffective) {
+        if (led->which_mods != XKB_STATE_EFFECTIVE) {
             write_buf(buf, "\t\t\twhichModState= %s;\n",
                       get_indicator_state_text(led->which_mods));
         }
diff --git a/src/state.c b/src/state.c
index 99ad6dc..d62677c 100644
--- a/src/state.c
+++ b/src/state.c
@@ -555,30 +555,24 @@ xkb_state_led_update_all(struct xkb_state *state)
         xkb_mod_mask_t mod_mask = 0;
         uint32_t group_mask = 0;
 
-        if (map->which_mods & XkbIM_UseAnyMods) {
-            if (map->which_mods & XkbIM_UseBase)
-                mod_mask |= state->base_mods;
-            if (map->which_mods & XkbIM_UseLatched)
-                mod_mask |= state->latched_mods;
-            if (map->which_mods & XkbIM_UseLocked)
-                mod_mask |= state->locked_mods;
-            if (map->which_mods & XkbIM_UseEffective)
-                mod_mask |= state->mods;
-            if ((map->mods.mask & mod_mask))
-                state->leds |= (1 << led);
-        }
-        if (map->which_groups & XkbIM_UseAnyGroup) {
-            if (map->which_groups & XkbIM_UseBase)
-                group_mask |= (1 << state->base_group);
-            if (map->which_groups & XkbIM_UseLatched)
-                group_mask |= (1 << state->latched_group);
-            if (map->which_groups & XkbIM_UseLocked)
-                group_mask |= (1 << state->locked_group);
-            if (map->which_groups & XkbIM_UseEffective)
-                group_mask |= (1 << state->group);
-            if ((map->groups & group_mask))
-                state->leds |= (1 << led);
-        }
+        if (map->which_mods & XKB_STATE_DEPRESSED)
+            mod_mask |= state->base_mods;
+        if (map->which_mods & XKB_STATE_LATCHED)
+            mod_mask |= state->latched_mods;
+        if (map->which_mods & XKB_STATE_LOCKED)
+            mod_mask |= state->locked_mods;
+        if ((map->mods.mask & mod_mask))
+            state->leds |= (1 << led);
+
+        if (map->which_groups & XKB_STATE_DEPRESSED)
+            group_mask |= (1 << state->base_group);
+        if (map->which_groups & XKB_STATE_LATCHED)
+            group_mask |= (1 << state->latched_group);
+        if (map->which_groups & XKB_STATE_LOCKED)
+            group_mask |= (1 << state->locked_group);
+        if ((map->groups & group_mask))
+            state->leds |= (1 << led);
+
         if (map->ctrls) {
             if ((map->ctrls & state->keymap->enabled_ctrls))
                 state->leds |= (1 << led);
diff --git a/src/text.c b/src/text.c
index dca89e3..2422e02 100644
--- a/src/text.c
+++ b/src/text.c
@@ -79,22 +79,22 @@ const LookupEntry ctrlMaskNames[] = {
 };
 
 const LookupEntry modComponentMaskNames[] = {
-    {"base", XkbIM_UseBase},
-    {"latched", XkbIM_UseLatched},
-    {"locked", XkbIM_UseLocked},
-    {"effective", XkbIM_UseEffective},
-    {"compat", XkbIM_UseCompat},
-    {"any", XkbIM_UseAnyMods},
+    {"base", XKB_STATE_DEPRESSED},
+    {"latched", XKB_STATE_LATCHED},
+    {"locked", XKB_STATE_LOCKED},
+    {"effective", XKB_STATE_EFFECTIVE},
+    {"compat", XKB_STATE_EFFECTIVE},
+    {"any", XKB_STATE_EFFECTIVE},
     {"none", 0},
     {NULL, 0}
 };
 
 const LookupEntry groupComponentMaskNames[] = {
-    {"base", XkbIM_UseBase},
-    {"latched", XkbIM_UseLatched},
-    {"locked", XkbIM_UseLocked},
-    {"effective", XkbIM_UseEffective},
-    {"any", XkbIM_UseAnyGroup},
+    {"base", XKB_STATE_DEPRESSED},
+    {"latched", XKB_STATE_LATCHED},
+    {"locked", XKB_STATE_LOCKED},
+    {"effective", XKB_STATE_EFFECTIVE},
+    {"any", XKB_STATE_EFFECTIVE},
     {"none", 0},
     {NULL, 0}
 };
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index c79e64a..d9ec6a0 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -256,9 +256,9 @@ struct xkb_sym_interpret {
 
 struct xkb_indicator_map {
     xkb_atom_t name;
-    unsigned char which_groups;
+    enum xkb_state_component which_groups;
     uint32_t groups;
-    unsigned char which_mods;
+    enum xkb_state_component which_mods;
     struct xkb_mods mods;
     unsigned int ctrls;
 };
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 5ae80ab..f0a61b3 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -976,9 +976,9 @@ CopyIndicatorMapDefs(CompatInfo *info)
         im = &keymap->indicators[i];
         *im  = led->im;
         if (im->groups != 0 && im->which_groups == 0)
-            im->which_groups = XkbIM_UseEffective;
+            im->which_groups = XKB_STATE_EFFECTIVE;
         if (im->mods.mods != 0 && im->which_mods == 0)
-            im->which_mods = XkbIM_UseEffective;
+            im->which_mods = XKB_STATE_EFFECTIVE;
     }
 }