Skip to content

Windows - RDP Unresponsive #1194

@Michto8

Description

@Michto8

Describe the bug
The application works fine, but after:

  1. opening an RDP session on Windows Server,
  2. launching the application,
  3. closing the session or minimizing the RDP client,
  4. reopening/restoring the session after several seconds,
  5. the application window then appears as "not responding".

Steps To Reproduce
Example tested: examples/minimize.rs https://github.com/tauri-apps/tao/blob/dev/examples/minimize.rs
Dependency version: tao = 0.34.6
cargo build --target=i686-pc-windows-msvc --release

Screenshots
Image

Platform and Versions
OS: Microsoft Windows Server 2016 Standard - 14393
Rustc: rustc 1.93.1 (01f6ddf75 2026-02-11)

Additional context
Hello, and thank you to the authors and maintainers of tao/tauri for your excellent work .

After debugging, I discovered the freeze originates from a deadlock in the keyboard_callback function in src/platform_impl/windows/event_loop.rs.

I asked GitHub Copilot to analyze what could be blocking at that level; here's the analysis:
When Windows closes a session, WM_KILLFOCUS is sent to the window.
With keyboard_callback active, process_message calls synthesize_kbd_state(Released) which generates a KeyboardInput(Released) event for each physically pressed key.
Each of these events is dispatched via send_event to the user handler synchronously.
During Windows session shutdown/minimize, certain Win32 operations triggered in this handler (SetWindowPos, internal SendMessageW calls, etc.) can block because Windows is terminating the session process — hence the "not responding" state.

By adding this guard clause after the if !is_keyboard_related block in keyboard_callback, the freeze no longer occurs:
`if !is_keyboard_related {
// We return early to avoid a deadlock from locking the window state
// when not appropriate.
return;
}

if msg == win32wm::WM_SETFOCUS || msg == win32wm::WM_KILLFOCUS {
return;
}`

Is an explicit filter of WM_SETFOCUS / WM_KILLFOCUS at this level the right approach in Tao ?

Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions