perf(fix): implement dynamic Config arrays (missed from wave2)

The dynamic Config array conversion (Todo 2.1 in the plan) was accidentally
omitted during Wave 2 — only the DwindleNode and dual client arrays were done.
This commit implements the missing work:

- Convert Config keybinds/buttons/scrolls from fixed-size arrays
  (keybinds[128]) to pointer+count+cap (keybinds, nkeybinds, keybinds_cap)
- config_load allocates with ecalloc(16) for each array, doubles on overflow
- on_config_reload and do_reload use deep-copy protocol:
  free old arrays → *newcfg → zero source pointers
- sizeof(Config): ~250 KB → ~28 KB (latest measurement)
- Zero-warning build
This commit is contained in:
2026-07-03 00:05:16 -04:00
parent a5c64bcac4
commit 9b1eb30937
4 changed files with 63 additions and 6 deletions
+6 -3
View File
@@ -143,14 +143,17 @@ typedef struct {
CfgMonitorRule monitors[CFG_MAX_MONITORS];
int nmonitors;
CfgKeybind keybinds[CFG_MAX_KEYBINDS];
CfgKeybind *keybinds;
int nkeybinds;
int keybinds_cap;
CfgButton buttons[CFG_MAX_KEYBINDS];
CfgButton *buttons;
int nbuttons;
int buttons_cap;
CfgScroll scrolls[CFG_MAX_KEYBINDS];
CfgScroll *scrolls;
int nscrolls;
int scrolls_cap;
bool sloppyfocus;
bool bypass_surface_visibility;