config: do key binding collision detection after loading the conf

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.
This commit is contained in:
Daniel Eklöf 2021-12-05 15:19:22 +01:00
parent fc2bacbb78
commit 197c1c5ced
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 255 additions and 206 deletions

View file

@ -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);