Skip to content

Commit 92b4073

Browse files
wengxtmokapsing
authored andcommitted
Update the message and the logic for block message
1. option update now goes with showCustomInputMethodInfo, no need to block with keyboard event. 2. select schema shouldn't be the trigger of block message. 3. block message after success/error to prevent certain flood case if schema is invalid.
1 parent 73c3638 commit 92b4073

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/rimeengine.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ void RimeEngine::notify(RimeSessionId session, const std::string &messageType,
568568
const char *icon = "";
569569
const char *tipId = "";
570570
int timeout = 3000;
571+
bool blockMessage = false;
571572
if (messageType == "deploy") {
572573
tipId = "fcitx-rime-deploy";
573574
icon = "fcitx_rime_deploy";
@@ -585,10 +586,12 @@ void RimeEngine::notify(RimeSessionId session, const std::string &messageType,
585586
}
586587
updateSchemaMenu();
587588
refreshStatusArea(0);
589+
blockMessage = true;
588590
} else if (messageValue == "failure") {
589591
needRefreshAppOption_ = false;
590592
message = _("Rime has encountered an error. "
591593
"See log for details.");
594+
blockMessage = true;
592595
}
593596
} else if (messageType == "option") {
594597
updateStatusArea(session);
@@ -603,6 +606,10 @@ void RimeEngine::notify(RimeSessionId session, const std::string &messageType,
603606
notifications->call<INotifications::showTip>(
604607
tipId, _("Rime"), icon, _("Rime"), message, timeout);
605608
}
609+
// Block message after error / success.
610+
if (blockMessage) {
611+
blockNotificationFor(30000);
612+
}
606613
}
607614

608615
RimeState *RimeEngine::state(InputContext *ic) {

src/rimestate.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ void RimeState::selectSchema(const std::string &schema) {
148148
if (api->is_maintenance_mode()) {
149149
return;
150150
}
151-
engine_->blockNotificationFor(30000);
152151
api->set_option(session(), RIME_ASCII_MODE, false);
153152
api->select_schema(session(), schema.data());
154153
}
@@ -460,7 +459,6 @@ void RimeState::updateUI(InputContext *ic, bool keyRelease) {
460459
inputPanel.setAuxDown(Text());
461460
}
462461
if (newEmptyExceptAux && lastMode_ != subMode()) {
463-
engine_->blockNotificationFor(30000);
464462
engine_->instance()->showInputMethodInformation(ic);
465463
ic->updateUserInterface(UserInterfaceComponent::StatusArea);
466464
}

0 commit comments

Comments
 (0)