Shorten Windows IME submit timeout

This commit is contained in:
H-Chris233 committed 2026-05-21 09:52:54 +08:00
1 parent d71f73193a
commit e939e75a19
2 files changed
+8 -3

No files matched your search

@@ -3,8 +3,8 @@ use std::time::Duration;
use crate::windows_ime_protocol::ImeSubmitStatus;
pub const IME_CLIENT_WAIT_TIMEOUT: Duration = Duration::from_millis(700);
const IME_OWNER_THREAD_MESSAGE_TIMEOUT_MS: u64 = 3000;
const IME_ASYNC_EDIT_SESSION_TIMEOUT_MS: u64 = 3000;
const IME_OWNER_THREAD_MESSAGE_TIMEOUT_MS: u64 = 2000;
const IME_ASYNC_EDIT_SESSION_TIMEOUT_MS: u64 = 2000;
const IME_SUBMIT_TIMEOUT_MARGIN_MS: u64 = 1000;
const IME_NATIVE_ASYNC_COMMIT_TIMEOUT_MS: u64 =
IME_OWNER_THREAD_MESSAGE_TIMEOUT_MS + IME_ASYNC_EDIT_SESSION_TIMEOUT_MS;
@@ -395,6 +395,11 @@ mod tests {
assert!(IME_SUBMIT_TIMEOUT > Duration::from_millis(IME_NATIVE_ASYNC_COMMIT_TIMEOUT_MS));
}
#[test]
fn submit_timeout_stays_within_followup_stall_budget() {
assert_eq!(IME_SUBMIT_TIMEOUT, Duration::from_millis(5000));
}
#[test]
fn wait_pipe_error_mapping_treats_missing_or_busy_pipe_as_no_ready_client() {
assert_eq!(
@@ -12,7 +12,7 @@ namespace {
constexpr wchar_t kMessageWindowClassName[] = L"OpenLessImeMessageWindow";
constexpr UINT kSubmitTextMessage = WM_APP + 1;
constexpr UINT kSubmitTextTimeoutMs = 3000;
constexpr UINT kSubmitTextTimeoutMs = 2000;
struct SubmitTextRequest {
const std::wstring* session_id = nullptr;