From 5f35456328f8fef135836a4cc130a6f54ce79905 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Tue, 22 Aug 2023 13:18:49 +0900 Subject: [PATCH] Delete upstreamed ibus-anthy-HEAD.patch --- ibus-anthy-HEAD.patch | 807 ------------------------------------------ 1 file changed, 807 deletions(-) delete mode 100644 ibus-anthy-HEAD.patch diff --git a/ibus-anthy-HEAD.patch b/ibus-anthy-HEAD.patch deleted file mode 100644 index 34ecce5..0000000 --- a/ibus-anthy-HEAD.patch +++ /dev/null @@ -1,807 +0,0 @@ -From ed993538c711d817e5365630b65f372e0dfd01a7 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Thu, 27 Jan 2022 15:15:13 +0900 -Subject: [PATCH] data: Update era.t with 2022 - ---- - data/era.t | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/data/era.t b/data/era.t -index a6d297e..686271f 100644 ---- a/data/era.t -+++ b/data/era.t -@@ -2,7 +2,7 @@ - # - # ibus-anthy - The Anthy engine for IBus - # --# Copyright (c) 2010-2021 Takao Fujiwara -+# Copyright (c) 2010-2022 Takao Fujiwara - # Copyright (c) 2010-2013 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -338,6 +338,8 @@ - れいわ2 #T35*500 2020 - れいわ3 #T35*500 令和3 - れいわ3 #T35*500 2021 -+れいわ4 #T35*500 令和4 -+れいわ4 #T35*500 2022 - 1868 #T35*500 明治1 - 1869 #T35*500 明治2 - 1870 #T35*500 明治3 -@@ -496,3 +498,4 @@ - 2019 #T35*500 平成31 - 2020 #T35*500 令和2 - 2021 #T35*500 令和3 -+2022 #T35*500 令和4 --- -2.33.1 - -From 4ef5ac95e84056ebd5a446e5e21b5f2a99377363 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Thu, 14 Apr 2022 15:23:26 +0900 -Subject: [PATCH] setup: Minimum candidate window page size to 1 - -IBusLookupTable assert with page_size > 0 (rhbz#2064261) ---- - setup/python2/setup.ui | 2 +- - setup/python3/setup.ui | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/setup/python2/setup.ui b/setup/python2/setup.ui -index 88b19b8..3e82f2e 100644 ---- a/setup/python2/setup.ui -+++ b/setup/python2/setup.ui -@@ -2,7 +2,7 @@ - - - 10 -- 0 -+ 1 - 0 - 1 - 0 -diff --git a/setup/python3/setup.ui b/setup/python3/setup.ui -index 88b19b8..3e82f2e 100644 ---- a/setup/python3/setup.ui -+++ b/setup/python3/setup.ui -@@ -2,7 +2,7 @@ - - - 10 -- 0 -+ 1 - 0 - 1 - 0 --- -2.34.1 - -From 8cfc210cccbe7324e1fbe7d7911eba33c786a520 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Wed, 3 Aug 2022 18:02:02 +0900 -Subject: [PATCH] data: Add icon tag in ibus-anthy.appdata.xml.in - ---- - data/ibus-anthy.appdata.xml.in | 22 +++++ - 1 files changed, 103 insertions(+), 77 deletions(-) - -diff --git a/data/ibus-anthy.appdata.xml.in b/data/ibus-anthy.appdata.xml.in -index 8f246e9..af32a5a 100644 ---- a/data/ibus-anthy.appdata.xml.in -+++ b/data/ibus-anthy.appdata.xml.in -@@ -1,10 +1,12 @@ - -+ - - org.freedesktop.ibus.engine.anthy - GFDL-1.3 - GPL-2.0 - Anthy - Japanese input method -+ https://raw.githubusercontent.com/ibus/ibus-anthy/main/icons/ibus-anthy.png - -

- The Anthy input method is designed for entering Japanese text. -@@ -15,9 +17,29 @@ - out on a traditional keyboard. -

-
-+ -+ input-method -+ Japanese -+ - https://github.com/ibus/ibus/wiki - https://github.com/ibus/ibus-anthy/issues - https://github.com/ibus/ibus/wiki/FAQ -+ https://translate.fedoraproject.org/projects/ibus/ibus-anthy/ -+ -+ -+ -+

See the upstream release list.

-+
-+ https://github.com/ibus/ibus-anthy/releases -+
-+
-+ IBus -+ -+ -+ The Anthy input method is designed for entering Japanese text. -+ http://ibus.github.io/images/2.png -+ -+ - ibus-anthy - tfujiwar_AT_redhat.com -
--- -2.35.3 - -From 8aed07707fba1b7fafed73227916718458409c29 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Wed, 3 Aug 2022 07:38:28 +0900 -Subject: [PATCH] engine: Enable IBus.Engine::has-focus-id property - -IBusEngineClass::has-focus-id propery has been available -since IBus 1.5.27 -IBusEngineClass::focus_in_id() class method is used instead of -IBusEngineClass::focus_id() one in case has-focus-id is %TRUE -and object_path and client name are available with the class method. ---- - engine/python2/engine.py | 22 +++++++++++++++++----- - engine/python3/engine.py | 22 +++++++++++++++++----- - 2 files changed, 34 insertions(+), 10 deletions(-) - -diff --git a/engine/python2/engine.py b/engine/python2/engine.py -index 2fb47b5..d97314a 100644 ---- a/engine/python2/engine.py -+++ b/engine/python2/engine.py -@@ -4,7 +4,7 @@ - # ibus-anthy - The Anthy engine for IBus - # - # Copyright (c) 2007-2008 Peng Huang --# Copyright (c) 2010-2021 Takao Fujiwara -+# Copyright (c) 2010-2022 Takao Fujiwara - # Copyright (c) 2007-2018 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -127,9 +127,15 @@ class Engine(IBus.EngineSimple): - __latin_with_shift = True - - def __init__(self, bus, object_path): -- super(Engine, self).__init__(engine_name="anthy", -- connection=bus.get_connection(), -- object_path=object_path) -+ if hasattr(IBus.Engine.props, 'has_focus_id'): -+ super(Engine, self).__init__(engine_name="anthy", -+ connection=bus.get_connection(), -+ object_path=object_path, -+ has_focus_id=True) -+ else: -+ super(Engine, self).__init__(engine_name="anthy", -+ connection=bus.get_connection(), -+ object_path=object_path) - - self.add_table_by_locale(None) - # create anthy context -@@ -1048,6 +1054,12 @@ class Engine(IBus.EngineSimple): - return self.__argb(255, r, g, b) - - def do_focus_in(self): -+ self.do_focus_in_id(None, None) -+ -+ def do_focus_out(self): -+ self.do_focus_out_id(None) -+ -+ def do_focus_in_id(self, object_path, client): - self.register_properties(self.__prop_list) - self.__refresh_typing_mode_property() - mode = self.__prefs.get_value('common', 'behavior-on-focus-out') -@@ -1059,7 +1071,7 @@ class Engine(IBus.EngineSimple): - if size != self.__lookup_table.get_page_size(): - self.__lookup_table.set_page_size(size) - -- def do_focus_out(self): -+ def do_focus_out_id(self, object_path): - if self.__has_input_purpose: - self.__input_purpose = 0 - mode = self.__prefs.get_value('common', 'behavior-on-focus-out') -diff --git a/engine/python3/engine.py b/engine/python3/engine.py -index df4e20d..34b7f9f 100644 ---- a/engine/python3/engine.py -+++ b/engine/python3/engine.py -@@ -4,7 +4,7 @@ - # ibus-anthy - The Anthy engine for IBus - # - # Copyright (c) 2007-2008 Peng Huang --# Copyright (c) 2010-2021 Takao Fujiwara -+# Copyright (c) 2010-2022 Takao Fujiwara - # Copyright (c) 2007-2018 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -128,9 +128,15 @@ class Engine(IBus.EngineSimple): - __latin_with_shift = True - - def __init__(self, bus, object_path): -- super(Engine, self).__init__(engine_name="anthy", -- connection=bus.get_connection(), -- object_path=object_path) -+ if hasattr(IBus.Engine.props, 'has_focus_id'): -+ super(Engine, self).__init__(engine_name="anthy", -+ connection=bus.get_connection(), -+ object_path=object_path, -+ has_focus_id=True) -+ else: -+ super(Engine, self).__init__(engine_name="anthy", -+ connection=bus.get_connection(), -+ object_path=object_path) - - self.add_table_by_locale(None) - # create anthy context -@@ -1043,6 +1049,12 @@ class Engine(IBus.EngineSimple): - return self.__argb(255, r, g, b) - - def do_focus_in(self): -+ self.do_focus_in_id(None, None) -+ -+ def do_focus_out(self): -+ self.do_focus_out_id(None) -+ -+ def do_focus_in_id(self, object_path, client): - self.register_properties(self.__prop_list) - self.__refresh_typing_mode_property() - mode = self.__prefs.get_value('common', 'behavior-on-focus-out') -@@ -1054,7 +1066,7 @@ class Engine(IBus.EngineSimple): - if size != self.__lookup_table.get_page_size(): - self.__lookup_table.set_page_size(size) - -- def do_focus_out(self): -+ def do_focus_out_id(self, object_path): - if self.__has_input_purpose: - self.__input_purpose = 0 - mode = self.__prefs.get_value('common', 'behavior-on-focus-out') --- -2.35.3 - -From debc427fad513063cf251a1668584a198c692bd6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano?= -Date: Wed, 3 Aug 2022 07:38:59 +0900 -Subject: [PATCH] Add the escape_to_latin command as a vi-cooperative cancel (#29) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When writing Japanese in Vim, everytime I switch from Insert mode back to -Normal mode, I need to also switch back the IBus input mode to Latin or -else Vim won’t take any of my input. This is kind fo annoying as key -sequences like `:w` easily get wired into muscle memory. - -For comparison, uim has got a vi-cooperative mode for that use case. See - for illustration. - -Here’s a new command which, when converting, behaves like cancel, but -otherwise switches to Latin and sends the Escape key. To make IBus -vi-cooperative, a user can map the Escape key to escape_to_latin instead -of cancel. ---- - engine/python2/engine.py | 14 ++++++++++++++ - engine/python3/engine.py | 14 ++++++++++++++ - setup/python2/anthyprefs.py | 1 + - setup/python3/anthyprefs.py | 1 + - 4 files changed, 30 insertions(+) - -diff --git a/engine/python2/engine.py b/engine/python2/engine.py -index d97314a..218b485 100644 ---- a/engine/python2/engine.py -+++ b/engine/python2/engine.py -@@ -2333,6 +2333,20 @@ class Engine(IBus.EngineSimple): - self.__invalidate() - return True - -+ def __cmd_escape_to_latin(self, keyval, state): -+ """ -+ Vi-cooperative variant of cancel_all. When Vi users press Escape, they -+ expect to return to Normal mode where an IME would not make sense. This -+ command automatically switches back to Latin when sending Escape. When -+ converting, Escape will cancel the conversion instead. -+ """ -+ if self._chk_mode('0'): -+ if Engine.__input_mode != INPUT_MODE_LATIN: -+ self.__cmd_latin_mode(keyval, state) -+ return False -+ else: -+ return self.__cmd_cancel_all(keyval, state) -+ - def __cmd_reconvert(self, keyval, state): - if not self.__preedit_ja_string.is_empty(): - # if user has inputed some chars -diff --git a/engine/python3/engine.py b/engine/python3/engine.py -index 34b7f9f..abb9c02 100644 ---- a/engine/python3/engine.py -+++ b/engine/python3/engine.py -@@ -2327,6 +2327,20 @@ class Engine(IBus.EngineSimple): - self.__invalidate() - return True - -+ def __cmd_escape_to_latin(self, keyval, state): -+ """ -+ Vi-cooperative variant of cancel_all. When Vi users press Escape, they -+ expect to return to Normal mode where an IME would not make sense. This -+ command automatically switches back to Latin when sending Escape. When -+ converting, Escape will cancel the conversion instead. -+ """ -+ if self._chk_mode('0'): -+ if Engine.__input_mode != INPUT_MODE_LATIN: -+ self.__cmd_latin_mode(keyval, state) -+ return False -+ else: -+ return self.__cmd_cancel_all(keyval, state) -+ - def __cmd_reconvert(self, keyval, state): - if not self.__preedit_ja_string.is_empty(): - # if user has inputed some chars -diff --git a/setup/python2/anthyprefs.py b/setup/python2/anthyprefs.py -index 5e3bade..c614491 100644 ---- a/setup/python2/anthyprefs.py -+++ b/setup/python2/anthyprefs.py -@@ -276,6 +276,7 @@ _cmd_keys = [ - 'predict', - 'cancel', - 'cancel_all', -+ 'escape_to_latin', - 'reconvert', - # 'do_nothing', - -diff --git a/setup/python3/anthyprefs.py b/setup/python3/anthyprefs.py -index 33b2a31..404aa09 100644 ---- a/setup/python3/anthyprefs.py -+++ b/setup/python3/anthyprefs.py -@@ -269,6 +269,7 @@ _cmd_keys = [ - 'predict', - 'cancel', - 'cancel_all', -+ 'escape_to_latin', - 'reconvert', - # 'do_nothing', - --- -2.35.3 - -From d1e6853dc4f3cd26b5846b6e4e255bfcaf4e381a Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Thu, 26 Jan 2023 19:11:16 +0900 -Subject: [PATCH] engine: Fix page_up/page_down class methods (#27) - ---- - engine/python2/engine.py | 6 +++--- - engine/python3/engine.py | 6 +++--- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/engine/python2/engine.py b/engine/python2/engine.py -index 218b485..56c0cd5 100644 ---- a/engine/python2/engine.py -+++ b/engine/python2/engine.py -@@ -4,7 +4,7 @@ - # ibus-anthy - The Anthy engine for IBus - # - # Copyright (c) 2007-2008 Peng Huang --# Copyright (c) 2010-2022 Takao Fujiwara -+# Copyright (c) 2010-2023 Takao Fujiwara - # Copyright (c) 2007-2018 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -1536,14 +1536,14 @@ class Engine(IBus.EngineSimple): - if self.__preedit_ja_string.is_empty(): - return False - if self.__lookup_table_visible == True: -- self.do_page_up() -+ self.__page_up(self) - return True - - def __on_key_page_down(self): - if self.__preedit_ja_string.is_empty(): - return False - if self.__lookup_table_visible == True: -- self.do_page_down() -+ self.__page_down(self) - return True - - '''def __on_key_left(self): -diff --git a/engine/python3/engine.py b/engine/python3/engine.py -index abb9c02..2ebf894 100644 ---- a/engine/python3/engine.py -+++ b/engine/python3/engine.py -@@ -4,7 +4,7 @@ - # ibus-anthy - The Anthy engine for IBus - # - # Copyright (c) 2007-2008 Peng Huang --# Copyright (c) 2010-2022 Takao Fujiwara -+# Copyright (c) 2010-2023 Takao Fujiwara - # Copyright (c) 2007-2018 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -1531,14 +1531,14 @@ class Engine(IBus.EngineSimple): - if self.__preedit_ja_string.is_empty(): - return False - if self.__lookup_table_visible == True: -- self.do_page_up() -+ self.__page_up(self) - return True - - def __on_key_page_down(self): - if self.__preedit_ja_string.is_empty(): - return False - if self.__lookup_table_visible == True: -- self.do_page_down() -+ self.__page_down(self) - return True - - '''def __on_key_left(self): --- -2.38.1 - -From 227ec140cdf4ffcc4f129f59d9ca7db2076554b2 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Thu, 26 Jan 2023 19:42:25 +0900 -Subject: [PATCH] data: Update era.t with 2023 - ---- - data/era.t | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/data/era.t b/data/era.t -index 686271f..7f7bd1b 100644 ---- a/data/era.t -+++ b/data/era.t -@@ -2,7 +2,7 @@ - # - # ibus-anthy - The Anthy engine for IBus - # --# Copyright (c) 2010-2022 Takao Fujiwara -+# Copyright (c) 2010-2023 Takao Fujiwara - # Copyright (c) 2010-2013 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -340,6 +340,8 @@ - れいわ3 #T35*500 2021 - れいわ4 #T35*500 令和4 - れいわ4 #T35*500 2022 -+れいわ5 #T35*500 令和5 -+れいわ5 #T35*500 2023 - 1868 #T35*500 明治1 - 1869 #T35*500 明治2 - 1870 #T35*500 明治3 -@@ -499,3 +501,4 @@ - 2020 #T35*500 令和2 - 2021 #T35*500 令和3 - 2022 #T35*500 令和4 -+2023 #T35*500 令和5 --- -2.38.1 - -From 56629c6f9d5e289fdd16388965516fe5ebf5c8dc Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Fri, 17 Feb 2023 15:52:58 +0900 -Subject: [PATCH 8/8] engine: Fix to find compose resource in IBus core - -IBus.init() has been required since 1.5.28 after the EN compose -table was moved to GResource. ---- - engine/python2/main.py | 3 ++- - engine/python3/main.py | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/engine/python2/main.py b/engine/python2/main.py -index 096cd41..c366293 100644 ---- a/engine/python2/main.py -+++ b/engine/python2/main.py -@@ -4,7 +4,7 @@ - # ibus-anthy - The Anthy engine for IBus - # - # Copyright (c) 2007-2008 Peng Huang --# Copyright (c) 2010-2016 Takao Fujiwara -+# Copyright (c) 2010-2023 Takao Fujiwara - # Copyright (c) 2007-2016 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -179,6 +179,7 @@ def main(): - print >> sys.stderr, 'Unknown argument: %s' % o - print_help(sys.stderr, 1) - -+ IBus.init() - if daemonize: - if os.fork(): - sys.exit() -diff --git a/engine/python3/main.py b/engine/python3/main.py -index 1a2e6fd..8665ae0 100644 ---- a/engine/python3/main.py -+++ b/engine/python3/main.py -@@ -4,7 +4,7 @@ - # ibus-anthy - The Anthy engine for IBus - # - # Copyright (c) 2007-2008 Peng Huang --# Copyright (c) 2010-2016 Takao Fujiwara -+# Copyright (c) 2010-2023 Takao Fujiwara - # Copyright (c) 2007-2016 Red Hat, Inc. - # - # This program is free software; you can redistribute it and/or modify -@@ -177,6 +177,7 @@ def main(): - print('Unknown argument: %s' % o, file=sys.stderr) - print_help(sys.stderr, 1) - -+ IBus.init() - if daemonize: - if os.fork(): - sys.exit() --- -2.38.1 - -From ddb7d64007f25aa0108ae9bf65b96aa063157c0a Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Thu, 13 Jul 2023 17:49:57 +0900 -Subject: [PATCH] engine: Enable OSK mode - -Currently gnome-shell sends IBUS_CAP_OSK when OSK(On-Screen Keyboard) -is enabled in GNOME Wayland only. -However users still can type characters using the physical keyboard -while OSK is enabled so the current status is not perfect. - -But ibus-anthy now commit the preedit when a candidate is clicked -on IBus lookup table instead of the selection in the OSK mode. - -BUG=https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2415 -BUG=https://gitlab.gnome.org/GNOME/mutter/-/issues/2441 -BUG=rhbz#2015149 ---- - engine/python2/engine.py | 34 ++++++++++++++++++++++++++++------ - engine/python3/engine.py | 34 ++++++++++++++++++++++++++++------ - 2 files changed, 56 insertions(+), 12 deletions(-) - -diff --git a/engine/python2/engine.py b/engine/python2/engine.py -index 56c0cd5..4b3da97 100644 ---- a/engine/python2/engine.py -+++ b/engine/python2/engine.py -@@ -150,6 +150,10 @@ class Engine(IBus.EngineSimple): - self.__prop_dict = {} - self.__input_purpose = 0 - self.__has_input_purpose = False -+ # OSK mode is designed for OSK on gnome-shell, which always shows -+ # IBus lookup window prior to the preedit and selecting a candidate -+ # causes the commmit instead of the selection. -+ self.__osk_mode = False - if hasattr(IBus, 'InputPurpose'): - self.__has_input_purpose = True - try: -@@ -805,7 +809,10 @@ class Engine(IBus.EngineSimple): - keyval = IBus.KEY_0 - else: - keyval = IBus.KEY_1 + index -+ 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() - - def __commit_string(self, text): - self.__reset() -@@ -1094,6 +1101,9 @@ class Engine(IBus.EngineSimple): - self.__reset() - self.__invalidate() - -+ def do_set_capabilities(self, caps): -+ self.__osk_mode = True if caps & IBus.Capabilite.OSK else False -+ - def __destroy(self, obj): - if self.__idle_id != 0: - GLib.source_remove(self.__idle_id) -@@ -1148,7 +1158,10 @@ class Engine(IBus.EngineSimple): - else: - self.__cursor_pos = 0 - self.__fill_lookup_table() -- self.__lookup_table_visible = False -+ if self.__osk_mode: -+ self.__lookup_table_visible = True -+ else: -+ self.__lookup_table_visible = False - - def __end_anthy_convert(self): - if self.__convert_mode == CONV_MODE_OFF: -@@ -1353,7 +1366,8 @@ class Engine(IBus.EngineSimple): - self.__lookup_table.set_cursor_pos(0) - candidate = UN(self.__lookup_table.get_candidate(0).get_text()) - self.__segments[self.__cursor_pos] = 0, candidate -- self.__lookup_table_visible = False -+ if not self.__osk_mode: -+ self.__lookup_table_visible = False - elif self.__segments[self.__cursor_pos][0] != \ - NTH_UNCONVERTED_CANDIDATE: - buf = self.__context.get_segment(self.__cursor_pos, -@@ -1582,7 +1596,8 @@ class Engine(IBus.EngineSimple): - return True - - self.__cursor_pos += 1 -- self.__lookup_table_visible = False -+ if not self.__osk_mode: -+ self.__lookup_table_visible = False - self.__fill_lookup_table() - self.__invalidate() - return True -@@ -2314,7 +2329,10 @@ class Engine(IBus.EngineSimple): - self.__convert_mode = CONV_MODE_PREDICTION - self.__cursor_pos = 0 - self.__fill_lookup_table() -- self.__lookup_table_visible = False -+ if self.__osk_mode: -+ self.__lookup_table_visible = True -+ else: -+ self.__lookup_table_visible = False - self.__invalidate() - - return True -@@ -2393,7 +2411,10 @@ class Engine(IBus.EngineSimple): - self.__convert_mode = CONV_MODE_ANTHY - self.__cursor_pos = 0 - self.__fill_lookup_table() -- self.__lookup_table_visible = False -+ if self.__osk_mode: -+ self.__lookup_table_visible = True -+ else: -+ self.__lookup_table_visible = False - self.__invalidate() - - return True -@@ -2549,7 +2570,8 @@ class Engine(IBus.EngineSimple): - index = self.__lookup_table.get_cursor_pos() - candidate = UN(self.__lookup_table.get_candidate(index).get_text()) - self.__segments[self.__cursor_pos] = index, candidate -- self.__lookup_table_visible = False -+ if not self.__osk_mode: -+ self.__lookup_table_visible = False - self.__on_key_right() - self.__invalidate() - return True -diff --git a/engine/python3/engine.py b/engine/python3/engine.py -index 2ebf894..20786f2 100644 ---- a/engine/python3/engine.py -+++ b/engine/python3/engine.py -@@ -151,6 +151,10 @@ class Engine(IBus.EngineSimple): - self.__prop_dict = {} - self.__input_purpose = 0 - self.__has_input_purpose = False -+ # OSK mode is designed for OSK on gnome-shell, which always shows -+ # IBus lookup window prior to the preedit and selecting a candidate -+ # causes the commmit instead of the selection. -+ self.__osk_mode = False - if hasattr(IBus, 'InputPurpose'): - self.__has_input_purpose = True - try: -@@ -800,7 +804,10 @@ class Engine(IBus.EngineSimple): - keyval = IBus.KEY_0 - else: - keyval = IBus.KEY_1 + index -+ 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() - - def __commit_string(self, text): - self.__reset() -@@ -1089,6 +1096,9 @@ class Engine(IBus.EngineSimple): - self.__reset() - self.__invalidate() - -+ def do_set_capabilities(self, caps): -+ self.__osk_mode = True if caps & IBus.Capabilite.OSK else False -+ - def __destroy(self, obj): - if self.__idle_id != 0: - GLib.source_remove(self.__idle_id) -@@ -1143,7 +1153,10 @@ class Engine(IBus.EngineSimple): - else: - self.__cursor_pos = 0 - self.__fill_lookup_table() -- self.__lookup_table_visible = False -+ if self.__osk_mode: -+ self.__lookup_table_visible = True -+ else: -+ self.__lookup_table_visible = False - - def __end_anthy_convert(self): - if self.__convert_mode == CONV_MODE_OFF: -@@ -1348,7 +1361,8 @@ class Engine(IBus.EngineSimple): - self.__lookup_table.set_cursor_pos(0) - candidate = self.__lookup_table.get_candidate(0).get_text() - self.__segments[self.__cursor_pos] = 0, candidate -- self.__lookup_table_visible = False -+ if not self.__osk_mode: -+ self.__lookup_table_visible = False - elif self.__segments[self.__cursor_pos][0] != \ - NTH_UNCONVERTED_CANDIDATE: - buf = self.__context.get_segment(self.__cursor_pos, -@@ -1577,7 +1591,8 @@ class Engine(IBus.EngineSimple): - return True - - self.__cursor_pos += 1 -- self.__lookup_table_visible = False -+ if not self.__osk_mode: -+ self.__lookup_table_visible = False - self.__fill_lookup_table() - self.__invalidate() - return True -@@ -2308,7 +2323,10 @@ class Engine(IBus.EngineSimple): - self.__convert_mode = CONV_MODE_PREDICTION - self.__cursor_pos = 0 - self.__fill_lookup_table() -- self.__lookup_table_visible = False -+ if self.__osk_mode: -+ self.__lookup_table_visible = True -+ else: -+ self.__lookup_table_visible = False - self.__invalidate() - - return True -@@ -2387,7 +2405,10 @@ class Engine(IBus.EngineSimple): - self.__convert_mode = CONV_MODE_ANTHY - self.__cursor_pos = 0 - self.__fill_lookup_table() -- self.__lookup_table_visible = False -+ if self.__osk_mode: -+ self.__lookup_table_visible = True -+ else: -+ self.__lookup_table_visible = False - self.__invalidate() - - return True -@@ -2543,7 +2564,8 @@ class Engine(IBus.EngineSimple): - index = self.__lookup_table.get_cursor_pos() - candidate = self.__lookup_table.get_candidate(index).get_text() - self.__segments[self.__cursor_pos] = index, candidate -- self.__lookup_table_visible = False -+ if not self.__osk_mode: -+ self.__lookup_table_visible = False - self.__on_key_right() - self.__invalidate() - return True --- -2.41.0 - -From c1ffc2bfcedab68ce79c2fa9a7f2bfe6cec17595 Mon Sep 17 00:00:00 2001 -From: fujiwarat -Date: Fri, 18 Aug 2023 18:52:58 +0900 -Subject: [PATCH] engine: Distinguish Super-space and space shortcut keys - -BUG=rhbz#2232532 ---- - engine/python2/engine.py | 3 ++- - engine/python3/engine.py | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/engine/python2/engine.py b/engine/python2/engine.py -index 4b3da97..80cfa86 100644 ---- a/engine/python2/engine.py -+++ b/engine/python2/engine.py -@@ -1940,7 +1940,8 @@ class Engine(IBus.EngineSimple): - - state = state & (IBus.ModifierType.SHIFT_MASK | - IBus.ModifierType.CONTROL_MASK | -- IBus.ModifierType.MOD1_MASK) -+ IBus.ModifierType.MOD1_MASK | -+ IBus.ModifierType.MOD4_MASK) - - # ignore key release events - if not is_press: -diff --git a/engine/python3/engine.py b/engine/python3/engine.py -index 20786f2..7c0d283 100644 ---- a/engine/python3/engine.py -+++ b/engine/python3/engine.py -@@ -1935,7 +1935,8 @@ class Engine(IBus.EngineSimple): - - state = state & (IBus.ModifierType.SHIFT_MASK | - IBus.ModifierType.CONTROL_MASK | -- IBus.ModifierType.MOD1_MASK) -+ IBus.ModifierType.MOD1_MASK | -+ IBus.ModifierType.MOD4_MASK) - - # ignore key release events - if not is_press: --- -2.41.0 -