mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
Up until now, our Wayland seats have been tracking key bindings. This makes sense, since the seat’s keymap determines how the key bindings are resolved. However, tying bindings to the seat/keymap alone isn’t enough, since we also depend on the current configuration (i.e. user settings) when resolving a key binding. This means configurations that doesn’t match the wayland object’s configuration, currently don’t resolve key bindings correctly. This applies to footclients where the user has overridden key bindings on the command line (e.g. --override key-bindings.foo=bar). Thus, to correctly resolve key bindings, each set of key bindings must be tied *both* to a seat/keymap, *and* a configuration. This patch introduces a key-binding manager, with an API to add/remove/lookup, and load/unload keymaps from sets of key bindings. In the API, sets are tied to a seat and terminal instance, since this makes the most sense (we need to instantiate, or incref a set whenever a new terminal instance is created). Internally, the set is tied to a seat and the terminal’s configuration. Sets are *added* when a new seat is added, and when a new terminal instance is created. Since there can only be one instance of each seat, sets are always removed when a seat is removed. Terminals on the other hand can re-use the same configuration (and typically do). Thus, sets ref-count the configuration. In other words, when instantiating a new terminal, we may not have to instantiate a new set of key bindings, but can often be incref:ed instead. Whenever the keymap changes on a seat, all key bindings sets associated with that seat reloads (re-resolves) their key bindings. Closes #931
28 lines
866 B
C
28 lines
866 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <xkbcommon/xkbcommon.h>
|
|
#include <tllist.h>
|
|
|
|
#include "config.h"
|
|
#include "key-binding.h"
|
|
#include "terminal.h"
|
|
|
|
static inline bool urls_mode_is_active(const struct terminal *term)
|
|
{
|
|
return tll_length(term->urls) > 0;
|
|
}
|
|
|
|
void urls_collect(
|
|
const struct terminal *term, enum url_action action, url_list_t *urls);
|
|
void urls_assign_key_combos(const struct config *conf, url_list_t *urls);
|
|
|
|
void urls_render(struct terminal *term);
|
|
void urls_reset(struct terminal *term);
|
|
|
|
void urls_input(struct seat *seat, struct terminal *term,
|
|
const struct key_binding_set *bindings, uint32_t key,
|
|
xkb_keysym_t sym, xkb_mod_mask_t mods, xkb_mod_mask_t consumed,
|
|
xkb_mod_mask_t locked,
|
|
const xkb_keysym_t *raw_syms, size_t raw_count,
|
|
uint32_t serial);
|