From 197c1c5ced20f5783f2359a10d7096f0e1a438d2 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 5 Dec 2021 15:19:22 +0100 Subject: config: do key binding collision detection after loading the conf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the user to write, to swap two key bindings: [key-bindings] show-urls-launch=Control+Shift+r search-start=Control+Shift+u instead of: [key-bindings] search-start=none show-urls-launch=Control+Shift+r search-start=Control+Shift+u This should simplify the configuration for people who replace a lot of the default key bindings. This also simplifies the parsing somewhat, since we no longer has to parse a key-binding into a temporary list, ensure it doesn’t have any collisions, and then copy it into the actual key binding list. _While_ parsing a key-binding, we still need a temporary array (at least for the time being), but that temporary array is no longer visible outside the parsing function that allocates it. --- config.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'config.h') diff --git a/config.h b/config.h index 2ae3a2d5..ee968748 100644 --- a/config.h +++ b/config.h @@ -45,6 +45,10 @@ struct config_key_binding { struct config_key_modifiers modifiers; xkb_keysym_t sym; struct config_binding_pipe pipe; + + /* For error messages in collision handling */ + const char *path; + int lineno; }; DEFINE_LIST(struct config_key_binding); -- cgit v1.3