File backport-commit-on-switchingIM.diff of Package fcitx5-unikey

diff --git a/src/unikey-im.cpp b/src/unikey-im.cpp
index 232d686..65dc5cf 100644
--- a/src/unikey-im.cpp
+++ b/src/unikey-im.cpp
@@ -325,6 +325,10 @@ void UnikeyEngine::activate(const InputMethodEntry &,
 
 void UnikeyEngine::deactivate(const InputMethodEntry &entry,
                               InputContextEvent &event) {
+    if (event.type() == EventType::InputContextSwitchInputMethod) {
+        auto *state = event.inputContext()->propertyFor(&factory_);
+        state->commit();
+    }
     reset(entry, event);
 }
 
openSUSE Build Service is sponsored by