lib/xkb/src/keymap/text/document.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 const xkb = @import("../../root.zig");
2
3 pub const Keycode = struct {
4 name: []const u8,
5 code: u32,
6 };
7
8 pub const Alias = struct {
9 name: []const u8,
10 target: []const u8,
11 };
12
13 pub const VirtualModifier = struct {
14 name: []const u8,
15 explicit_mapping: ?u32 = null,
16 };
17
18 pub const TypeEntry = struct {
19 modifiers: u32,
20 preserve: u32 = 0,
21 level: usize,
22 };
23
24 pub const KeyType = struct {
25 name: []const u8,
26 modifiers: u32,
27 level_count: usize,
28 entries: []const TypeEntry,
29 };
30
31 pub const Match = enum {
32 exactly,
33 all,
34 none,
35 any,
36 any_or_none,
37 };
38
39 pub const Interpret = struct {
40 symbol: ?xkb.keysym.Keysym,
41 match: Match,
42 modifiers: u32,
43 repeat: bool,
44 level_one_only: bool,
45 virtual_modifier: ?usize,
46 order: usize,
47 };
48
49 pub const Level = struct {
50 symbols: []const xkb.keysym.Keysym,
51 };
52
53 pub const Group = struct {
54 type_name: ?[]const u8 = null,
55 levels: []const Level = &.{},
56 has_actions: bool = false,
57 };
58
59 pub const OutOfRange = union(enum) {
60 wrap,
61 saturate,
62 redirect: usize,
63 };
64
65 pub const Key = struct {
66 name: []const u8,
67 default_type: ?[]const u8,
68 groups: []const Group,
69 repeat: ?bool,
70 virtual_modifiers: ?u32,
71 out_of_range: OutOfRange,
72 };
73
74 pub const ModifierMap = struct {
75 modifier: usize,
76 keys: []const []const u8,
77 };
78
79 pub const Document = struct {
80 keycodes: []const Keycode,
81 aliases: []const Alias,
82 virtual_modifiers: []const VirtualModifier,
83 types: []const KeyType,
84 interprets: []const Interpret,
85 keys: []const Key,
86 modifier_maps: []const ModifierMap,
87 };