Edit

kc3-lang/libxkbcommon/test/data/rules/all_qualifier

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2023-11-16 17:12:03
    Hash : 4ea9d431
    Message : rules: Add support for :all qualifier Some layout options require to be applied to every group to maintain consistency (e.g. a group switcher). Currently this must be done manually for all layout indexes. This is error prone and prevents the increase of the maximum group count. This commit introduces the `:all` qualifier for KcCGST values. When a rule with this qualifier is matched, it will expands the qualified value (and its optional merge mode) for every layout, e.g. `+group(toggle):all` (respectively `|group(toggle)`) would expand to `+group(toggle):1+group(toggle):2` (respectively `|group(toggle):1|group(toggle):2`) if there are 2 layouts, etc. If there is no merge mode, it defaults to *override* `+`, e.g. `x:all` expands to `x:1+x:2+x:3` for 3 layouts. Note that only the qualified *value* is expanded, e.g. `x+y:all` expands to `x+y:1+y:2` for 2 layouts. `:all` can be used in combination with special layout indexes. Since this can lead to an unexpected behaviour, a warning will be raised.

  • test/data/rules/all_qualifier
  • ! model         = keycodes
      my_model      = my_keycodes
      *             = default_keycodes
    
    ! layout        variant    = symbols
      layout_a      my_variant = symbols_a+extra_variant
    
    ! layout        = symbols
      layout_a      = symbols_a
      layout_b      = symbols_b
      *             = default_symbols
    
    ! layout[1]     = symbols
      layout_a      = symbols_a:1
      layout_b      = symbols_b:1
      layout_x      = base:all // strange but valid
      *             = default_symbols:1
    
    ! layout[2]     = symbols
      layout_a      = +symbols_a:2
      layout_b      = +symbols_b:2
      *             = +default_symbols:2
    
    ! layout[3]     = symbols
      layout_a      = +symbols_a:3
      layout_b      = +symbols_b:3
      *             = +default_symbols:3
    
    ! layout[4]     = symbols
      layout_a      = +symbols_a:4
      layout_b      = +symbols_b:4
      *             = +default_symbols:4
    
    // WARNING: Invalid at the moment. Here for future test
    ! layout[5]     = symbols
      layout_a      = +symbols_a:5
      layout_b      = +symbols_b:5
      layout_c      = +symbols_c:5
      *             = +default_symbols:5
    
    // Combine with special indexes
    ! layout[first] variant[first] = symbols
      *             extra1         = +extra_symbols:all
    
    // Combine with special indexes (valid but raises a warning)
    ! layout[any] variant[any] = symbols
      *           extra2       = +extra_symbols1:%i+extra_symbols2:all
      *           extra3       = +extra_symbols2:all+extra_symbols1:%i
    
    ! model         = types
      my_model      = my_types
      *             = default_types
    
    ! model         = compat
      my_model      = my_compat
      *             = default_compat
    
    ! option        = symbols
      my_option     = +extra_option:all