head 1.2; access; symbols; locks; strict; comment @# @; 1.2 date 2021.02.27.20.10.32; author ryoon; state dead; branches; next 1.1; commitid 55Q5do5Y1wXV5oJC; 1.1 date 2021.02.17.15.26.01; author ryoon; state Exp; branches; next ; commitid CBNLMIhbVPUgQ4IC; desc @@ 1.2 log @fcitx5-skk: Update to 5.0.4 Changelog: * Add input mode floating window. * Update translations. @ text @$NetBSD: patch-current-mode-popup.diff,v 1.1 2021/02/17 15:26:01 ryoon Exp $ * Add floating status window. From upstream git repo. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 971a4ff..31310ea 100644 --- src/CMakeLists.txt +++ src/CMakeLists.txt @@@@ -12,7 +12,7 @@@@ target_link_libraries(skk 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 --git a/src/skk.conf.in b/src/skk.conf.in index 139e557..0a100b3 100644 --- src/skk.conf.in +++ src/skk.conf.in @@@@ -3,5 +3,5 @@@@ Name=Skk Icon=fcitx-skk LangCode=ja Addon=skk -Label=skk +Label=SKK Configurable=True diff --git a/src/skk.cpp b/src/skk.cpp index a689252..4b92571 100644 --- src/skk.cpp +++ src/skk.cpp @@@@ -562,6 +562,7 @@@@ SkkState::SkkState(SkkEngine *engine, InputContext *ic) 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 @@@@ bool SkkState::handleCandidate(KeyEvent &keyEvent) { } 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 @@@@ void SkkState::updateUI() { } } 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 @@@@ void SkkState::copyTo(InputContextProperty *property) { 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 --git a/src/skk.h b/src/skk.h index 051dd5c..d0cb401 100644 --- src/skk.h +++ src/skk.h @@@@ -142,6 +142,7 @@@@ class SkkEngine final : public InputMethodEngine { 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 @@@@ class SkkState final : public InputContextProperty { InputContext *ic_; GObjectUniquePtr context_; bool modeChanged_ = false; + SkkInputMode lastMode_ = SKK_INPUT_MODE_DEFAULT; + bool lastIsEmpty_ = true; }; } // namespace fcitx @ 1.1 log @inputmethod/fcitx5-skk: import fcitx5-skk-5.0.3 fcitx5-skk is an input method engine for Fcitx5, which uses libskk as its backend. @ text @d1 1 a1 1 $NetBSD$ @