1
0
Fork 0
forked from wry/wry

keyboard: send keymap without actions/behaviors to xwayland

This commit is contained in:
Julian Orth 2025-01-22 16:49:14 +01:00
parent 541a7b5ebc
commit abaeed4c01
10 changed files with 52 additions and 34 deletions

View file

@ -73,7 +73,7 @@ use {
xdg_toplevel_drag_v1::XdgToplevelDragV1,
},
kbvm::{KbvmMap, KbvmMapId, KbvmState, PhysicalKeyboardState},
keyboard::{DynKeyboardState, KeyboardState, KeyboardStateId},
keyboard::{DynKeyboardState, KeyboardState, KeyboardStateId, KeymapFd},
leaks::Tracker,
object::{Object, Version},
rect::Rect,
@ -104,7 +104,6 @@ use {
rc::{Rc, Weak},
},
thiserror::Error,
uapi::OwnedFd,
};
pub use {
event_handling::NodeSeatState,
@ -1179,11 +1178,15 @@ impl WlSeat {
})
}
pub fn keymap_fd(&self, state: &KeyboardState) -> Result<Rc<OwnedFd>, WlKeyboardError> {
pub fn keymap_fd(&self, state: &KeyboardState) -> Result<KeymapFd, WlKeyboardError> {
let fd = match self.client.is_xwayland {
true => &state.xwayland_map,
_ => &state.map,
};
if self.version >= READ_ONLY_KEYMAP_SINCE {
return Ok(state.map.clone());
return Ok(fd.clone());
}
Ok(state.create_new_keymap_fd()?)
Ok(fd.create_unprotected_fd()?)
}
}