Commit c1ea23da5c48f25faddcc7d52da9a1f5dcf28fee

Ran Benita 2012-08-04T10:47:56

symbols: remove support for key behaviors The possible key behaviors are: KB_RadioGroup, KB_Overlay1, KB_Overlay2: already removed support for these. KB_Lock (with or without KB_Permanent): used to ignore key presses or releases to simulate and deal with some legacy keyboard behaviors (like keys that physically lock). Not used at all. We already ignore them while processing key events in state.c, so make it official. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/README b/README
index 2089b38..5f2d57c 100644
--- a/README
+++ b/README
@@ -79,6 +79,9 @@ Notable removals:
       + completely unused in current keymaps, never fully implemented
     - overlays
       + almost completely unused in current keymaps
+    - key behaviors
+      + used to implement radio groups and overlays, and to deal with things
+        like keys that physically lock; unused in current keymaps
     - indicator behaviours such as LED-controls-key
       + the only supported LED behaviour is key-controls-LED; again this
         was never really used in current keymaps
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index f570665..e4f99d2 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -265,11 +265,6 @@ struct xkb_sym_interpret {
     union xkb_action act;
 };
 
-struct xkb_behavior {
-    unsigned char type;
-    unsigned char data;
-};
-
 struct xkb_indicator_map {
     unsigned char flags;
     unsigned char which_groups;
@@ -308,8 +303,6 @@ struct xkb_key {
     unsigned char modmap;
     xkb_mod_mask_t vmodmap;
 
-    struct xkb_behavior behavior;
-
     bool repeats;
 
     /* Index into keymap->acts */
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 662b6c1..2761221 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -1440,9 +1440,6 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, struct xkb_key *key)
                 if (!(key->explicit & XkbExplicitAutoRepeatMask) &&
                     (!interp || (interp->flags & XkbSI_AutoRepeat)))
                     key->repeats = true;
-                if (!(key->explicit & XkbExplicitBehaviorMask) &&
-                    interp && (interp->flags & XkbSI_LockingKey))
-                    key->behavior.type = XkbKB_Lock;
             }
 
             if (!interp)
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index cda40d4..3a56082 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -45,11 +45,10 @@ enum key_field {
     KEY_FIELD_SYMS      = (1 << 0),
     KEY_FIELD_ACTS      = (1 << 1),
     KEY_FIELD_REPEAT    = (1 << 2),
-    KEY_FIELD_BEHAVIOR  = (1 << 3),
-    KEY_FIELD_TYPE_DFLT = (1 << 4),
-    KEY_FIELD_TYPES     = (1 << 5),
-    KEY_FIELD_GROUPINFO = (1 << 6),
-    KEY_FIELD_VMODMAP   = (1 << 7),
+    KEY_FIELD_TYPE_DFLT = (1 << 3),
+    KEY_FIELD_TYPES     = (1 << 4),
+    KEY_FIELD_GROUPINFO = (1 << 5),
+    KEY_FIELD_VMODMAP   = (1 << 6),
 };
 
 typedef struct _KeyInfo {
@@ -82,7 +81,6 @@ typedef struct _KeyInfo {
 
     xkb_atom_t types[XkbNumKbdGroups];
     enum key_repeat repeat;
-    struct xkb_behavior behavior;
     unsigned short vmodmap;
     xkb_atom_t dfltType;
 
@@ -115,8 +113,6 @@ InitKeyInfo(KeyInfo *keyi, unsigned file_id)
     }
 
     keyi->dfltType = XKB_ATOM_NONE;
-    keyi->behavior.type = XkbKB_Default;
-    keyi->behavior.data = 0;
     keyi->vmodmap = 0;
     keyi->repeat = KEY_REPEAT_UNDEFINED;
     keyi->out_of_range_group_action = 0;
@@ -581,10 +577,6 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
         }
     }
 
-    if (UseNewKeyField(KEY_FIELD_BEHAVIOR, into, from, verbosity, &collide)) {
-        into->behavior = from->behavior;
-        into->defined |= KEY_FIELD_BEHAVIOR;
-    }
     if (UseNewKeyField(KEY_FIELD_VMODMAP, into, from, verbosity, &collide)) {
         into->vmodmap = from->vmodmap;
         into->defined |= KEY_FIELD_VMODMAP;
@@ -993,17 +985,6 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
     return true;
 }
 
-static const LookupEntry lockingEntries[] = {
-    { "true", XkbKB_Lock },
-    { "yes", XkbKB_Lock },
-    { "on", XkbKB_Lock },
-    { "false", XkbKB_Default },
-    { "no", XkbKB_Default },
-    { "off", XkbKB_Default },
-    { "permanent", XkbKB_Lock | XkbKB_Permanent },
-    { NULL, 0 }
-};
-
 static const LookupEntry repeatEntries[] = {
     { "true", KEY_REPEAT_YES },
     { "yes", KEY_REPEAT_YES },
@@ -1072,12 +1053,10 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
     else if (istreq(field, "locking") ||
              istreq(field, "lock") ||
              istreq(field, "locks")) {
-        unsigned int val;
-
-        ok = ExprResolveEnum(ctx, value, &val, lockingEntries);
-        if (ok)
-            keyi->behavior.type = val;
-        keyi->defined |= KEY_FIELD_BEHAVIOR;
+        log_err(info->keymap->ctx,
+                "Key behaviors not supported; "
+                "Ignoring locking specification for key %s\n",
+                LongKeyNameText(keyi->name));
     }
     else if (istreq(field, "radiogroup") ||
              istreq(field, "permanentradiogroup") ||
@@ -1086,7 +1065,6 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
                 "Radio groups not supported; "
                 "Ignoring radio group specification for key %s\n",
                 LongKeyNameText(keyi->name));
-        return false;
     }
     else if (istreq_prefix("overlay", field) ||
              istreq_prefix("permanentoverlay", field)) {
@@ -1172,6 +1150,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
                 field);
         ok = false;
     }
+
     return ok;
 }
 
@@ -1850,19 +1829,12 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
             }
         }
     }
-    switch (keyi->behavior.type & XkbKB_OpMask) {
-    case XkbKB_Default:
-        break;
 
-    default:
-        key->behavior = keyi->behavior;
-        key->explicit |= XkbExplicitBehaviorMask;
-        break;
-    }
     if (keyi->defined & KEY_FIELD_VMODMAP) {
         key->vmodmap = keyi->vmodmap;
         key->explicit |= XkbExplicitVModMapMask;
     }
+
     if (keyi->repeat != KEY_REPEAT_UNDEFINED) {
         key->repeats = (keyi->repeat == KEY_REPEAT_YES);
         key->explicit |= XkbExplicitAutoRepeatMask;