diff --git a/src/lib/fcitx/instance.cpp b/src/lib/fcitx/instance.cpp index 271e20a1..d2e9aa23 100644 --- a/src/lib/fcitx/instance.cpp +++ b/src/lib/fcitx/instance.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -2490,6 +2491,14 @@ void Instance::showInputMethodInformation(InputContext *ic) { d->showInputMethodInformation(ic); } +void Instance::showCustomInputMethodInformation(InputContext *ic, + const std::string &message) { + FCITX_DEBUG() << "Input method switched"; + FCITX_D(); + auto *inputState = ic->propertyFor(&d->inputStateFactory_); + inputState->showInputMethodInformation(message); +} + bool Instance::checkUpdate() const { FCITX_D(); return (isInFlatpak() && fs::isreg("/app/.updated")) || diff --git a/src/lib/fcitx/instance.h b/src/lib/fcitx/instance.h index f0769b6e..5e1102e4 100644 --- a/src/lib/fcitx/instance.h +++ b/src/lib/fcitx/instance.h @@ -8,6 +8,7 @@ #define _FCITX_INSTANCE_H_ #include +#include #include #include #include @@ -441,13 +442,34 @@ class FCITXCORE_EXPORT Instance : public ConnectableObject { * Show a small popup with input popup window with current input method * information. * + * The popup will be hidden after certain amount of time. + * * This is useful for input method that has multiple sub modes. It can be * called with switching sub modes within the input method. * + * The behavior is controlled by global config. + * * @param ic input context. */ void showInputMethodInformation(InputContext *ic); + /** + * Show a small popup with input popup window with current input method + * information. + * + * The popup will be hidden after certain amount of time. The popup will + * always be displayed, regardless of the showInputMethodInformation in + * global config. + * + * This is useful for input method that has internal switches. + * + * @param ic input context. + * @param message message string to be displayed + * @since 5.1.11 + */ + void showCustomInputMethodInformation(InputContext *ic, + const std::string &message); + /** * Check if need to invoke Instance::refresh. *