Language independent hotkeys (#34053)
Addresses #10972 Closes #24950 Closes #24499 Adds _key_en_ to _Keystroke_ that is derived from key's scan code. This is more lightweight approach than #32529 Currently has been tested on x11 and windows. Mac code hasn't been implemented yet. Release Notes: - linux: When typing non-ASCII keys on Linux we will now also match keybindings against the QWERTY-equivalent layout. This should allow most of Zed's builtin shortcuts to work out of the box on most keyboard layouts. **Breaking change**: If you had been using `keysym` names in your keyboard shortcut file (`ctrl-cyrillic_yeru`, etc.) you should now use the QWERTY-equivalent characters instead. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
51df8a17ef
commit
f50041779d
5 changed files with 108 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::{Capslock, xcb_flush};
|
||||
use crate::{Capslock, KeycodeSource, xcb_flush};
|
||||
use core::str;
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
|
@ -1034,7 +1034,8 @@ impl X11Client {
|
|||
xkb_state.latched_layout,
|
||||
xkb_state.locked_layout,
|
||||
);
|
||||
let mut keystroke = crate::Keystroke::from_xkb(&state.xkb, modifiers, code);
|
||||
let mut keystroke =
|
||||
crate::Keystroke::from_xkb(&state.xkb, modifiers, code, KeycodeSource::X11);
|
||||
let keysym = state.xkb.key_get_one_sym(code);
|
||||
if keysym.is_modifier_key() {
|
||||
return Some(());
|
||||
|
@ -1102,7 +1103,8 @@ impl X11Client {
|
|||
xkb_state.latched_layout,
|
||||
xkb_state.locked_layout,
|
||||
);
|
||||
let keystroke = crate::Keystroke::from_xkb(&state.xkb, modifiers, code);
|
||||
let keystroke =
|
||||
crate::Keystroke::from_xkb(&state.xkb, modifiers, code, KeycodeSource::X11);
|
||||
let keysym = state.xkb.key_get_one_sym(code);
|
||||
if keysym.is_modifier_key() {
|
||||
return Some(());
|
||||
|
@ -1326,6 +1328,7 @@ impl X11Client {
|
|||
&state.xkb,
|
||||
state.modifiers,
|
||||
event.detail.into(),
|
||||
KeycodeSource::X11,
|
||||
));
|
||||
let (mut ximc, mut xim_handler) = state.take_xim()?;
|
||||
drop(state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue