Edit

kc3-lang/libxkbcommon/test/data/keymaps/empty-compound-statements.xkb

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2025-04-02 10:46:06
    Hash : e09cbe66
    Message : symbols: Fix handling of empty keys Before this commit, the following symbols: ```c xkb_symbols { virtual_modifiers M1, M2; key <A> {}; key <B> { [] }; key.vmods = M1; key <C> {}; key <D> { vmods = M2 }; }; ``` would be equivalent to: ```c xkb_symbols { virtual_modifiers M1,M2; key <B> { [ NoSymbol ] }; }; ``` `<B>` entry could be skipped but is harmless. However, `<C>` and `<D>` are missing, which would lead to the mapping resolution of `M1` and `M2` failing. After this commit, it is equivalent to: ```c virtual_modifiers M1,M2; key <C> { vmods = M1 }; key <D> { vmods = M2 }; ``` Empty keys are skipped entirely, but any explicit field: - is taken into account: previously they would be skipped if there were no group; - forces the key to be printed at serialization.

  • test/data/keymaps/empty-compound-statements.xkb
  • xkb_keymap {
    xkb_keycodes {
    	minimum = 8;
    	maximum = 255;
    	<Q>                  = 24;
    	<W>                  = 25;
    	<E>                  = 26;
    	<R>                  = 27;
    	<T>                  = 28;
    	<Y>                  = 29;
    	<U>                  = 30;
    	<I>                  = 31;
    	<O>                  = 32;
    	<P>                  = 33;
    	<A>                  = 38;
    	<S>                  = 39;
    	<D>                  = 40;
    	<F>                  = 41;
    	<G>                  = 42;
    	<H>                  = 43;
    	<Z>                  = 52;
    	<X>                  = 53;
    	<C>                  = 54;
    	<V>                  = 55;
    	<B>                  = 56;
    	<N>                  = 57;
    	<M>                  = 58;
    	indicator 1 = "xxx";
    	indicator 2 = "yyy";
    };
    
    xkb_types {
    	virtual_modifiers M1,M2;
    
    	type "t1" {
    		modifiers= none;
    	};
    	type "t2" {
    		modifiers= Shift;
    		map[Shift]= 2;
    	};
    };
    
    xkb_compatibility {
    	virtual_modifiers M1,M2;
    
    	interpret.useModMapMods= AnyLevel;
    	interpret.repeat= False;
    	interpret q+AnyOfOrNone(all) {
    		action= NoAction();
    	};
    	interpret w+AnyOfOrNone(all) {
    		repeat= True;
    		action= NoAction();
    	};
    	indicator "yyy" {
    		modifiers= Shift;
    	};
    };
    
    xkb_symbols {
    	key <Q>                  {	[               q ] };
    	key <W>                  {
    		repeat= No,
    		symbols[Group1]= [                       NoSymbol ],
    		actions[Group1]= [        SetMods(modifiers=none) ]
    	};
    	key <E>                  {
    		type= "t1",
    		symbols[Group1]= [               e ]
    	};
    	key <U>                  {
    		symbols[Group1]= [        NoSymbol ],
    		symbols[Group2]= [               u ]
    	};
    	key <I>                  {	[               i ] };
    	key <A>                  {
    		virtualMods= M1
    	};
    	key <S>                  {
    		repeat= No
    	};
    	key <F>                  {
    		type= "t2",
    		symbols[Group1]= [        NoSymbol,        NoSymbol ]
    	};
    	key <G>                  {
    		type= "t2",
    		symbols[Group1]= [        NoSymbol,        NoSymbol ]
    	};
    	key <H>                  {
    		type[Group1]= "t1",
    		type[Group2]= "t2",
    		symbols[Group1]= [        NoSymbol ],
    		symbols[Group2]= [        NoSymbol,        NoSymbol ]
    	};
    	key <X>                  {
    		virtualMods= M1
    	};
    	key <C>                  {
    		virtualMods= M2
    	};
    	key <V>                  {
    		virtualMods= none
    	};
    	key <B>                  {
    		type= "t2",
    		virtualMods= none,
    		symbols[Group1]= [        NoSymbol,        NoSymbol ]
    	};
    	key <N>                  {
    		type= "t1",
    		virtualMods= none,
    		symbols[Group1]= [        NoSymbol ]
    	};
    	key <M>                  {
    		type[Group1]= "t1",
    		type[Group2]= "t2",
    		virtualMods= none,
    		symbols[Group1]= [        NoSymbol ],
    		symbols[Group2]= [        NoSymbol,        NoSymbol ]
    	};
    	modifier_map Shift { <Z> };
    	modifier_map Lock { <X> };
    	modifier_map Control { <C> };
    };
    
    };