- 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
@@ -313,6 +313,7 @@ fn ChandraCompositor::open_auth(self : ChandraCompositor, l : AuthLink, v : @pol
|
||||
// Nothing else gets the keyboard or the pointer while it is up.
|
||||
self.set_kbd_focus(None)
|
||||
self.leave_pointer()
|
||||
self.osk_sync()
|
||||
self.damage.mark_full()
|
||||
}
|
||||
|
||||
@@ -330,6 +331,7 @@ fn ChandraCompositor::close_auth(self : ChandraCompositor, dismiss : Bool) -> Un
|
||||
Some(w) => if self.windows.contains(w) { self.set_kbd_focus(Some(w)) }
|
||||
None => ()
|
||||
}
|
||||
self.osk_sync()
|
||||
self.damage.mark_full()
|
||||
}
|
||||
None => ()
|
||||
@@ -448,7 +450,13 @@ fn ChandraCompositor::auth_input(self : ChandraCompositor, ui : AuthUi, ev : @ne
|
||||
PointerButton(button, pressed) =>
|
||||
if pressed && button == 272U {
|
||||
match self.auth_hit(ui) {
|
||||
Some(f) => self.auth_act(ui, ui.view.activate(f))
|
||||
Some(f) => {
|
||||
if f == Field && self.osk_enabled {
|
||||
self.osk_manual_hide = false
|
||||
self.osk_sync()
|
||||
}
|
||||
self.auth_act(ui, ui.view.activate(f))
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -920,3 +920,68 @@ test "Face unlock window: snaps, Apply, then the password dialog gets the keyboa
|
||||
@sys.unlink(hpath)
|
||||
comp.close()
|
||||
}
|
||||
|
||||
///|
|
||||
test "hex-keysym keymap, OSK auto-open/reopen, touch OSK tap, and remote_commit_text type into the password dialog" {
|
||||
let hex_keymap : String =
|
||||
#|xkb_keymap {
|
||||
#|xkb_keycodes "evdev_aliases(qwerty)" {
|
||||
#| minimum = 8;
|
||||
#| maximum = 255;
|
||||
#| <ESC> = 9;
|
||||
#| <BKSP> = 22;
|
||||
#| <AD03> = 26;
|
||||
#| <AD04> = 27;
|
||||
#| <AD09> = 32;
|
||||
#| <RTRN> = 36;
|
||||
#| <AC03> = 40;
|
||||
#| <AB07> = 58;
|
||||
#| <SPCE> = 65;
|
||||
#|};
|
||||
#|xkb_symbols "pc_us_inet(evdev)" {
|
||||
#| key <ESC> { [ 0xff1b ] };
|
||||
#| key <BKSP> { [ 0xff08, 0xff08 ] };
|
||||
#| key <AD03> { [ 0x65, 0x45 ] };
|
||||
#| key <AD04> { [ 0x72, 0x52 ] };
|
||||
#| key <AD09> { [ 0x6f, 0x4f ] };
|
||||
#| key <RTRN> { [ 0xff0d ] };
|
||||
#| key <AC03> { [ 0x64, 0x44 ] };
|
||||
#| key <AB07> { [ 0x6d, 0x4d ] };
|
||||
#| key <SPCE> { [ 0x20 ] };
|
||||
#|};
|
||||
#|};
|
||||
let r = rig("hex-osk-remote", None, "")
|
||||
let comp = r.comp
|
||||
comp.server.set_keymap(@utf8.encode(hex_keymap))
|
||||
comp.set_osk_enabled(true)
|
||||
assert_false(comp.osk_is_visible())
|
||||
let (_, ok) = comp.control_command("auth-demo")
|
||||
assert_true(ok)
|
||||
assert_true(r.settle(fn() { comp.auth_view().map(v => v.phase == Asking).unwrap_or(false) }))
|
||||
assert_true(comp.osk_is_visible())
|
||||
let d = r.view()
|
||||
// Physical/hardware keyboard typing through hex-keysym keymap.
|
||||
auth_type(comp, "de")
|
||||
assert_eq(d.typed(), 2)
|
||||
// Touch OSK tap reaches the password field.
|
||||
let (mx, my) = comp.osk_key_center("m").unwrap()
|
||||
click_at(comp, mx, my, 20U)
|
||||
assert_eq(d.typed(), 3)
|
||||
// Chandra Remote text commit routes to the password dialog.
|
||||
assert_true(comp.remote_commit_text("o"))
|
||||
assert_eq(d.typed(), 4)
|
||||
auth_alt(comp, 19U)
|
||||
assert_true(d.reveal)
|
||||
assert_eq(d.field_text(), "demo")
|
||||
// Manual OSK Hide dismisses it; tapping the password field brings it back.
|
||||
let (hx, hy) = comp.osk_key_center("Hide").unwrap()
|
||||
click_at(comp, hx, hy, 25U)
|
||||
assert_false(comp.osk_is_visible())
|
||||
auth_click(comp, Field)
|
||||
assert_true(comp.osk_is_visible())
|
||||
// Submitting authorizes and hides the OSK automatically.
|
||||
auth_press(comp, 28U)
|
||||
assert_true(r.settle(fn() { comp.auth_view() is None && comp.auth_demos.length() == 0 }))
|
||||
assert_false(comp.osk_is_visible())
|
||||
comp.close()
|
||||
}
|
||||
@@ -2129,6 +2129,27 @@ pub fn ChandraCompositor::remote_commit_text(
|
||||
text : String,
|
||||
) -> Bool {
|
||||
self.note_activity(@sys.monotonic_ms())
|
||||
if self.auth is Some(_) {
|
||||
for ch in text {
|
||||
match self.auth {
|
||||
Some(cur) =>
|
||||
match ch {
|
||||
'\n' | '\r' =>
|
||||
self.auth_act(cur, cur.view.key(@polkit.key_enter, 0U, None))
|
||||
'\t' => self.auth_act(cur, cur.view.key(@polkit.key_tab, 0U, None))
|
||||
'\u{08}' | '\u{7f}' =>
|
||||
self.auth_act(cur, cur.view.key(@polkit.key_backspace, 0U, None))
|
||||
_ if ch.to_int() >= 0x20 =>
|
||||
self.auth_act(cur, cur.view.key(0U, 0U, Some(ch)))
|
||||
_ => ()
|
||||
}
|
||||
None => break
|
||||
}
|
||||
}
|
||||
self.damage.mark_full()
|
||||
self.frame_changed = true
|
||||
return true
|
||||
}
|
||||
if self.shell.popup_open() {
|
||||
for ch in text {
|
||||
let name = match ch {
|
||||
|
||||
Reference in new issue
Block a user