Skip to content

Commit c0e09c3

Browse files
committed
Set nicola timer accuracy and set the constrain for nicola timer.
1 parent 6d7d720 commit c0e09c3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/config.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <fcitx-config/configuration.h>
1111
#include <fcitx-config/enum.h>
12+
#include <fcitx-config/option.h>
1213
#include <fcitx-utils/i18n.h>
1314
#include <fcitx/candidatelist.h>
1415

@@ -643,7 +644,8 @@ FCITX_CONFIGURATION(
643644
fcitx::KeyListConstrain(fcitx::KeyConstrainFlag::AllowModifierLess)};
644645
fcitx::Option<std::string> kanaLayoutRoKey{
645646
this, "KanaLayoutRoKey", _("Ro key for kana layout"), ""};
646-
fcitx::Option<int> nicolaTime{this, "NicolaTime", _("Nicola time"), 200};);
647+
fcitx::Option<int, fcitx::IntConstrain> nicolaTime{
648+
this, "NicolaTime", _("Nicola time"), 200, {5, 1000}};);
647649

648650
FCITX_CONFIGURATION(AnthyCommnadConfig,
649651
fcitx::Option<std::string> addWordCommand{

src/nicola.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void NicolaConvertor::setAlarm(int time_msec) {
230230
time_msec = 1000;
231231

232232
timer_ = state_.instance()->eventLoop().addTimeEvent(
233-
CLOCK_MONOTONIC, fcitx::now(CLOCK_MONOTONIC) + time_msec * 1000, 0,
233+
CLOCK_MONOTONIC, fcitx::now(CLOCK_MONOTONIC) + time_msec * 1000, 1,
234234
[this](fcitx::EventSourceTime *, uint64_t) {
235235
processTimeout();
236236
return true;

0 commit comments

Comments
 (0)