windows: Remove the use of DispatcherQueue and fix FileSaveDialog unresponsive issue (#17946)

Closes #17069, closes #12410


With the help of @kennykerr (Creator of C++/WinRT and the crate
`windows-rs`, Engineer on the Windows team at Microsoft) and @riverar
(Windows Development expert), we discovered that this bug only occurs
when an IME with a candidate window, such as Microsoft Pinyin IME, is
active. In this case, the `FileSaveDialog` becomes unresponsive—while
the dialog itself appears to be functioning, it doesn't accept any mouse
or keyboard input.

After a period of debugging and testing, I found that this issue only
arises when using `DispatcherQueue` to dispatch runnables on the UI
thread. After @kennykerr’s further investigation, Kenny identified that
this is a bug with `DispatcherQueue`, and he recommended to avoid using
`DispatcherQueue`. Given the uncertainty about whether Microsoft will
address this bug in the foreseeable future, I have removed the use of
`DispatcherQueue`.

Co-authored-by: Kenny <kenny@kennykerr.ca>

Release Notes:

- N/A

---------

Co-authored-by: Kenny <kenny@kennykerr.ca>
This commit is contained in:
Junkui Zhang 2024-09-18 06:45:08 +08:00 committed by GitHub
parent 56f9e4c7b3
commit fbb402ef12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 104 additions and 71 deletions

View file

@ -490,7 +490,6 @@ features = [
"implement",
"Foundation_Numerics",
"Storage",
"System",
"System_Threading",
"UI_ViewManagement",
"Wdk_System_SystemServices",
@ -521,6 +520,7 @@ features = [
"Win32_UI_Input_Ime",
"Win32_UI_Input_KeyboardAndMouse",
"Win32_UI_Shell",
"Win32_UI_Shell_Common",
"Win32_UI_WindowsAndMessaging",
]