1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-17 17:57:28 +03:00

deps: update xkbcommon

This commit is contained in:
Wez Furlong 2024-01-23 17:02:32 -07:00
parent eb3a78b0cb
commit a263fd38f1
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
4 changed files with 33 additions and 15 deletions

17
Cargo.lock generated
View File

@ -3226,9 +3226,9 @@ dependencies = [
[[package]]
name = "memmap2"
version = "0.7.1"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6"
checksum = "43a5a03cefb0d953ec0be133036f14e109412fa594edc2f77227249db66cc3ed"
dependencies = [
"libc",
]
@ -7239,15 +7239,22 @@ dependencies = [
[[package]]
name = "xkbcommon"
version = "0.5.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52db25b599e92bf6e3904134618728eeb7b49a5a4f38f107f92399bb9c496b88"
checksum = "13867d259930edc7091a6c41b4ce6eee464328c6ff9659b7e4c668ca20d4c91e"
dependencies = [
"as-raw-xcb-connection",
"libc",
"memmap2 0.7.1",
"memmap2 0.8.0",
"xkeysym",
]
[[package]]
name = "xkeysym"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621"
[[package]]
name = "xml-rs"
version = "0.8.19"

View File

@ -72,7 +72,7 @@ dirs-next = "2.0"
filedescriptor = { version="0.8", path = "../filedescriptor" }
x11 = {version ="2.19", features = ["xlib_xcb", "xlib"]}
xcb = {version="1.2", features=["render", "randr", "dri2", "xkb", "xlib_xcb", "present", "as-raw-xcb-connection"]}
xkbcommon = { version = "0.5.0", features = ["x11", "wayland"] }
xkbcommon = { version = "0.7.0", features = ["x11", "wayland"] }
mio = {version="0.8", features=["os-ext"]}
libc = "0.2"
smithay-client-toolkit = {version = "0.16.1", default-features=false, optional=true}

View File

@ -65,7 +65,7 @@ impl Compose {
let previously_composing = !self.composition.is_empty();
let feed_result = self.state.feed(xsym);
log::trace!("feed {xsym} -> result {feed_result:?}");
log::trace!("feed {xsym:?} -> result {feed_result:?}");
match self.state.status() {
ComposeStatus::Composing => {
@ -169,7 +169,13 @@ impl KeyboardWithFallback {
) -> Option<WindowKeyEvent> {
let want_repeat = self.selected.wayland_key_repeats(code);
let raw_modifiers = self.get_key_modifiers();
self.process_key_event_impl(code + 8, raw_modifiers, pressed, events, want_repeat)
self.process_key_event_impl(
xkb::Keycode::new(code + 8),
raw_modifiers,
pressed,
events,
want_repeat,
)
}
/// Compute the Modifier mask equivalent from the button mask
@ -246,10 +252,10 @@ impl KeyboardWithFallback {
let raw_key_event = RawKeyEvent {
key: match phys_code {
Some(phys) => KeyCode::Physical(phys),
None => KeyCode::RawCode(xcode),
None => KeyCode::RawCode(xcode.into()),
},
phys_code,
raw_code: xcode,
raw_code: xcode.into(),
modifiers: raw_modifiers,
leds,
repeat_count: 1,
@ -343,7 +349,9 @@ impl KeyboardWithFallback {
&& raw_modifiers
.intersects(Modifiers::CTRL | Modifiers::ALT | Modifiers::SUPER)
{
match keysym_to_keycode(sym).or_else(|| keysym_to_keycode(xsym)) {
match keysym_to_keycode(sym.into())
.or_else(|| keysym_to_keycode(xsym.into()))
{
Some(crate::KeyCode::Char(c)) if !c.is_ascii() => {
// Potentially a Cyrillic or other non-european layout.
// Consider shortcuts like CTRL-C against the default
@ -356,7 +364,7 @@ impl KeyboardWithFallback {
) => {
log::trace!(
"process_key_event: RawKeyEvent using fallback \
sym {fb_sym} because layout would expand to \
sym {fb_sym:?} because layout would expand to \
non-ascii text {c:?}"
);
fb_sym
@ -382,7 +390,8 @@ impl KeyboardWithFallback {
let kc = match kc {
Some(kc) => kc,
None => match keysym_to_keycode(ksym).or_else(|| keysym_to_keycode(xsym)) {
None => match keysym_to_keycode(ksym.into()).or_else(|| keysym_to_keycode(xsym.into()))
{
Some(kc) => kc,
None => {
log::trace!("keysym_to_keycode for {:?} and {:?} -> None", ksym, xsym);
@ -641,7 +650,9 @@ impl Keyboard {
/// Returns true if a given wayland keycode allows for automatic key repeats
pub fn wayland_key_repeats(&self, code: u32) -> bool {
self.keymap.borrow().key_repeats(code + 8)
self.keymap
.borrow()
.key_repeats(xkb::Keycode::new(code + 8))
}
pub fn get_device_id(&self) -> i32 {

View File

@ -25,7 +25,7 @@ pub fn modifiers_from_state(state: u32) -> Modifiers {
/// for missing keys, look into `/usr/include/X11/keysymdef.h`
/// and/or define them in KeyCode.
pub fn keysym_to_keycode(keysym: u32) -> Option<KeyCode> {
let utf32 = xkbcommon::xkb::keysym_to_utf32(keysym);
let utf32 = xkbcommon::xkb::keysym_to_utf32(keysym.into());
if utf32 >= 0x20 {
// Unsafety: this is ok because we trust that keysym_to_utf32
// is only going to return valid utf32 codepoints.