From 193f5b4526378dc9140c3b38d31702b56e4a359e Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Mon, 24 Jun 2024 17:38:44 -0700 Subject: [PATCH] increase the delay to ms level. non-systemd event loop may not be able to handle high accuracy timer. So increase to ms level to make it more reliable. --- im/pinyin/pinyin.cpp | 2 +- im/table/state.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/im/pinyin/pinyin.cpp b/im/pinyin/pinyin.cpp index 1d72ef9..439574c 100644 --- a/im/pinyin/pinyin.cpp +++ b/im/pinyin/pinyin.cpp @@ -2095,7 +2095,7 @@ void PinyinEngine::keyEvent(const InputMethodEntry &entry, KeyEvent &event) { if (!puncStr.empty()) { // forward the original key is the best choice. state->cancelLastEvent_ = instance()->eventLoop().addTimeEvent( - CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 300, 1, + CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 3000, 1, [this, ref = inputContext->watch(), puncStr = puncStr](EventSourceTime *, uint64_t) { if (auto *inputContext = ref.get()) { diff --git a/im/table/state.cpp b/im/table/state.cpp index f8a5889..7faa934 100644 --- a/im/table/state.cpp +++ b/im/table/state.cpp @@ -967,7 +967,7 @@ void TableState::keyEvent(const InputMethodEntry &entry, KeyEvent &event) { // forward the original key is the best choice. cancelLastEvent_ = engine_->instance()->eventLoop().addTimeEvent( - CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 300, 1, + CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 3000, 1, [this, ref = inputContext->watch(), puncStr = puncStr](EventSourceTime *, uint64_t) { if (auto *inputContext = ref.get()) {