Skip to main content
Version: 0.5.0
Docs.rs: ironrdp-input

Overview

The ironrdp-input crate provides helpers to build RDP FastPath input events from high-level operations. It maintains input state (keys pressed, mouse buttons down) and generates correct event sequences, including:
  • Suppressing duplicate events
  • Synthesizing key release before re-press
  • Handling extended scancodes
  • Managing Unicode keyboard input
  • Tracking mouse position and buttons

Core Types

Database

The Database is the main entry point. It tracks input state and produces RDP events.

Operation

High-level input operations submitted to the database.

Scancode

Keyboard scan code with optional extended flag. Example:

MouseButton

MousePosition

WheelRotations

Mouse wheel delta. Positive values = scroll up/right, negative = scroll down/left.

Usage Example

Basic Keyboard Input

Mouse Input

Unicode Input

State Deduplication

The database automatically suppresses no-op events:

Releasing All Inputs

Useful when losing focus or disconnecting.

Lock Key Synchronization

Generate a synchronization event to match client and server lock key states. Example:

State Types

Bit arrays for tracking input state efficiently:
  • KeyboardState: 512 bits (256 standard + 256 extended scancodes)
  • MouseButtonsState: 5 bits (one per mouse button)
Example:

Advanced: Web Integration

Dependencies

  • ironrdp-pdu - PDU structures for FastPathInputEvent (public)
  • bitvec - Efficient bit arrays for state tracking
  • smallvec - Stack-allocated vectors for events

Usage Notes

Event Ordering:
The database maintains correct event ordering. For example, if a key is already pressed and pressed again, the database synthesizes a release before the new press:
Extended Scancodes:
Extended scancodes (0xE0 prefix) are common for keys like arrows, right Ctrl/Alt, and navigation keys. Use Scancode::from_u16() with the 0xE000 bit set:
Mouse Coordinates:
RDP mouse coordinates are in the range [0, 65535] and are normalized to the desktop size. Scale physical pixels accordingly:

See Also