diff -Nru fcitx5-skk-5.0.3/CMakeLists.txt fcitx5-skk-5.0.4/CMakeLists.txt --- fcitx5-skk-5.0.3/CMakeLists.txt 2021-01-15 18:58:33.000000000 +0000 +++ fcitx5-skk-5.0.4/CMakeLists.txt 2021-02-19 14:37:20.000000000 +0000 @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.4.0) -project(fcitx5-skk VERSION 5.0.3) +project(fcitx5-skk VERSION 5.0.4) find_package(ECM 1.0.0 REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) diff -Nru fcitx5-skk-5.0.3/debian/changelog fcitx5-skk-5.0.4/debian/changelog --- fcitx5-skk-5.0.3/debian/changelog 2021-01-15 18:57:53.000000000 +0000 +++ fcitx5-skk-5.0.4/debian/changelog 2021-02-19 14:37:44.000000000 +0000 @@ -1,3 +1,10 @@ +fcitx5-skk (5.0.4-1) unstable; urgency=medium + + * Team upload. + * New upstream release + + -- Shengjing Zhu Fri, 19 Feb 2021 22:37:44 +0800 + fcitx5-skk (5.0.3-1) unstable; urgency=medium * Team upload. diff -Nru fcitx5-skk-5.0.3/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in fcitx5-skk-5.0.4/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in --- fcitx5-skk-5.0.3/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in 2021-01-15 18:58:33.000000000 +0000 +++ fcitx5-skk-5.0.4/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in 2021-02-19 14:37:20.000000000 +0000 @@ -10,6 +10,7 @@ https://github.com/fcitx/fcitx5-skk/issues Fcitx + diff -Nru fcitx5-skk-5.0.3/po/da.po fcitx5-skk-5.0.4/po/da.po --- fcitx5-skk-5.0.3/po/da.po 2021-01-15 18:58:33.000000000 +0000 +++ fcitx5-skk-5.0.4/po/da.po 2021-02-19 14:37:20.000000000 +0000 @@ -3,15 +3,15 @@ # This file is distributed under the same license as the fcitx5-skk package. # # Translators: -# scootergrisen, 2020 +# scootergrisen, 2021 # msgid "" msgstr "" "Project-Id-Version: fcitx5-skk\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" -"POT-Creation-Date: 2020-12-04 11:17-0800\n" +"POT-Creation-Date: 2021-01-12 20:24+0000\n" "PO-Revision-Date: 2020-05-22 22:25+0000\n" -"Last-Translator: scootergrisen, 2020\n" +"Last-Translator: scootergrisen, 2021\n" "Language-Team: Danish (https://www.transifex.com/fcitx/teams/12005/da/)\n" "Language: da\n" "MIME-Version: 1.0\n" @@ -21,28 +21,28 @@ #. i18n: file: gui/adddictdialog.ui:73 #. i18n: ectx: property (text), widget (QLabel, hostLabel) -#: rc.cpp:12 +#: rc.cpp:15 #, kde-format msgid "&Host:" msgstr "&Vært:" #. i18n: file: gui/adddictdialog.ui:45 #. i18n: ectx: property (text), widget (QLabel, pathLabel) -#: rc.cpp:9 +#: rc.cpp:12 #, kde-format msgid "&Path:" msgstr "&Sti:" #. i18n: file: gui/adddictdialog.ui:90 #. i18n: ectx: property (text), widget (QLabel, portLabel) -#: rc.cpp:18 +#: rc.cpp:21 #, kde-format msgid "&Port:" msgstr "&Port:" #. i18n: file: gui/adddictdialog.ui:25 #. i18n: ectx: property (text), widget (QLabel, typeLabel) -#: rc.cpp:6 +#: rc.cpp:9 #, kde-format msgid "&Type:" msgstr "&Type:" @@ -77,7 +77,7 @@ #. i18n: file: gui/adddictdialog.ui:14 #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog) -#: rc.cpp:3 +#: rc.cpp:6 #, kde-format msgid "Dialog" msgstr "Dialog" @@ -100,14 +100,14 @@ #. i18n: file: gui/adddictdialog.ui:126 #. i18n: ectx: property (text), widget (QLabel, encodingLabel) -#: rc.cpp:21 +#: rc.cpp:24 #, kde-format msgid "Encoding:" -msgstr "" +msgstr "Kodning:" #. i18n: file: gui/dictwidget.ui:14 #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget) -#: rc.cpp:24 +#: rc.cpp:3 #, kde-format msgid "Form" msgstr "Formular" @@ -218,7 +218,7 @@ #. i18n: file: gui/adddictdialog.ui:83 #. i18n: ectx: property (text), widget (QLineEdit, hostLineEdit) -#: rc.cpp:15 +#: rc.cpp:18 #, kde-format msgid "localhost" msgstr "localhost" diff -Nru fcitx5-skk-5.0.3/src/CMakeLists.txt fcitx5-skk-5.0.4/src/CMakeLists.txt --- fcitx5-skk-5.0.3/src/CMakeLists.txt 2021-01-15 18:58:33.000000000 +0000 +++ fcitx5-skk-5.0.4/src/CMakeLists.txt 2021-02-19 14:37:20.000000000 +0000 @@ -12,7 +12,7 @@ set_target_properties(skk PROPERTIES PREFIX "") install(TARGETS skk DESTINATION "${CMAKE_INSTALL_LIBDIR}/fcitx5") fcitx5_translate_desktop_file(skk.conf.in skk.conf) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/skk.conf" "${CMAKE_CURRENT_BINARY_DIR}/skk.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/fcitx5/inputmethod") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/skk.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/fcitx5/inputmethod") fcitx5_translate_desktop_file(skk-addon.conf.in skk-addon.conf) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/skk-addon.conf" RENAME skk.conf DESTINATION "${FCITX_INSTALL_PKGDATADIR}/addon") diff -Nru fcitx5-skk-5.0.3/src/skk.conf.in fcitx5-skk-5.0.4/src/skk.conf.in --- fcitx5-skk-5.0.3/src/skk.conf.in 2021-01-15 18:58:33.000000000 +0000 +++ fcitx5-skk-5.0.4/src/skk.conf.in 2021-02-19 14:37:20.000000000 +0000 @@ -3,5 +3,5 @@ Icon=fcitx-skk LangCode=ja Addon=skk -Label=skk +Label=SKK Configurable=True diff -Nru fcitx5-skk-5.0.3/src/skk.cpp fcitx5-skk-5.0.4/src/skk.cpp --- fcitx5-skk-5.0.3/src/skk.cpp 2021-01-15 18:58:33.000000000 +0000 +++ fcitx5-skk-5.0.4/src/skk.cpp 2021-02-19 14:37:20.000000000 +0000 @@ -562,6 +562,7 @@ skk_context_set_period_style(context, *engine_->config().punctuationStyle); skk_context_set_input_mode(context, *engine_->config().inputMode); + lastMode_ = skk_context_get_input_mode(context); g_signal_connect(context, "notify::input-mode", G_CALLBACK(SkkState::input_mode_changed_cb), this); g_signal_connect(context, "retrieve_surrounding_text", @@ -673,15 +674,14 @@ } void SkkState::updateUI() { - auto context = context_.get(); - auto &inputPanel = ic_->inputPanel(); - inputPanel.reset(); + auto context = context_.get(); SkkCandidateList *skkCandidates = skk_context_get_candidates(context); + + std::unique_ptr candidateList; if (skk_candidate_list_get_page_visible(skkCandidates)) { - inputPanel.setCandidateList( - std::make_unique(engine_, ic_)); + candidateList = std::make_unique(engine_, ic_); } if (auto str = UniqueCPtr{skk_context_poll_output(context)}) { @@ -690,6 +690,32 @@ } } Text preedit = skkContextGetPreedit(context); + + // Skk almost filter every key, which makes it calls updateUI on release. + // We add an additional check here for checking if the UI is empty or not. + // If previous state is empty and the current state is also empty, we'll + // ignore the UI update. This makes the input method info not disappear + // immediately up key release. + bool lastIsEmpty = lastIsEmpty_; + bool newIsEmpty = preedit.empty() && !candidateList; + lastIsEmpty_ = newIsEmpty; + + // Ensure we are not composing any text. + if (modeChanged_ && newIsEmpty) { + inputPanel.reset(); + engine_->instance()->showInputMethodInformation(ic_); + return; + } + + if (lastIsEmpty && newIsEmpty) { + return; + } + + inputPanel.reset(); + if (candidateList) { + inputPanel.setCandidateList(std::move(candidateList)); + } + if (ic_->capabilityFlags().test(CapabilityFlag::Preedit)) { inputPanel.setClientPreedit(preedit); ic_->updatePreedit(); @@ -723,11 +749,17 @@ skk_context_get_input_mode(context())); } -void SkkState::updateInputMode() { engine_->modeAction()->update(ic_); } +void SkkState::updateInputMode() { + engine_->modeAction()->update(ic_); + auto newMode = skk_context_get_input_mode(context()); + if (lastMode_ != newMode) { + lastMode_ = newMode; + modeChanged_ = true; + } +} void SkkState::input_mode_changed_cb(GObject *, GParamSpec *, SkkState *skk) { skk->updateInputMode(); - skk->modeChanged_ = true; } gboolean SkkState::retrieve_surrounding_text_cb(GObject *, gchar **text, diff -Nru fcitx5-skk-5.0.3/src/skk.h fcitx5-skk-5.0.4/src/skk.h --- fcitx5-skk-5.0.3/src/skk.h 2021-01-15 18:58:33.000000000 +0000 +++ fcitx5-skk-5.0.4/src/skk.h 2021-02-19 14:37:20.000000000 +0000 @@ -142,6 +142,7 @@ auto &factory() { return factory_; } auto &config() { return config_; } + auto instance() { return instance_; } void setConfig(const RawConfig &config) override { config_.load(config, true); safeSaveAsIni(config_, "conf/skk.conf"); @@ -213,6 +214,8 @@ InputContext *ic_; GObjectUniquePtr context_; bool modeChanged_ = false; + SkkInputMode lastMode_ = SKK_INPUT_MODE_DEFAULT; + bool lastIsEmpty_ = true; }; } // namespace fcitx