1
0
Fork 0
forked from wry/wry

input: ignored caps_lock and num_lock during modifire matching

This commit is contained in:
Julian Orth 2022-07-27 07:55:48 +02:00
parent 6b4d16aba7
commit 6bc7330989
2 changed files with 10 additions and 2 deletions

View file

@ -150,6 +150,9 @@ impl Seat {
/// The closure is invoked when the user presses the last key of the modified keysym.
/// Note that the keysym is calculated without modifiers applied. To perform an action
/// when `SHIFT+k` is pressed, use `SHIFT | SYM_k` not `SHIFT | SYM_K`.
///
/// CapsLock and NumLock are ignored during modifier evaluation. Therefore, bindings
/// containing these modifiers will never be invoked.
pub fn bind<T: Into<ModifiedKeySym>, F: Fn() + 'static>(self, mod_sym: T, f: F) {
get!().bind(self, mod_sym, f)
}

View file

@ -31,7 +31,11 @@ use {
wire::WlDataOfferId,
xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP},
},
jay_config::keyboard::{mods::Modifiers, syms::KeySym, ModifiedKeySym},
jay_config::keyboard::{
mods::{Modifiers, CAPS, NUM},
syms::KeySym,
ModifiedKeySym,
},
smallvec::SmallVec,
std::rc::Rc,
};
@ -339,7 +343,8 @@ impl WlSeatGlobal {
let old_mods = kb_state.mods();
let keysyms = kb_state.unmodified_keysyms(key);
for &sym in keysyms {
if let Some(mods) = self.shortcuts.get(&(old_mods.mods_effective, sym)) {
let mods = old_mods.mods_effective & !(CAPS.0 | NUM.0);
if let Some(mods) = self.shortcuts.get(&(mods, sym)) {
shortcuts.push(ModifiedKeySym {
mods,
sym: KeySym(sym),