aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Challenor <ben@challenor.org>2019-03-10 20:26:50 +0000
committeremersion <contact@emersion.fr>2019-03-10 23:01:49 +0100
commit30931ad9e77b106956007530821d98bc20bca969 (patch)
treeb0038a7cfef6e0c56d52f4ee25bcbda1dc8b7cd8
parent191305468c0fe9b1acf8b6ad6c8a49b97cf793aa (diff)
downloadsway-30931ad9e77b106956007530821d98bc20bca969.zip
sway-30931ad9e77b106956007530821d98bc20bca969.tar.gz
sway-30931ad9e77b106956007530821d98bc20bca969.tar.bz2
Make raw keysyms take precedence over translated
Allows both BackSpace and Shift+BackSpace to be bound under the US keyboard layout, per #3705.
-rw-r--r--sway/input/keyboard.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index 00fc6a1..06ae99c 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -292,32 +292,32 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
// Identify new keycode, raw keysym(s), and translated keysym(s)
xkb_keycode_t keycode = event->keycode + 8;
+ const xkb_keysym_t *raw_keysyms;
+ uint32_t raw_modifiers;
+ size_t raw_keysyms_len =
+ keyboard_keysyms_raw(keyboard, keycode, &raw_keysyms, &raw_modifiers);
+
const xkb_keysym_t *translated_keysyms;
uint32_t translated_modifiers;
size_t translated_keysyms_len =
keyboard_keysyms_translated(keyboard, keycode, &translated_keysyms,
&translated_modifiers);
- const xkb_keysym_t *raw_keysyms;
- uint32_t raw_modifiers;
- size_t raw_keysyms_len =
- keyboard_keysyms_raw(keyboard, keycode, &raw_keysyms, &raw_modifiers);
-
uint32_t code_modifiers = wlr_keyboard_get_modifiers(wlr_device->keyboard);
// Update shortcut model state
update_shortcut_state(&keyboard->state_keycodes, event,
(uint32_t)keycode, code_modifiers);
- for (size_t i = 0; i < translated_keysyms_len; ++i) {
- update_shortcut_state(&keyboard->state_keysyms_translated,
- event, (uint32_t)translated_keysyms[i],
- code_modifiers);
- }
for (size_t i = 0; i < raw_keysyms_len; ++i) {
update_shortcut_state(&keyboard->state_keysyms_raw,
event, (uint32_t)raw_keysyms[i],
code_modifiers);
}
+ for (size_t i = 0; i < translated_keysyms_len; ++i) {
+ update_shortcut_state(&keyboard->state_keysyms_translated,
+ event, (uint32_t)translated_keysyms[i],
+ code_modifiers);
+ }
bool handled = false;
@@ -326,12 +326,12 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
get_active_binding(&keyboard->state_keycodes,
config->current_mode->keycode_bindings, &binding_released,
code_modifiers, true, input_inhibited, device_identifier);
- get_active_binding(&keyboard->state_keysyms_translated,
- config->current_mode->keysym_bindings, &binding_released,
- translated_modifiers, true, input_inhibited, device_identifier);
get_active_binding(&keyboard->state_keysyms_raw,
config->current_mode->keysym_bindings, &binding_released,
raw_modifiers, true, input_inhibited, device_identifier);
+ get_active_binding(&keyboard->state_keysyms_translated,
+ config->current_mode->keysym_bindings, &binding_released,
+ translated_modifiers, true, input_inhibited, device_identifier);
// Execute stored release binding once no longer active
if (keyboard->held_binding && binding_released != keyboard->held_binding &&
@@ -352,13 +352,13 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
get_active_binding(&keyboard->state_keycodes,
config->current_mode->keycode_bindings, &binding,
code_modifiers, false, input_inhibited, device_identifier);
+ get_active_binding(&keyboard->state_keysyms_raw,
+ config->current_mode->keysym_bindings, &binding,
+ raw_modifiers, false, input_inhibited, device_identifier);
get_active_binding(&keyboard->state_keysyms_translated,
config->current_mode->keysym_bindings, &binding,
translated_modifiers, false, input_inhibited,
device_identifier);
- get_active_binding(&keyboard->state_keysyms_raw,
- config->current_mode->keysym_bindings, &binding,
- raw_modifiers, false, input_inhibited, device_identifier);
}
// Set up (or clear) keyboard repeat for a pressed binding. Since the