1
0
Fork 0
forked from wry/wry

config: allow configuring the pointer-revert-key

This commit is contained in:
Julian Orth 2025-05-09 16:39:44 +02:00
parent 7b62909bb4
commit 599f0a8ae5
12 changed files with 98 additions and 4 deletions

View file

@ -95,6 +95,7 @@ use {
wire_ei::EiSeatId,
},
ahash::AHashMap,
jay_config::keyboard::syms::{KeySym, SYM_Escape},
smallvec::SmallVec,
std::{
cell::{Cell, RefCell},
@ -215,6 +216,7 @@ pub struct WlSeatGlobal {
ui_drag_highlight: Cell<Option<Rect>>,
keyboard_node_serial: Cell<u64>,
tray_popups: CopyHashMap<(TrayItemId, XdgPopupId), Rc<dyn DynTrayItem>>,
revert_key: Cell<KeySym>,
}
const CHANGE_CURSOR_MOVED: u32 = 1 << 0;
@ -288,6 +290,7 @@ impl WlSeatGlobal {
ei_seats: Default::default(),
ui_drag_highlight: Default::default(),
tray_popups: Default::default(),
revert_key: Cell::new(SYM_Escape),
});
slf.pointer_cursor.set_owner(slf.clone());
let seat = slf.clone();
@ -1071,6 +1074,10 @@ impl WlSeatGlobal {
};
tl.tl_set_pinned(true, pinned);
}
pub fn set_pointer_revert_key(&self, key: KeySym) {
self.revert_key.set(key);
}
}
impl CursorUserOwner for WlSeatGlobal {

View file

@ -50,7 +50,7 @@ use {
input::SwitchEvent,
keyboard::{
mods::{CAPS, Modifiers, NUM, RELEASE},
syms::{KeySym, SYM_Escape},
syms::KeySym,
},
},
kbvm::{ModifierMask, state_machine::Event},
@ -836,7 +836,7 @@ impl WlSeatGlobal {
let mut revert_pointer_to_default = false;
for props in keysyms {
let sym = props.keysym().0;
if sym == SYM_Escape.0 && mods == 0 {
if sym == self.revert_key.get().0 && mods == 0 {
revert_pointer_to_default = true;
}
if !self.state.lock.locked.get() {