Skip to content

Commit

Permalink
Set nicola timer accuracy and set the constrain for nicola timer.
Browse files Browse the repository at this point in the history
  • Loading branch information
wengxt committed Oct 20, 2024
1 parent 6d7d720 commit c0e09c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <fcitx-config/configuration.h>
#include <fcitx-config/enum.h>
#include <fcitx-config/option.h>
#include <fcitx-utils/i18n.h>
#include <fcitx/candidatelist.h>

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

FCITX_CONFIGURATION(AnthyCommnadConfig,
fcitx::Option<std::string> addWordCommand{
Expand Down
2 changes: 1 addition & 1 deletion src/nicola.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void NicolaConvertor::setAlarm(int time_msec) {
time_msec = 1000;

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

0 comments on commit c0e09c3

Please sign in to comment.