From 24ee3dcc10c5e1cf57456cc39fa0b5e8700a06ed Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 17 Apr 2022 16:29:30 +0200 Subject: wayland: refactor: remove ‘struct config’ pointer from wayland struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The global config doesn’t necessarily reflect the correct configuration to use - we should *always* use the current terminal instance’s conf pointer. * Move selection override modifier mask to the key_binding_set struct * Always warn if XDG activation is unavailable, not just if bell.urgent is set (we no longer have access to this information) * Pass ‘bool presentation_timings’ as a parameter to wayl_init() * Remove ‘presentation_timings’ member from the ‘terminal’ struct Closes #932 --- input.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 04d03bbe..9981ecee 100644 --- a/input.c +++ b/input.c @@ -489,11 +489,6 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, seat->kbd.key_arrow_down = xkb_keymap_key_by_name(seat->kbd.xkb_keymap, "DOWN"); } - /* Set selection-override modmask from configured mods and seat's mod indices */ - const struct config_key_modifiers* override_mods = - &wayl->conf->mouse.selection_override_modifiers; - seat->kbd.selection_override_modmask = conf_modifiers_to_mask(seat, override_mods); - munmap(map_str, size); close(fd); @@ -2237,17 +2232,19 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, if (seat->wl_keyboard != NULL && seat->kbd.xkb_state != NULL) { /* Seat has keyboard - use mouse bindings *with* modifiers */ + const struct key_binding_set *bindings = key_binding_for( + wayl->key_binding_manager, term, seat); + xassert(bindings != NULL); + xkb_mod_mask_t mods; get_current_modifiers(seat, &mods, NULL, 0); mods &= seat->kbd.bind_significant; - /* Ignore selection override modifiers when matching modifiers */ - mods &= ~seat->kbd.selection_override_modmask; + /* Ignore selection override modifiers when + * matching modifiers */ + mods &= ~bindings->selection_overrides; const struct key_binding *match = NULL; - const struct key_binding_set *bindings = key_binding_for( - wayl->key_binding_manager, term, seat); - xassert(bindings != NULL); tll_foreach(bindings->mouse, it) { const struct key_binding *binding = &it->item; @@ -2278,7 +2275,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, else { /* Seat does NOT have a keyboard - use mouse bindings *without* modifiers */ const struct config_key_binding *match = NULL; - const struct config *conf = seat->wayl->conf; + const struct config *conf = term->conf; for (size_t i = 0; i < conf->bindings.mouse.count; i++) { const struct config_key_binding *binding = -- cgit v1.3