Make raw keysyms take precedence over translated

Allows both BackSpace and Shift+BackSpace to be bound under the US
keyboard layout, per #3705.
master
Ben Challenor 6 years ago committed by emersion
parent 191305468c
commit 30931ad9e7
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -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) // Identify new keycode, raw keysym(s), and translated keysym(s)
xkb_keycode_t keycode = event->keycode + 8; 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; const xkb_keysym_t *translated_keysyms;
uint32_t translated_modifiers; uint32_t translated_modifiers;
size_t translated_keysyms_len = size_t translated_keysyms_len =
keyboard_keysyms_translated(keyboard, keycode, &translated_keysyms, keyboard_keysyms_translated(keyboard, keycode, &translated_keysyms,
&translated_modifiers); &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); uint32_t code_modifiers = wlr_keyboard_get_modifiers(wlr_device->keyboard);
// Update shortcut model state // Update shortcut model state
update_shortcut_state(&keyboard->state_keycodes, event, update_shortcut_state(&keyboard->state_keycodes, event,
(uint32_t)keycode, code_modifiers); (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) { for (size_t i = 0; i < raw_keysyms_len; ++i) {
update_shortcut_state(&keyboard->state_keysyms_raw, update_shortcut_state(&keyboard->state_keysyms_raw,
event, (uint32_t)raw_keysyms[i], event, (uint32_t)raw_keysyms[i],
code_modifiers); 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; bool handled = false;
@ -326,12 +326,12 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
get_active_binding(&keyboard->state_keycodes, get_active_binding(&keyboard->state_keycodes,
config->current_mode->keycode_bindings, &binding_released, config->current_mode->keycode_bindings, &binding_released,
code_modifiers, true, input_inhibited, device_identifier); 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, get_active_binding(&keyboard->state_keysyms_raw,
config->current_mode->keysym_bindings, &binding_released, config->current_mode->keysym_bindings, &binding_released,
raw_modifiers, true, input_inhibited, device_identifier); 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 // Execute stored release binding once no longer active
if (keyboard->held_binding && binding_released != keyboard->held_binding && 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, get_active_binding(&keyboard->state_keycodes,
config->current_mode->keycode_bindings, &binding, config->current_mode->keycode_bindings, &binding,
code_modifiers, false, input_inhibited, device_identifier); 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, get_active_binding(&keyboard->state_keysyms_translated,
config->current_mode->keysym_bindings, &binding, config->current_mode->keysym_bindings, &binding,
translated_modifiers, false, input_inhibited, translated_modifiers, false, input_inhibited,
device_identifier); 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 // Set up (or clear) keyboard repeat for a pressed binding. Since the

Loading…
Cancel
Save