Skip to content

Commit

Permalink
Fix unreliable cancel punctuation change.
Browse files Browse the repository at this point in the history
For short timer need to set accuracy (when event loop is backed by systemd)
  • Loading branch information
wengxt committed Jun 25, 2024
1 parent 9e57f69 commit a59d8fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion im/pinyin/pinyin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, 0,
CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 300, 1,
[this, ref = inputContext->watch(),
puncStr = puncStr](EventSourceTime *, uint64_t) {
if (auto *inputContext = ref.get()) {
Expand Down
2 changes: 1 addition & 1 deletion im/table/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, 0,
CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 300, 1,
[this, ref = inputContext->watch(),
puncStr = puncStr](EventSourceTime *, uint64_t) {
if (auto *inputContext = ref.get()) {
Expand Down

0 comments on commit a59d8fa

Please sign in to comment.