1
0
Fork 0
forked from wry/wry

seat: add KeyboardState and dynamically switch between states

This commit is contained in:
Julian Orth 2024-04-14 13:16:18 +02:00
parent 134e3cc316
commit 5e2cdef388
15 changed files with 406 additions and 222 deletions

View file

@ -74,7 +74,7 @@ use {
ExtForeignToplevelListV1Id, JayRenderCtxId, JaySeatEventsId, JayWorkspaceWatcherId,
ZwpLinuxDmabufFeedbackV1Id,
},
xkbcommon::{KeymapId, XkbContext, XkbKeymap},
xkbcommon::{KeyboardStateIds, XkbContext, XkbKeymap, XkbState},
xwayland::{self, XWaylandEvent},
},
ahash::AHashMap,
@ -175,6 +175,7 @@ pub struct State {
pub subsurface_ids: SubsurfaceIds,
pub wait_for_sync_obj: Rc<WaitForSyncObj>,
pub explicit_sync_enabled: Cell<bool>,
pub keyboard_state_ids: KeyboardStateIds,
}
// impl Drop for State {
@ -244,15 +245,8 @@ pub struct DeviceHandlerData {
pub device: Rc<dyn InputDevice>,
pub syspath: Option<String>,
pub devnode: Option<String>,
pub keymap_id: Cell<Option<KeymapId>>,
pub keymap: CloneCell<Option<Rc<XkbKeymap>>>,
}
impl DeviceHandlerData {
pub fn set_keymap(&self, keymap: &Rc<XkbKeymap>) {
self.keymap_id.set(Some(keymap.id));
self.keymap.set(Some(keymap.clone()));
}
pub xkb_state: CloneCell<Option<Rc<RefCell<XkbState>>>>,
}
pub struct ConnectorData {