keyboard: replace xkbcommon by kbvm
This commit is contained in:
parent
51ceba72b0
commit
541a7b5ebc
23 changed files with 532 additions and 738 deletions
|
|
@ -64,9 +64,9 @@ impl EiConnection {
|
|||
if version == EiVersion(0) {
|
||||
return;
|
||||
}
|
||||
let xkb_state_id = match self.context() {
|
||||
EiContext::Sender => seat.seat_xkb_state().borrow().id,
|
||||
EiContext::Receiver => seat.latest_xkb_state().borrow().id,
|
||||
let kb_state_id = match self.context() {
|
||||
EiContext::Sender => seat.seat_kb_state().borrow().id,
|
||||
EiContext::Receiver => seat.latest_kb_state().borrow().id,
|
||||
};
|
||||
let seat = Rc::new(EiSeat {
|
||||
id: self.client.new_id(),
|
||||
|
|
@ -75,7 +75,8 @@ impl EiConnection {
|
|||
version,
|
||||
seat: seat.clone(),
|
||||
capabilities: Cell::new(0),
|
||||
kb_state_id: Cell::new(xkb_state_id),
|
||||
kb_state_id: Cell::new(kb_state_id),
|
||||
keyboard_id: self.client.state.physical_keyboard_ids.next(),
|
||||
device: Default::default(),
|
||||
pointer: Default::default(),
|
||||
pointer_absolute: Default::default(),
|
||||
|
|
|
|||
|
|
@ -189,7 +189,8 @@ impl EiDeviceRequestHandler for EiDevice {
|
|||
seat.button_event(time, button, pressed);
|
||||
}
|
||||
while let Some((button, pressed)) = self.key_changes.pop() {
|
||||
seat.key_event_with_seat_state(time, button, pressed);
|
||||
let phy = seat.get_physical_keyboard(self.seat.keyboard_id, None);
|
||||
phy.phy_state.update(time, seat, button, pressed);
|
||||
}
|
||||
if let Some((x, y)) = self.relative_motion.take() {
|
||||
let x = Fixed::from_f32(x);
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue