aboutsummaryrefslogtreecommitdiffstats
path: root/build/4coder_byp/custom/4coder_command_map.h
blob: 904f26ade774df765dbd1a56af7782a50e9ca825 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
4coder_command_map.h - Command management types
*/

// TOP

#if !defined(FCODER_CODEPOINT_MAP_H)
#define FCODER_CODEPOINT_MAP_H

typedef i64 Command_Map_ID;

struct Command_Trigger{
 Command_Trigger *next;
 Input_Event_Kind kind;
 u32 sub_code;
 Input_Modifier_Set mods;
 };

 struct Command_Trigger_List{
 Command_Trigger *first;
 Command_Trigger *last;
 };

 struct Command_Binding{
 union{
 Custom_Command_Function *custom;
 char *name;
 };

 Command_Binding();
 Command_Binding(Custom_Command_Function *c);
 Command_Binding(char *n);

 operator Custom_Command_Function*();
 operator char*();
 };

 struct Command_Modified_Binding{
 Command_Modified_Binding *next;
 SNode order_node;
 Input_Modifier_Set mods;
 Command_Binding binding;
 };

 struct Command_Binding_List{
 Command_Binding_List *next;
 SNode *first;
 SNode *last;
 i32 count;
 };

 struct Command_Map{
 Command_Map *next;
 Command_Map *prev;
 Command_Map_ID id;
 Command_Map_ID parent;
 Command_Binding text_input_command;
 Arena node_arena;
 Table_u64_u64 event_code_to_binding_list;
 Table_u64_u64 cmd_to_binding_trigger;
 Command_Modified_Binding *binding_first;
 Command_Modified_Binding *binding_last;
 Command_Binding_List *list_first;
 Command_Binding_List *list_last;

 struct Binding_Unit *real_beginning;
 };

 struct Mapping{
 Arena node_arena;
 Heap heap;
 Base_Allocator heap_wrapper;
 Table_u64_u64 id_to_map;
 Command_Map_ID id_counter;
 Command_Map *first_map;
 Command_Map *last_map;
 Command_Map *free_maps;
 Command_Modified_Binding *free_bindings;
 Command_Binding_List *free_lists;
 };

 typedef i32 Binding_Match_Rule;
 enum{
 BindingMatchRule_Strict,
 BindingMatchRule_Loose,
 };

 struct Map_Event_Breakdown{
 Input_Modifier_Set *mod_set;
 u64 key;
 Key_Code skip_self_mod;
};

#endif

// BOTTOM