fix(ibus): make the X11 frontend fail truthfully

This commit is contained in:
2026-08-14 22:10:40 +09:00
parent 77c6dd66ca
commit f2fb71cd89
3 changed files with 121 additions and 22 deletions

View File

@@ -20,7 +20,7 @@
enum
{
Maxconnections = 16,
Maxconnections = 64,
Calltimeout = 4000,
Starttimeout = 8000,
Stoptimeout = 3000,
@@ -312,7 +312,8 @@ startdaemon(Daemon *d, char *program, char *mapdir)
setenv("XDG_CONFIG_HOME", d->config, 1) < 0 ||
setenv("HOME", d->home, 1) < 0 || unsetenv("DISPLAY") < 0 ||
unsetenv("DBUS_SESSION_BUS_ADDRESS") < 0 ||
unsetenv("IBUS_ADDRESS") < 0){
unsetenv("IBUS_ADDRESS") < 0 ||
unsetenv("IBUS_ADDRESS_FILE") < 0){
dprintf(STDERR_FILENO, "set daemon environment: %s\n",
strerror(errno));
_exit(126);
@@ -1346,6 +1347,9 @@ runlifecycle(Daemon *d)
goto out;
if(!createcontext(c1, a, sizeof a) || !createcontext(c2, b, sizeof b))
goto out;
if(!unknowncall(c1, a, "ProcessKeyEvent", DBUS_ERROR_INVALID_ARGS) ||
!unknowncall(c1, a, "SetEngine", DBUS_ERROR_INVALID_ARGS))
goto out;
if(!unknowncall(c1, "/org/freedesktop/IBus/InputContext_missing",
"FocusIn", DBUS_ERROR_UNKNOWN_OBJECT))
goto out;
@@ -1477,6 +1481,22 @@ runpolicy(Daemon *d)
if(!expectkey(c1, &s1, a, 'n', Ctrlmask, 1, NULL,
"zero-capability language") ||
!expectkey(c1, &s1, a, 'k', 0, 1, NULL, "zero-capability key") ||
!emptycall(c1, &s1, a, "Reset") ||
!nosignal(&s1, "zero-capability Reset") ||
!expectkey(c1, &s1, a, 'k', 0, 1, NULL,
"zero-capability before PASSWORD") ||
!contentcall(c1, &s1, a, Purposepassword, 0) ||
!nosignal(&s1, "zero-capability PASSWORD") ||
!contentcall(c1, &s1, a, Purposefree, 0) ||
!nosignal(&s1, "zero-capability leave PASSWORD") ||
!expectkey(c1, &s1, a, 'k', 0, 1, NULL,
"zero-capability before FocusOut") ||
!emptycall(c1, &s1, a, "FocusOut") ||
!nosignal(&s1, "zero-capability FocusOut") ||
!emptycall(c1, &s1, a, "FocusIn") ||
!nosignal(&s1, "zero-capability refocus") ||
!expectkey(c1, &s1, a, 'k', 0, 1, NULL,
"zero-capability after refocus") ||
!capcall(c1, &s1, a, 1<<1) || !nosignal(&s1, "non-preedit cap") ||
!capcall(c1, &s1, a, Cappreedit|(1<<1)) ||
!preedit(&s1, a, "k", 1, 1, "enable inline") ||