Resolves #2237374 Fix to commit selected candidate with OSK

This commit is contained in:
Takao Fujiwara 2023-09-07 13:23:24 +09:00
parent 8eceb8e421
commit fe2b41f1ee
2 changed files with 90 additions and 1 deletions

View File

@ -0,0 +1,85 @@
From 137f5d7b0eff9a6e631685a567d06b992146e362 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
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

View File

@ -18,7 +18,7 @@
Name: ibus-anthy Name: ibus-anthy
Version: 1.5.15 Version: 1.5.15
Release: 1%{?dist} Release: 2%{?dist}
Summary: The Anthy engine for IBus input platform Summary: The Anthy engine for IBus input platform
License: GPL-2.0-or-later License: GPL-2.0-or-later
URL: https://github.com/ibus/ibus/wiki URL: https://github.com/ibus/ibus/wiki
@ -26,6 +26,7 @@ Source0: https://github.com/ibus/ibus-anthy/releases/download/%{version}/
# Upstreamed patches. # Upstreamed patches.
# Patch0: %%{name}-HEAD.patch # Patch0: %%{name}-HEAD.patch
Patch0: %{name}-HEAD.patch
Patch1: %{name}-1938129-default-hiragana.patch Patch1: %{name}-1938129-default-hiragana.patch
BuildRequires: anthy-unicode-devel BuildRequires: anthy-unicode-devel
@ -154,6 +155,9 @@ make -C data check
%{_datadir}/installed-tests/%{name} %{_datadir}/installed-tests/%{name}
%changelog %changelog
* Thu Sep 07 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-2
- Resolves #2237374 Fix to commit selected candidate with OSK
* Tue Aug 22 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-1 * Tue Aug 22 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-1
- Bump to 1.5.15 - Bump to 1.5.15