Remote: forward the physical keyboard and hide the phone OSK while typing
CI / test (push) Failing after 1m7s
CI / test (push) Failing after 1m7s
The web UI now sends key events without opening the KB bar, and releases held keys on blur, hide or disconnect. The first remote keystroke (web or VNC) turns the on-screen keyboard off; it comes back when the last typing client disconnects, unless the user toggled it by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e62f1b8cb
commit
0356413bb2
7 files changed
+411
-26
No files matched your search
+4
-22
@@ -45,6 +45,7 @@ typedef struct {
|
||||
uint64_t last_send_ms;
|
||||
uint8_t prev_btn_mask;
|
||||
uint32_t held_mods;
|
||||
int osk_suppressed;
|
||||
int z_init;
|
||||
z_stream z;
|
||||
tjhandle tj;
|
||||
@@ -512,32 +513,12 @@ static int rfb_handle_message(RfbClient *c) {
|
||||
if (read_exact(c->fd, buf, 7) < 0) return -1;
|
||||
int down = buf[0] != 0;
|
||||
uint32_t sym = get_be32(buf + 3);
|
||||
if (down) remote_osk_suppress_acquire(c->app, &c->osk_suppressed);
|
||||
uint32_t ev = 0, uc = 0;
|
||||
int sh = 0, mod_bit = 0;
|
||||
if (!keysym_to_evdev(sym, &ev, &sh, &mod_bit, &uc)) break;
|
||||
if (uc != 0) {
|
||||
if (down) {
|
||||
uint8_t u8[8];
|
||||
size_t n = 0;
|
||||
if (uc < 0x80u) { u8[n++] = (uint8_t)uc; }
|
||||
else if (uc < 0x800u) {
|
||||
u8[n++] = (uint8_t)(0xC0u | (uc >> 6));
|
||||
u8[n++] = (uint8_t)(0x80u | (uc & 0x3Fu));
|
||||
} else if (uc < 0x10000u) {
|
||||
u8[n++] = (uint8_t)(0xE0u | (uc >> 12));
|
||||
u8[n++] = (uint8_t)(0x80u | ((uc >> 6) & 0x3Fu));
|
||||
u8[n++] = (uint8_t)(0x80u | (uc & 0x3Fu));
|
||||
} else {
|
||||
u8[n++] = (uint8_t)(0xF0u | (uc >> 18));
|
||||
u8[n++] = (uint8_t)(0x80u | ((uc >> 12) & 0x3Fu));
|
||||
u8[n++] = (uint8_t)(0x80u | ((uc >> 6) & 0x3Fu));
|
||||
u8[n++] = (uint8_t)(0x80u | (uc & 0x3Fu));
|
||||
}
|
||||
char cmd[48];
|
||||
memcpy(cmd, "input-text ", 11);
|
||||
hex_encode(u8, n, cmd + 11);
|
||||
ctl_fire(&c->app->ctl, cmd);
|
||||
}
|
||||
if (down) remote_send_codepoint(&c->app->ctl, uc);
|
||||
break;
|
||||
}
|
||||
if (mod_bit) {
|
||||
@@ -754,6 +735,7 @@ void rfb_handle_client(RemoteApp *app, int fd) {
|
||||
|
||||
done:
|
||||
if (c->held_mods) rfb_send_mods(c, 0u);
|
||||
remote_osk_suppress_release(app, &c->osk_suppressed);
|
||||
if (c->prev_btn_mask & 0x01u) ctl_fire(&app->ctl, "input-btn 272 0");
|
||||
if (c->prev_btn_mask & 0x02u) ctl_fire(&app->ctl, "input-btn 274 0");
|
||||
if (c->prev_btn_mask & 0x04u) ctl_fire(&app->ctl, "input-btn 273 0");
|
||||
|
||||
Reference in new issue
Block a user