mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc) in key bindings. This is done by no longer validating/translating modifier names to booleans for a pre-configured set of modifiers (ctrl, shift, alt, super). Instead, we keep the modifier *names* in a list, in the key binding struct. When a keymap is loaded, and we "convert" the key binding, _then_ we do modifier translation. For invalid modifier names, we print an error, and then ignore it. I.e. we no longer fail to load a config due to invalid modifier names. We also need to update how we determine the set of significant modifiers. Any modifier not in this list will be ignored when matching key bindings. Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to handle custom modifiers as well, we simply treat *all* modifiers defined by the current layout as significant. Typically, the only unwanted modifiers are "locked" modifiers. We are already filtering these out.
This commit is contained in:
parent
21a8d832ce
commit
4730ff8d08
6 changed files with 291 additions and 187 deletions
13
config.h
13
config.h
|
|
@ -38,12 +38,14 @@ struct config_font {
|
|||
};
|
||||
DEFINE_LIST(struct config_font);
|
||||
|
||||
#if 0
|
||||
struct config_key_modifiers {
|
||||
bool shift;
|
||||
bool alt;
|
||||
bool ctrl;
|
||||
bool super;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct argv {
|
||||
char **args;
|
||||
|
|
@ -74,9 +76,12 @@ enum key_binding_type {
|
|||
MOUSE_BINDING,
|
||||
};
|
||||
|
||||
typedef tll(char *) config_modifier_list_t;
|
||||
|
||||
struct config_key_binding {
|
||||
int action; /* One of the varios bind_action_* enums from wayland.h */
|
||||
struct config_key_modifiers modifiers;
|
||||
//struct config_key_modifiers modifiers;
|
||||
config_modifier_list_t modifiers;
|
||||
union {
|
||||
/* Key bindings */
|
||||
struct {
|
||||
|
|
@ -263,7 +268,8 @@ struct config {
|
|||
struct {
|
||||
bool hide_when_typing;
|
||||
bool alternate_scroll_mode;
|
||||
struct config_key_modifiers selection_override_modifiers;
|
||||
//struct config_key_modifiers selection_override_modifiers;
|
||||
config_modifier_list_t selection_override_modifiers;
|
||||
} mouse;
|
||||
|
||||
struct {
|
||||
|
|
@ -375,10 +381,11 @@ struct config *config_clone(const struct config *old);
|
|||
bool config_font_parse(const char *pattern, struct config_font *font);
|
||||
void config_font_list_destroy(struct config_font_list *font_list);
|
||||
|
||||
#if 0
|
||||
struct seat;
|
||||
xkb_mod_mask_t
|
||||
conf_modifiers_to_mask(
|
||||
const struct seat *seat, const struct config_key_modifiers *modifiers);
|
||||
|
||||
#endif
|
||||
bool check_if_font_is_monospaced(
|
||||
const char *pattern, user_notifications_t *notifications);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue