Remote: forward the physical keyboard and hide the phone OSK while typing
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:
nandiandClaude Opus 5.5 committed 2026-11-29 14:27:17 -08:00
1 parent 5e62f1b8cb
commit 0356413bb2
7 files changed
+411 -26

No files matched your search

+47
View File
@@ -203,6 +203,46 @@ int ctl_fire(CtlConn *c, const char *line) {
return ctl_cmd(c, line, NULL, 0);
}
void remote_osk_suppress_acquire(RemoteApp *app, int *client_flag) {
if (*client_flag) return;
pthread_mutex_lock(&app->osk_mu);
if (!*client_flag) {
*client_flag = 1;
if (app->osk_suppress_refs == 0) {
char reply[64] = {0};
if (ctl_cmd(&app->ctl, "osk status", reply, sizeof reply) == 0 &&
strncmp(reply, "ok on", 5) == 0) {
ctl_fire(&app->ctl, "osk off");
app->osk_restore_on_end = 1;
} else {
app->osk_restore_on_end = 0;
}
}
app->osk_suppress_refs++;
}
pthread_mutex_unlock(&app->osk_mu);
}
void remote_osk_suppress_release(RemoteApp *app, int *client_flag) {
if (!*client_flag) return;
pthread_mutex_lock(&app->osk_mu);
if (*client_flag) {
*client_flag = 0;
if (app->osk_suppress_refs > 0) app->osk_suppress_refs--;
if (app->osk_suppress_refs == 0 && app->osk_restore_on_end) {
app->osk_restore_on_end = 0;
ctl_fire(&app->ctl, "osk on");
}
}
pthread_mutex_unlock(&app->osk_mu);
}
void remote_osk_manual_override(RemoteApp *app) {
pthread_mutex_lock(&app->osk_mu);
app->osk_restore_on_end = 0;
pthread_mutex_unlock(&app->osk_mu);
}
/* ---- Shared-memory framebuffer reader ---- */
void fb_reader_init(FbReader *r, const char *shm_path) {
@@ -605,6 +645,7 @@ int main(int argc, char **argv) {
app.running = &g_running;
pthread_mutex_init(&app.cfg_mu, NULL);
pthread_mutex_init(&app.ping_mu, NULL);
pthread_mutex_init(&app.osk_mu, NULL);
snprintf(app.config_path, sizeof app.config_path, "%s", config_path);
snprintf(app.web_dir, sizeof app.web_dir, "%s", web_dir);
snprintf(app.shm_path, sizeof app.shm_path, "%s", shm_path);
@@ -761,6 +802,12 @@ int main(int argc, char **argv) {
if (web_ts_fd >= 0) close(web_ts_fd);
if (vnc_lo_fd >= 0) close(vnc_lo_fd);
if (web_lo_fd >= 0) close(web_lo_fd);
pthread_mutex_lock(&app.osk_mu);
if (app.osk_restore_on_end) {
app.osk_restore_on_end = 0;
ctl_fire(&app.ctl, "osk on");
}
pthread_mutex_unlock(&app.osk_mu);
ctl_close(&app.ctl);
unlink(pid_path);
return 0;