keyboard: use kbvm::Components
This commit is contained in:
parent
e7d5a23af3
commit
51ceba72b0
10 changed files with 106 additions and 44 deletions
|
|
@ -11,7 +11,6 @@ use {
|
|||
wl_pointer::PendingScroll,
|
||||
SeatId,
|
||||
},
|
||||
keyboard::ModifierState,
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
wire::{jay_seat_events::*, JaySeatEventsId},
|
||||
|
|
@ -26,12 +25,12 @@ pub struct JaySeatEvents {
|
|||
}
|
||||
|
||||
impl JaySeatEvents {
|
||||
pub fn send_modifiers(&self, seat: SeatId, mods: &ModifierState) {
|
||||
pub fn send_modifiers(&self, seat: SeatId, mods: &kbvm::Components) {
|
||||
self.client.event(Modifiers {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
modifiers: mods.mods_effective,
|
||||
group: mods.group,
|
||||
modifiers: mods.mods.0,
|
||||
group: mods.group.0,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@ impl WlSeatGlobal {
|
|||
let mut shortcuts = SmallVec::<[_; 1]>::new();
|
||||
let new_mods;
|
||||
{
|
||||
let mut mods = xkb_state.mods().mods_effective & !(CAPS.0 | NUM.0);
|
||||
let mut mods = xkb_state.mods().mods.0 & !(CAPS.0 | NUM.0);
|
||||
if state == wl_keyboard::RELEASED {
|
||||
mods |= RELEASE.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,10 +78,10 @@ impl ZwpInputMethodKeyboardGrabV2 {
|
|||
self.client.event(Modifiers {
|
||||
self_id: self.id,
|
||||
serial: serial as _,
|
||||
mods_depressed: kb_state.mods.mods_depressed,
|
||||
mods_latched: kb_state.mods.mods_latched,
|
||||
mods_locked: kb_state.mods.mods_locked,
|
||||
group: kb_state.mods.group,
|
||||
mods_depressed: kb_state.mods.mods_pressed.0,
|
||||
mods_latched: kb_state.mods.mods_latched.0,
|
||||
mods_locked: kb_state.mods.mods_locked.0,
|
||||
group: kb_state.mods.group.0,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ use {
|
|||
crate::{
|
||||
client::ClientError,
|
||||
ifs::wl_seat::WlSeat,
|
||||
keyboard::{KeyboardState, KeyboardStateId, ModifierState},
|
||||
keyboard::{KeyboardState, KeyboardStateId},
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
utils::errorfmt::ErrorFmt,
|
||||
wire::{wl_keyboard::*, WlKeyboardId, WlSurfaceId},
|
||||
xkbcommon::XkbCommonError,
|
||||
},
|
||||
kbvm::Components,
|
||||
std::{cell::Cell, rc::Rc},
|
||||
thiserror::Error,
|
||||
};
|
||||
|
|
@ -138,14 +139,14 @@ impl WlKeyboard {
|
|||
}
|
||||
}
|
||||
|
||||
fn send_modifiers(&self, serial: u64, mods: &ModifierState) {
|
||||
fn send_modifiers(&self, serial: u64, mods: &Components) {
|
||||
self.seat.client.event(Modifiers {
|
||||
self_id: self.id,
|
||||
serial: serial as _,
|
||||
mods_depressed: mods.mods_depressed,
|
||||
mods_latched: mods.mods_latched,
|
||||
mods_locked: mods.mods_locked,
|
||||
group: mods.group,
|
||||
mods_depressed: mods.mods_pressed.0,
|
||||
mods_latched: mods.mods_latched.0,
|
||||
mods_locked: mods.mods_locked.0,
|
||||
group: mods.group.0,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,11 +110,11 @@ impl ZwpVirtualKeyboardV1RequestHandler for ZwpVirtualKeyboardV1 {
|
|||
|
||||
fn modifiers(&self, req: Modifiers, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let kb_state = &mut *self.kb_state.borrow_mut();
|
||||
kb_state.mods.mods_depressed = req.mods_depressed;
|
||||
kb_state.mods.mods_latched = req.mods_latched;
|
||||
kb_state.mods.mods_locked = req.mods_locked;
|
||||
kb_state.mods.mods_effective = req.mods_depressed | req.mods_latched | req.mods_locked;
|
||||
kb_state.mods.group = req.group;
|
||||
kb_state.mods.mods_pressed.0 = req.mods_depressed;
|
||||
kb_state.mods.mods_latched.0 = req.mods_latched;
|
||||
kb_state.mods.mods_locked.0 = req.mods_locked;
|
||||
kb_state.mods.group_locked.0 = req.group;
|
||||
kb_state.mods.update_effective();
|
||||
self.for_each_kb(|serial, surface, kb| {
|
||||
kb.on_mods_changed(serial, surface.id, &kb_state);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue