- Show the on-screen keyboard when the password dialog opens or reopens, and hide it on submit. Tapping the password field reopens it after a manual Hide. - Route Chandra Remote text commits (including Enter, Tab, and Backspace) into the password dialog while it is up. - Keymap: read hex keysyms (`0x31`, `0x20ac`, `0xffb7`) from libxkbcommon text-v1 keymaps, and accept `0x01000000`-range Unicode keysyms. - Keymap: keypad keys produce digits when NumLock (Mod2) is active. - Tests cover hex keysym parsing, NumLock keypad mapping, and the OSK/remote-text flow.
This commit is contained in:
1 parent
40c5d6722c
commit
851c39d827
5 files changed
+218
-12
No files matched your search
@@ -77,7 +77,83 @@ test "keysym names" {
|
||||
assert_eq(@polkit.keysym_char("EuroSign"), Some('€'))
|
||||
assert_eq(@polkit.keysym_char("U0431"), Some('б'))
|
||||
assert_eq(@polkit.keysym_char("0x10020ac"), Some('€'))
|
||||
assert_eq(@polkit.keysym_char("0x010020ac"), Some('€'))
|
||||
assert_eq(@polkit.keysym_char("0x1000431"), Some('б'))
|
||||
assert_eq(@polkit.keysym_char("Shift_L"), None)
|
||||
// Numeric hex keysyms emitted by libxkbcommon's text v1 serialization.
|
||||
assert_eq(@polkit.keysym_char("0x64"), Some('d'))
|
||||
assert_eq(@polkit.keysym_char("0x44"), Some('D'))
|
||||
assert_eq(@polkit.keysym_char("0x31"), Some('1'))
|
||||
assert_eq(@polkit.keysym_char("0x21"), Some('!'))
|
||||
assert_eq(@polkit.keysym_char("0x20"), Some(' '))
|
||||
assert_eq(@polkit.keysym_char("0X7e"), Some('~'))
|
||||
assert_eq(@polkit.keysym_char("0xe4"), Some('ä'))
|
||||
assert_eq(@polkit.keysym_char("0xc4"), Some('Ä'))
|
||||
assert_eq(@polkit.keysym_char("0x20ac"), Some('€'))
|
||||
assert_eq(@polkit.keysym_char("0xffb7"), Some('7'))
|
||||
assert_eq(@polkit.keysym_char("0xffae"), Some('.'))
|
||||
assert_eq(@polkit.keysym_char("0xffab"), Some('+'))
|
||||
// Non-printable X11 keysyms (editing, modifiers, dead keys, XF86 media keys, controls).
|
||||
assert_eq(@polkit.keysym_char("0xff08"), None)
|
||||
assert_eq(@polkit.keysym_char("0xff0d"), None)
|
||||
assert_eq(@polkit.keysym_char("0xff1b"), None)
|
||||
assert_eq(@polkit.keysym_char("0xffe1"), None)
|
||||
assert_eq(@polkit.keysym_char("0xfe52"), None)
|
||||
assert_eq(@polkit.keysym_char("0x1008ff11"), None)
|
||||
assert_eq(@polkit.keysym_char("0x1005ff70"), None)
|
||||
assert_eq(@polkit.keysym_char("0x000a"), None)
|
||||
assert_eq(@polkit.keysym_char("0x007f"), None)
|
||||
}
|
||||
|
||||
///| Hex keysyms as emitted by libxkbcommon 1.13's xkb_keymap_get_as_string(XKB_KEYMAP_FORMAT_TEXT_V1).
|
||||
let xkb_hex_text : String =
|
||||
#|xkb_keymap {
|
||||
#|xkb_keycodes "evdev_aliases(qwerty)" {
|
||||
#| minimum = 8;
|
||||
#| maximum = 255;
|
||||
#| <AE01> = 10;
|
||||
#| <BKSP> = 22;
|
||||
#| <AD03> = 26;
|
||||
#| <RTRN> = 36;
|
||||
#| <AC03> = 40;
|
||||
#| <AC11> = 48;
|
||||
#| <SPCE> = 65;
|
||||
#| <KP7> = 79;
|
||||
#|};
|
||||
#|xkb_symbols "pc_us_inet(evdev)" {
|
||||
#| key <AE01> { [ 0x31, 0x21 ] };
|
||||
#| key <BKSP> { [ 0xff08, 0xff08 ] };
|
||||
#| key <AD03> { [ 0x65, 0x45, 0x20ac, 0x20ac ] };
|
||||
#| key <RTRN> { [ 0xff0d ] };
|
||||
#| key <AC03> { [ 0x64, 0x44 ] };
|
||||
#| key <AC11> { [ 0xe4, 0xc4 ] };
|
||||
#| key <SPCE> { [ 0x20 ] };
|
||||
#| key <KP7> { [ 0xff95, 0xffb7 ] };
|
||||
#|};
|
||||
#|};
|
||||
|
||||
///|
|
||||
test "libxkbcommon hex keysym keymap: ASCII, Shift, Caps Lock, AltGr, NumLock and non-printable keys" {
|
||||
let km = @polkit.Keymap::from_text(xkb_hex_text)
|
||||
assert_eq(km.char_for(32U, 0U, 0U), Some('d'))
|
||||
assert_eq(km.char_for(32U, @polkit.mask_shift, 0U), Some('D'))
|
||||
assert_eq(km.char_for(32U, @polkit.mask_lock, 0U), Some('D'))
|
||||
assert_eq(km.char_for(32U, @polkit.mask_shift | @polkit.mask_lock, 0U), Some('d'))
|
||||
assert_eq(km.char_for(2U, 0U, 0U), Some('1'))
|
||||
assert_eq(km.char_for(2U, @polkit.mask_shift, 0U), Some('!'))
|
||||
assert_eq(km.char_for(2U, @polkit.mask_lock, 0U), Some('1'))
|
||||
assert_eq(km.char_for(18U, 0U, 0U), Some('e'))
|
||||
assert_eq(km.char_for(18U, @polkit.mask_altgr, 0U), Some('€'))
|
||||
assert_eq(km.char_for(40U, 0U, 0U), Some('ä'))
|
||||
assert_eq(km.char_for(40U, @polkit.mask_lock, 0U), Some('Ä'))
|
||||
assert_eq(km.char_for(57U, 0U, 0U), Some(' '))
|
||||
// Keypad 7: Home without NumLock, '7' with NumLock, back to Home with NumLock+Shift.
|
||||
assert_eq(km.char_for(71U, 0U, 0U), None)
|
||||
assert_eq(km.char_for(71U, @polkit.mask_numlock, 0U), Some('7'))
|
||||
assert_eq(km.char_for(71U, @polkit.mask_numlock | @polkit.mask_shift, 0U), None)
|
||||
// Non-printable editing keys stay None.
|
||||
assert_eq(km.char_for(14U, 0U, 0U), None)
|
||||
assert_eq(km.char_for(28U, 0U, 0U), None)
|
||||
}
|
||||
|
||||
///|
|
||||
|
||||
Reference in new issue
Block a user