1
0
Fork 0
forked from wry/wry

seat: store pressed keys in a vector

This commit is contained in:
Julian Orth 2024-04-12 14:50:57 +02:00
parent 2cef936b12
commit 8d43eebc3d
4 changed files with 45 additions and 5 deletions

View file

@ -56,7 +56,7 @@ use {
utils::{
asyncevent::AsyncEvent, clonecell::CloneCell, copyhashmap::CopyHashMap,
errorfmt::ErrorFmt, linkedlist::LinkedNode, numcell::NumCell, rc_eq::rc_eq,
smallmap::SmallMap, transform_ext::TransformExt,
smallmap::SmallMap, transform_ext::TransformExt, vecset::VecSet,
},
wire::{
wl_seat::*, ExtIdleNotificationV1Id, WlDataDeviceId, WlKeyboardId, WlPointerId,
@ -65,7 +65,7 @@ use {
},
xkbcommon::{XkbKeymap, XkbState},
},
ahash::{AHashMap, AHashSet},
ahash::AHashMap,
jay_config::keyboard::mods::Modifiers,
smallvec::SmallVec,
std::{
@ -128,7 +128,7 @@ pub struct WlSeatGlobal {
pointer_stack_modified: Cell<bool>,
found_tree: RefCell<Vec<FoundNode>>,
keyboard_node: CloneCell<Rc<dyn Node>>,
pressed_keys: RefCell<AHashSet<u32>>,
pressed_keys: RefCell<VecSet<u32>>,
bindings: RefCell<AHashMap<ClientId, AHashMap<WlSeatId, Rc<WlSeat>>>>,
x_data_devices: SmallMap<XIpcDeviceId, Rc<XIpcDevice>, 1>,
data_devices: RefCell<AHashMap<ClientId, AHashMap<WlDataDeviceId, Rc<WlDataDevice>>>>,

View file

@ -742,10 +742,10 @@ impl WlSeatGlobal {
// Focus callbacks
impl WlSeatGlobal {
pub fn focus_surface(&self, surface: &WlSurface) {
let pressed_keys: Vec<_> = self.pressed_keys.borrow().iter().copied().collect();
let pressed_keys = &*self.pressed_keys.borrow();
let serial = surface.client.next_serial();
self.surface_kb_event(Version::ALL, surface, |k| {
k.send_enter(serial, surface.id, &pressed_keys)
k.send_enter(serial, surface.id, pressed_keys)
});
let ModifierState {
mods_depressed,