77388dab8a
XrdpIme never actually became the active engine after the private main loop rewrite - ibus_bus_set_global_engine() returned FALSE every time. Confirmed the actual D-Bus error by bypassing the boolean-only wrapper and calling SetGlobalEngine directly: Set global engine failed: Timeout was reached Root cause: xrdp_input_enable() was being marshaled onto the IBus thread via g_main_context_invoke(), on the (wrong) theory that it "must run on the IBus thread" like commit_text does. But set_global_engine() blocks synchronously waiting for ibus-daemon's reply, and ibus-daemon can't reply until it finishes instantiating the engine - which means calling back into our own IBusFactory's "create-engine" over the same connection. Running xrdp_input_enable() on the IBus thread left that thread stuck blocked inside its own synchronous call, unable to service the nested callback ibus-daemon needed answered before it could reply - a self-deadlock, resolved only by ibus-daemon's own timeout. Calling xrdp_input_enable() directly from chansrv's thread instead (matching the original pre-rewrite code, which did this without apparent reason but happened to sidestep the deadlock) leaves the IBus thread free to answer the nested call while chansrv's thread blocks. GDBusConnection sync calls are documented thread-safe to issue from any thread, so this doesn't need marshaling despite `bus` otherwise being owned by the IBus thread. Verified end-to-end against a real ibus-daemon and a focused GTK entry widget (not just the D-Bus trace): ibus engine now correctly reports "XrdpIme" after a send, and 27 characters fired with zero delay between them - the exact rapid-fire pattern that used to drop most commits under the old design - landed in order with zero drops and zero duplicates. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>