Edit

kc3-lang/libxkbcommon/test/data/keymaps/merge-modes/vmods-same-component-include-default-augment.xkb

Branch :

  • Browse

    Commit

  • Author : Peter Hutterer
    Date : 2024-02-14 09:47:15
    Hash : 7a7a3b38
    Message : keymap: Canonically map unmapped virtual modifiers Traditionally, *virtual* modifiers were merely name aliases for *real* modifiers (X *core* modifiers), e.g. `NumLock` was usually mapped to `Mod2` (see `modifier_map` statement). Virtual modifiers that were never mapped to a real ones had no effect on the keymap state. xkbcommon already supports the concept of “pure” virtual modifiers, i.e. virtual modifiers that are *encoded* using the full 32-bit range, not just the first 8 bits corresponding to the real modifiers. But until this commit, one had to declare such mapping *explicitly*: e.g. `virtual_modifiers M = 0x100;`. This has at least two drawbacks: - Numerical values may look quite arbitrary and are not user-friendly. It’s OK in the resulting compiled keymap, but it requires careful sync between sections when developing KcCGST files. - If the modifier is *also* mapped *implicitly* using the traditional `vmodmap`/`modifier_map`, then both mappings are OR-combined. This patch enables to automatically map unmapped virtual modifiers to their *canonical* mapping, i.e. themselves: their corresponding virtual and real modifier masks are identical: `1u << mod_index`. Since this feature is incompatible with X11, this is guarded by requiring at least keymap text format **v2**. Note that for now, canonical virtual modifiers cannot be used in an interpret action’s `AnyOf()`. An interpret action for a canonical virtual modifier must be `AnyOfOrNone()` to take effect: virtual_modifiers APureMod, …; interpret a+AnyOfOrNone(all) { virtualModifier= APureMod; action= SetMods(modifiers=APureMod); }; The above adds a virtual modifier `APureMod` for keysym `a`. It will be canonical iff it is not mapped implicitly.

  • test/data/keymaps/merge-modes/vmods-same-component-include-default-augment.xkb
  • xkb_keymap {
    xkb_keycodes {
    	minimum = 8;
    	maximum = 255;
    };
    
    xkb_types "" {
    	virtual_modifiers U1=0x100,U2=none,U3=0x300000,U4=0x800,U5=none,U6=0x600000,Z1=none,Z2=none,Z3=none,Z4=none,Z5=none,Z6=none,M1=0x1000,M2=0x2000,M3=0x3000,M4=0x4000,M5=0x5000,M6=0x6000,U7=0x4000000,Z7=none,M7=0x70000;
    
    	type "default" {
    		modifiers= none;
    	};
    };
    
    xkb_compatibility "" {
    	virtual_modifiers U1=0x100,U2=none,U3=0x300000,U4=0x800,U5=none,U6=0x600000,Z1=none,Z2=none,Z3=none,Z4=none,Z5=none,Z6=none,M1=0x1000,M2=0x2000,M3=0x3000,M4=0x4000,M5=0x5000,M6=0x6000,U7=0x4000000,Z7=none,M7=0x70000;
    
    	interpret.useModMapMods= AnyLevel;
    	interpret.repeat= False;
    	interpret VoidSymbol+AnyOfOrNone(none) {
    		repeat= True;
    	};
    };
    
    xkb_symbols {
    };
    
    };