2023-09-07 04:23:24 +00:00
|
|
|
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
|
|
|
|
|