1
0
Fork 0
forked from wry/wry

keyboard: replace xkbcommon by kbvm

This commit is contained in:
Julian Orth 2025-01-07 20:03:49 +01:00
parent 51ceba72b0
commit 541a7b5ebc
23 changed files with 532 additions and 738 deletions

View file

@ -16,7 +16,7 @@ use {
EiContext,
},
fixed::Fixed,
ifs::wl_seat::{wl_pointer::PendingScroll, WlSeatGlobal},
ifs::wl_seat::{wl_pointer::PendingScroll, PhysicalKeyboardId, WlSeatGlobal},
keyboard::{DynKeyboardState, KeyboardState, KeyboardStateId},
leaks::Tracker,
tree::Node,
@ -49,6 +49,7 @@ pub struct EiSeat {
pub seat: Rc<WlSeatGlobal>,
pub capabilities: Cell<u64>,
pub kb_state_id: Cell<KeyboardStateId>,
pub keyboard_id: PhysicalKeyboardId,
pub device: CloneCell<Option<Rc<EiDevice>>>,
pub pointer: CloneCell<Option<Rc<EiPointer>>>,
@ -75,7 +76,11 @@ impl EiSeat {
}
}
pub fn handle_xkb_state_change(self: &Rc<Self>, old_id: KeyboardStateId, new: &KeyboardState) {
pub fn handle_keyboard_state_change(
self: &Rc<Self>,
old_id: KeyboardStateId,
new: &KeyboardState,
) {
if self.keyboard.is_none() {
return;
}
@ -94,7 +99,7 @@ impl EiSeat {
if self.is_sender() {
return;
}
self.handle_xkb_state_change(old_id, state);
self.handle_keyboard_state_change(old_id, state);
return;
}
if let Some(kb) = self.keyboard.get() {
@ -114,7 +119,7 @@ impl EiSeat {
}
let old_id = self.kb_state_id.get();
if old_id != kb_state.id {
self.handle_xkb_state_change(old_id, kb_state);
self.handle_keyboard_state_change(old_id, kb_state);
}
if let Some(kb) = self.keyboard.get() {
kb.send_key(key, state);
@ -298,8 +303,8 @@ impl EiSeat {
fn get_kb_state(&self) -> Rc<dyn DynKeyboardState> {
match self.context() {
EiContext::Sender => self.seat.seat_xkb_state(),
EiContext::Receiver => self.seat.latest_xkb_state(),
EiContext::Sender => self.seat.seat_kb_state(),
EiContext::Receiver => self.seat.latest_kb_state(),
}
}