input/keyboard: Skip configure on same config

sway_keyboard_configure does a lot of keyboard setup, including loading
the keymap (possibly twice in case of fallback), serializing both old
and new keymap to compare them with a strcmp, and updating state that
leads to events for all related clients.

This function is called a lot - output configuration will call it
n_outputs x n_keyboard_devices times. Avoid doing work if the
configuration for a particular keyboard has not actually changed.
This commit is contained in:
Kenny Levinsen 2023-11-15 23:19:55 +01:00
parent 020a572ed6
commit 48bc984c76
4 changed files with 16 additions and 0 deletions

View file

@ -189,6 +189,8 @@ struct input_config {
bool capturable;
struct wlr_box region;
uint64_t seq_id;
};
/**

View file

@ -69,6 +69,8 @@ struct sway_keyboard {
struct wl_event_source *key_repeat_source;
struct sway_binding *repeat_binding;
uint64_t last_input_config;
};
struct sway_keyboard_group {