diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-01-30 11:43:59 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-02-07 15:33:31 +0000 |
| commit | ee39966dedf9e8fbee5528c324c807b92b9a6c23 (patch) | |
| tree | cb052ec2b5725b5be0fd85071aa58c75b7d3bf1d /input.c | |
| parent | Merge branch 'xassert-performance-regression-2' (diff) | |
config: add infrastructure to handle URL mode specific key bindings
* Add “show-urls” action to regular key bindings
* Add url-bindings section to foot.ini
* Add “cancel” action to URL mode key bindings
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -271,6 +271,10 @@ execute_binding(struct seat *seat, struct terminal *term, return true; } + case BIND_ACTION_SHOW_URLS: + assert(false); + break; + case BIND_ACTION_SELECT_BEGIN: selection_start( term, seat->mouse.col, seat->mouse.row, SELECTION_CHAR_WISE, false); @@ -404,6 +408,29 @@ convert_search_bindings(const struct config *conf, struct seat *seat) } static void +convert_url_binding(struct seat *seat, + const struct config_key_binding_url *conf_binding) +{ + struct key_binding_url binding = { + .action = conf_binding->action, + .bind = { + .mods = conf_modifiers_to_mask(seat, &conf_binding->modifiers), + .sym = conf_binding->sym, + .key_codes = key_codes_for_xkb_sym( + seat->kbd.xkb_keymap, conf_binding->sym), + }, + }; + tll_push_back(seat->kbd.bindings.url, binding); +} + +static void +convert_url_bindings(const struct config *conf, struct seat *seat) +{ + tll_foreach(conf->bindings.url, it) + convert_url_binding(seat, &it->item); +} + +static void convert_mouse_binding(struct seat *seat, const struct config_mouse_binding *conf_binding) { @@ -528,6 +555,7 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, convert_key_bindings(wayl->conf, seat); convert_search_bindings(wayl->conf, seat); + convert_url_bindings(wayl->conf, seat); convert_mouse_bindings(wayl->conf, seat); } |
