From fe2b41f1ee741c115b22d284709e3a1ab72dd928 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Thu, 7 Sep 2023 13:23:24 +0900 Subject: [PATCH] Resolves #2237374 Fix to commit selected candidate with OSK --- ibus-anthy-HEAD.patch | 85 +++++++++++++++++++++++++++++++++++++++++++ ibus-anthy.spec | 6 ++- 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/ibus-anthy-HEAD.patch b/ibus-anthy-HEAD.patch index e69de29..141a2e8 100644 --- a/ibus-anthy-HEAD.patch +++ b/ibus-anthy-HEAD.patch @@ -0,0 +1,85 @@ +From 137f5d7b0eff9a6e631685a567d06b992146e362 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Thu, 7 Sep 2023 12:57:47 +0900 +Subject: [PATCH] engine: Fix to commit selected candidate with OSK + +Updating preedit after clicking a candidate on IBus candidate window +has an idle time so committing the preedit has to wait for the idle time. + +BUG=rhbz#2237374 +--- + engine/python2/engine.py | 9 ++++++++- + engine/python3/engine.py | 9 ++++++++- + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/engine/python2/engine.py b/engine/python2/engine.py +index 80cfa86..42d4dc1 100644 +--- a/engine/python2/engine.py ++++ b/engine/python2/engine.py +@@ -154,6 +154,7 @@ class Engine(IBus.EngineSimple): + # IBus lookup window prior to the preedit and selecting a candidate + # causes the commmit instead of the selection. + self.__osk_mode = False ++ self.__selected_preedit_commit = False + if hasattr(IBus, 'InputPurpose'): + self.__has_input_purpose = True + try: +@@ -812,7 +813,10 @@ class Engine(IBus.EngineSimple): + prev_cursor_pos = self.__cursor_pos + self.__on_key_number(keyval) + if self.__osk_mode and prev_cursor_pos == self.__cursor_pos: +- self.__on_key_return() ++ if self.__idle_id != 0: ++ self.__selected_preedit_commit = True ++ else: ++ self.__on_key_return() + + def __commit_string(self, text): + self.__reset() +@@ -1328,6 +1332,9 @@ class Engine(IBus.EngineSimple): + else: + self.__update_convert_chars() + self.__idle_id = 0 ++ if self.__osk_mode and self.__selected_preedit_commit: ++ self.__on_key_return() ++ self.__selected_preedit_commit = False + + def __on_key_return(self): + if self.__preedit_ja_string.is_empty(): +diff --git a/engine/python3/engine.py b/engine/python3/engine.py +index 7c0d283..4b50a01 100644 +--- a/engine/python3/engine.py ++++ b/engine/python3/engine.py +@@ -155,6 +155,7 @@ class Engine(IBus.EngineSimple): + # IBus lookup window prior to the preedit and selecting a candidate + # causes the commmit instead of the selection. + self.__osk_mode = False ++ self.__selected_preedit_commit = False + if hasattr(IBus, 'InputPurpose'): + self.__has_input_purpose = True + try: +@@ -807,7 +808,10 @@ class Engine(IBus.EngineSimple): + prev_cursor_pos = self.__cursor_pos + self.__on_key_number(keyval) + if self.__osk_mode and prev_cursor_pos == self.__cursor_pos: +- self.__on_key_return() ++ if self.__idle_id != 0: ++ self.__selected_preedit_commit = True ++ else: ++ self.__on_key_return() + + def __commit_string(self, text): + self.__reset() +@@ -1323,6 +1327,9 @@ class Engine(IBus.EngineSimple): + else: + self.__update_convert_chars() + self.__idle_id = 0 ++ if self.__osk_mode and self.__selected_preedit_commit: ++ self.__on_key_return() ++ self.__selected_preedit_commit = False + + def __on_key_return(self): + if self.__preedit_ja_string.is_empty(): +-- +2.41.0 + diff --git a/ibus-anthy.spec b/ibus-anthy.spec index 63ba817..ba61d12 100644 --- a/ibus-anthy.spec +++ b/ibus-anthy.spec @@ -18,7 +18,7 @@ Name: ibus-anthy Version: 1.5.15 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Anthy engine for IBus input platform License: GPL-2.0-or-later URL: https://github.com/ibus/ibus/wiki @@ -26,6 +26,7 @@ Source0: https://github.com/ibus/ibus-anthy/releases/download/%{version}/ # Upstreamed patches. # Patch0: %%{name}-HEAD.patch +Patch0: %{name}-HEAD.patch Patch1: %{name}-1938129-default-hiragana.patch BuildRequires: anthy-unicode-devel @@ -154,6 +155,9 @@ make -C data check %{_datadir}/installed-tests/%{name} %changelog +* Thu Sep 07 2023 Takao Fujiwara - 1.5.15-2 +- Resolves #2237374 Fix to commit selected candidate with OSK + * Tue Aug 22 2023 Takao Fujiwara - 1.5.15-1 - Bump to 1.5.15