Liyi Meng 525be513be chansrv: Make XrdpIme survive reconnects and stop native-client input being eaten
Three fixes in input_ibus.c, found by capturing the IBus session bus while a
native Mac RDP client and a Guacamole (browser) client typed Chinese.

1. Keep the IBus thread alive across client disconnects.
   xrdp_input_unicode_destroy() used to stop the IBus thread and its private
   GMainContext on every disconnect, and unicode_init() started a new pair on
   every reconnect. ibus_bus_new() returns a process-wide singleton whose
   GDBusConnection stays bound to the context that was thread-default when it
   was first created, so a reconnect got the old connection back, bound to a
   context nobody iterates. ibus-daemon's CreateEngine call on our factory was
   never dispatched and every ibus_bus_set_global_engine() timed out ("failed
   to switch global engine to XrdpIme", 15 s each), losing all Unicode input
   until the session was fully logged out. (Same connection name on both
   connects in the bus trace.) destroy() now only restores the user's engine
   and drains the queue on the IBus thread (xrdp_input_reset_cb) and waits,
   bounded, for that; init() takes its existing "already ready" path.

2. Do not re-request XrdpIme while an instance is being created.
   Two characters arriving ~30 us apart each called set_global_engine(): the
   second found the name already XrdpIme but no instance yet, fell through,
   and made ibus destroy the instance under construction and build another
   ("IM enabled / IM disabled / IM enabled"), dropping what was queued for the
   first. A request made within XRDP_INPUT_ENGINE_CREATE_WAIT_US (2 s) is now
   treated as in flight and left alone; an older one is still treated as a
   stale name and re-set.

3. Measure the commit debounce from when the text was queued.
   "Quiet" was measured from the last raw key only. A user who pauses between
   typing the pinyin and confirming it (270 ms in the capture) makes the raw
   keys already quiet when the commit arrives, so it was committed at once and
   the client's cleanup Backspaces, one per leaked key and arriving 1-2 ms
   later, deleted the committed text and kept going into what was there
   before. Quiet is now measured from the later of the last raw key and the
   queue time, so every commit waits at least XRDP_INPUT_COMMIT_QUIET_US and
   any Backspace inside the window extends it (still capped by MAX_WAIT).

Tested against a real xrdp session in the agent-cn image, through guacd with a
script that mimics the native client (raw keys, pause, Unicode commit,
Backspaces after a variable delay): with the old code any delay >= 8 ms lost
the commit ("我是" became "wo"); now delays up to 90 ms pass, 110 ms and up
still fail. A fresh session and a reconnect both commit correctly, and the
"failed to switch global engine" timeouts are gone. Confirmed working with the
native client by hand. Costs every Unicode commit 100 ms of latency.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 00:12:39 +00:00
2026-08-17 08:58:29 +00:00
2026-04-06 10:29:17 -07:00
2025-05-06 11:30:36 +01:00
2024-02-21 09:24:48 +00:00
2025-05-21 11:34:34 +01:00
2026-07-02 17:33:45 +09:00
2023-06-23 15:12:51 +01:00
2025-11-25 15:43:38 +01:00
2025-02-27 15:04:11 +00:00
2026-01-30 18:54:57 -08:00
2026-04-17 12:23:17 +01:00
2026-04-17 12:23:17 +01:00
2026-04-17 12:23:17 +01:00
2022-03-16 10:16:39 +09:00
2024-05-01 09:26:58 +01:00

Build Status Gitter Apache-License

Latest Version

xrdp - an open source RDP server

Overview

xrdp provides a graphical login to remote machines using Microsoft Remote Desktop Protocol (RDP). xrdp accepts connections from a variety of RDP clients:

  • FreeRDP
  • rdesktop
  • KRDC
  • NeutrinoRDP
  • Windows MSTSC (Microsoft Terminal Services Client, aka mstsc.exe)
  • Microsoft Remote Desktop (found on Microsoft Store, which is distinct from MSTSC)

Many of these work on some or all of Windows, Mac OS, iOS, and/or Android.

RDP transport is encrypted using TLS by default.

demo

Features

Remote Desktop Access

  • Connect to a Linux desktop using RDP from anywhere (requires xorgxrdp Xorg module)
  • Reconnect to an existing session
  • Session resizing (both on-connect and on-the-fly)
  • RDP/VNC proxy (connect to another RDP/VNC server via xrdp)

Access to Remote Resources

Supported Platforms

xrdp primarily targets GNU/Linux operating system. x86 (including x86-64) and ARM processors are most mature architecture to run xrdp on. See also Platform Support Tier.

Some components such as xorgxrdp and RemoteFX codec have special optimization for x86 using SIMD instructions. So running xrdp on x86 processors will get fully accelerated experience.

Quick Start

Most Linux distributions should distribute the latest release of xrdp in their repository. You would need xrdp and xorgxrdp packages for the best experience. It is recommended that xrdp depends on xorgxrdp, so it should be sufficient to install xrdp. If xorgxrdp is not provided, use Xvnc server.

xrdp listens on 3389/tcp. Make sure your firewall accepts connection to 3389/tcp from where you want to access.

Ubuntu / Debian

apt install xrdp

Fedora, RHEL and derivatives

If you're not running Fedora, make sure to enable EPEL packages first.

dnf install epel-release

(All systems) Install xrdp with:-

dnf install xrdp

Compiling

See also https://github.com/neutrinolabs/xrdp/wiki#building-from-sources

Prerequisites

To compile xrdp from the packaged sources, you need basic build tools - a compiler (gcc or clang) and the make program. Additionally, you would need openssl-devel, pam-devel, libX11-devel, libXfixes-devel, libXrandr-devel. More additional software would be needed depending on your configuration.

To compile xrdp from a checked out git repository, you would additionally need autoconf, automake, libtool and pkg-config.

Get the source and build it

If compiling from the packaged source, unpack the tarball and change to the resulting directory.

If compiling from a checked out repository, please make sure you've got the submodules cloned too (use git clone --recursive https://github.com/neutrinolabs/xrdp)

Then run following commands to compile and install xrdp:

./bootstrap
./configure
make
sudo make install

If you want to use audio redirection, you need to build and install additional pulseaudio modules. The build instructions can be found at wiki.

Directory Structure

xrdp
├── common ······ common code
├── docs ········ documentation
├── fontutils ··· font handling utilities
├── genkeymap ··· keymap generator
├── instfiles ··· installable data file
├── keygen ······ xrdp RSA key pair generator
├── libpainter ·· painter library
├── librfxcodec · RFX codec library
├── libxrdp ····· core RDP protocol implementation
├── m4 ·········· Autoconf macros
├── mc ·········· media center module
├── neutrinordp · RDP client module for proxying RDP connections using NeutrinoRDP
├── pkgconfig ··· pkg-config configuration
├── scripts ····· build scripts
├┬─ sesman ······ session manager for xrdp
|├── chansrv ···· channel server for xrdp
|├── libsesman ·· Code common to sesman and its related executables
|└── tools ······ session management tools for sys admins
├── tests ······· tests for the code
├┬─ tools ······· tools
|└┬─ devel ······ development tools
| ├── gtcp_proxy  GTK app that forwards TCP connections to a remote host
| └── tcp_proxy · CLI app that forwards TCP connections to a remote host
├── vnc ········· VNC client module for xrdp
├── vrplayer ···· QT player redirecting video/audio to clients over xrdpvr channel
├── xrdp ········ main server code
├── xrdpapi ····· virtual channel API
├── xrdpvr ······ API for playing media over RDP
└── xup ········· xorgxrdp client module
S
Description
No description provided
Readme 17 MiB
Languages
C 96.3%
M4 1.2%
Shell 1%
C++ 0.8%
Makefile 0.6%