Add icon tag in ibus-anthy.appdata.xml.in
- Enable IBus.Engine::has-focus-id property - Add the escape_to_latin command as a vi-cooperative cancel
This commit is contained in:
		
							parent
							
								
									d708323a12
								
							
						
					
					
						commit
						6431ac298a
					
				@ -77,3 +77,292 @@ index 88b19b8..3e82f2e 100644
 | 
			
		||||
-- 
 | 
			
		||||
2.34.1
 | 
			
		||||
 | 
			
		||||
From 2e9f751c45f1002a75e44daa200a379808479e9f Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: fujiwarat <takao.fujiwara1@gmail.com>
 | 
			
		||||
Date: Tue, 2 Aug 2022 11:14:48 +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..be67f9d 100644
 | 
			
		||||
--- a/data/ibus-anthy.appdata.xml.in
 | 
			
		||||
+++ b/data/ibus-anthy.appdata.xml.in
 | 
			
		||||
@@ -1,10 +1,12 @@
 | 
			
		||||
 <?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
+<!-- https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html -->
 | 
			
		||||
 <component type="inputmethod">
 | 
			
		||||
   <id>org.freedesktop.ibus.engine.anthy</id>
 | 
			
		||||
   <metadata_license>GFDL-1.3</metadata_license>
 | 
			
		||||
   <project_license>GPL-2.0</project_license>
 | 
			
		||||
   <name translatable="no">Anthy</name>
 | 
			
		||||
   <summary>Japanese input method</summary>
 | 
			
		||||
+  <icon type="local">/usr/share/icons/hicolor/scalable/apps/ibus-anthy.svg</icon>
 | 
			
		||||
   <description>
 | 
			
		||||
     <p>
 | 
			
		||||
       The Anthy input method is designed for entering Japanese text.
 | 
			
		||||
@@ -15,9 +17,29 @@
 | 
			
		||||
       out on a traditional keyboard.
 | 
			
		||||
     </p>
 | 
			
		||||
   </description>
 | 
			
		||||
+  <keywords>
 | 
			
		||||
+    <keyword>input-method</keyword>
 | 
			
		||||
+    <keyword>Japanese</keyword>
 | 
			
		||||
+  </keywords>
 | 
			
		||||
   <url type="homepage">https://github.com/ibus/ibus/wiki</url>
 | 
			
		||||
   <url type="bugtracker">https://github.com/ibus/ibus-anthy/issues</url>
 | 
			
		||||
   <url type="help">https://github.com/ibus/ibus/wiki/FAQ</url>
 | 
			
		||||
+  <url type="translate">https://translate.fedoraproject.org/projects/ibus/ibus-anthy/</url>
 | 
			
		||||
+  <releases>
 | 
			
		||||
+    <release version="latest">
 | 
			
		||||
+      <description>
 | 
			
		||||
+        <p>See the upstream release list.</p>
 | 
			
		||||
+      </description>
 | 
			
		||||
+      <url>https://github.com/ibus/ibus-anthy/releases</url>
 | 
			
		||||
+    </release>
 | 
			
		||||
+  </releases>
 | 
			
		||||
+  <compulsory_for_desktop>IBus</compulsory_for_desktop>
 | 
			
		||||
+  <screenshots>
 | 
			
		||||
+    <screenshot type="default">
 | 
			
		||||
+      <caption>The Anthy input method is designed for entering Japanese text.</caption>
 | 
			
		||||
+      <image type="source" width="236" height="200">https://camo.githubusercontent.com/3646c511fba557137a316be913f01fc3114e0db9c990acdfa18c29f52b5a6538/687474703a2f2f696275732e6769746875622e696f2f696d616765732f322e706e67#/ibus-anthy.jpg</image>
 | 
			
		||||
+    </screenshot>
 | 
			
		||||
+  </screenshots>
 | 
			
		||||
   <translation type="gettext">ibus-anthy</translation>
 | 
			
		||||
   <update_contact>tfujiwar_AT_redhat.com</update_contact>
 | 
			
		||||
 </component>
 | 
			
		||||
-- 
 | 
			
		||||
2.35.3
 | 
			
		||||
 | 
			
		||||
From 8aed07707fba1b7fafed73227916718458409c29 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: fujiwarat <takao.fujiwara1@gmail.com>
 | 
			
		||||
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 <shawn.p.huang@gmail.com>
 | 
			
		||||
-# Copyright (c) 2010-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
 | 
			
		||||
+# Copyright (c) 2010-2022 Takao Fujiwara <takao.fujiwara1@gmail.com>
 | 
			
		||||
 # 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 <shawn.p.huang@gmail.com>
 | 
			
		||||
-# Copyright (c) 2010-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
 | 
			
		||||
+# Copyright (c) 2010-2022 Takao Fujiwara <takao.fujiwara1@gmail.com>
 | 
			
		||||
 # 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?= <fmang@mg0.fr>
 | 
			
		||||
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 `<Esc>:w` easily get wired into muscle memory.
 | 
			
		||||
 | 
			
		||||
For comparison, uim has got a vi-cooperative mode for that use case. See
 | 
			
		||||
<https://blog.myon.info/entry/2014/04/14/entry/> 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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@
 | 
			
		||||
 | 
			
		||||
Name:           ibus-anthy
 | 
			
		||||
Version:        1.5.14
 | 
			
		||||
Release:        5%{?dist}
 | 
			
		||||
Release:        6%{?dist}
 | 
			
		||||
Summary:        The Anthy engine for IBus input platform
 | 
			
		||||
License:        GPLv2+
 | 
			
		||||
URL:            https://github.com/ibus/ibus/wiki
 | 
			
		||||
@ -156,6 +156,11 @@ make -C data check
 | 
			
		||||
%{_datadir}/installed-tests/%{name}
 | 
			
		||||
 | 
			
		||||
%changelog
 | 
			
		||||
* Wed Aug 03 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.14-6
 | 
			
		||||
- Add icon tag in ibus-anthy.appdata.xml.in
 | 
			
		||||
- Enable IBus.Engine::has-focus-id property
 | 
			
		||||
- Add the escape_to_latin command as a vi-cooperative cancel
 | 
			
		||||
 | 
			
		||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.14-5
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user