From 2b4532359dc07162b7a5611a72ab59e6ccb935cf Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Thu, 7 Sep 2023 14:25:04 +0900 Subject: [PATCH] Resolves #2237374 Fix to commit selected candidate with OSK --- ibus-anthy-HEAD.patch | 85 +++++++++++++++++++++++++++++++++++++++++++ ibus-anthy.spec | 5 ++- 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/ibus-anthy-HEAD.patch b/ibus-anthy-HEAD.patch index fb0f978..bd3dbba 100644 --- a/ibus-anthy-HEAD.patch +++ b/ibus-anthy-HEAD.patch @@ -763,3 +763,88 @@ index 2ebf894..20786f2 100644 -- 2.41.0 +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 fb99ddc..48056d3 100644 --- a/ibus-anthy.spec +++ b/ibus-anthy.spec @@ -18,7 +18,7 @@ Name: ibus-anthy Version: 1.5.14 -Release: 13%{?dist} +Release: 14%{?dist} Summary: The Anthy engine for IBus input platform License: GPL-2.0-or-later URL: https://github.com/ibus/ibus/wiki @@ -156,6 +156,9 @@ make -C data check %{_datadir}/installed-tests/%{name} %changelog +* Thu Sep 07 2023 Takao Fujiwara - 1.5.14-14 +- Resolves #2237374 Fix to commit selected candidate with OSK + * Thu Jul 13 2023 Takao Fujiwara - 1.5.14-13 - Resolves #2015149 Commit candidate text with clicking on candidate list in OSK