From dd4cc5b028c35f9bb8fa9d3bdc8f26bcdfc43d40 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 30 Sep 2020 20:35:23 +0900
Subject: [PATCH] ui/gtk3: Fix arguments in GLib.DBusSignalCallback for Vala
 0.50

BUG=https://github.com/ibus/ibus/issues/2265
---
 ui/gtk3/application.vala | 22 +++++++++++-----------
 ui/gtk3/extension.vala   | 22 +++++++++++-----------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/ui/gtk3/application.vala b/ui/gtk3/application.vala
index cc9ee54c..da65301b 100644
--- a/ui/gtk3/application.vala
+++ b/ui/gtk3/application.vala
@@ -3,7 +3,7 @@
  * ibus - The Input Bus
  *
  * Copyright(c) 2011 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright(c) 2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright(c) 2017-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -69,22 +69,22 @@ class Application {
     }
 
     private void bus_name_acquired_cb(DBusConnection connection,
-                                      string sender_name,
-                                      string object_path,
-                                      string interface_name,
-                                      string signal_name,
-                                      Variant parameters) {
+                                      string?        sender_name,
+                                      string         object_path,
+                                      string         interface_name,
+                                      string         signal_name,
+                                      Variant        parameters) {
         debug("signal_name = %s", signal_name);
         m_panel = new Panel(m_bus);
         m_panel.load_settings();
     }
 
     private void bus_name_lost_cb(DBusConnection connection,
-                                  string sender_name,
-                                  string object_path,
-                                  string interface_name,
-                                  string signal_name,
-                                  Variant parameters) {
+                                  string?        sender_name,
+                                  string         object_path,
+                                  string         interface_name,
+                                  string         signal_name,
+                                  Variant        parameters) {
         // "Destroy" dbus method was called before this callback is called.
         // "Destroy" dbus method -> ibus_service_destroy()
         // -> g_dbus_connection_unregister_object()
diff --git a/ui/gtk3/extension.vala b/ui/gtk3/extension.vala
index ea3cd464..a6f2e8e6 100644
--- a/ui/gtk3/extension.vala
+++ b/ui/gtk3/extension.vala
@@ -3,7 +3,7 @@
  * ibus - The Input Bus
  *
  * Copyright(c) 2018 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright(c) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright(c) 2018-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -67,22 +67,22 @@ class ExtensionGtk : Gtk.Application {
 
 
     private void bus_name_acquired_cb(DBusConnection connection,
-                                      string sender_name,
-                                      string object_path,
-                                      string interface_name,
-                                      string signal_name,
-                                      Variant parameters) {
+                                      string?        sender_name,
+                                      string         object_path,
+                                      string         interface_name,
+                                      string         signal_name,
+                                      Variant        parameters) {
         debug("signal_name = %s", signal_name);
         m_panel = new PanelBinding(m_bus, this);
         m_panel.load_settings();
     }
 
     private void bus_name_lost_cb(DBusConnection connection,
-                                  string sender_name,
-                                  string object_path,
-                                  string interface_name,
-                                  string signal_name,
-                                  Variant parameters) {
+                                  string?        sender_name,
+                                  string         object_path,
+                                  string         interface_name,
+                                  string         signal_name,
+                                  Variant        parameters) {
         // "Destroy" dbus method was called before this callback is called.
         // "Destroy" dbus method -> ibus_service_destroy()
         // -> g_dbus_connection_unregister_object()
-- 
2.24.1

From 02338ce751a1ed5b9b892fba530ec2fe211d314e Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 20 Nov 2020 08:58:52 +0900
Subject: [PATCH] docs: Fix make dist

---
 docs/reference/ibus/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/reference/ibus/Makefile.am b/docs/reference/ibus/Makefile.am
index 1ece234c..0f307bbd 100644
--- a/docs/reference/ibus/Makefile.am
+++ b/docs/reference/ibus/Makefile.am
@@ -3,8 +3,8 @@
 # ibus - The Input Bus
 #
 # Copyright (c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2007-2015 Red Hat, Inc.
-# Copyright (c) 2015 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2020 Red Hat, Inc.
+# Copyright (c) 2015-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -147,6 +147,6 @@ tmpl-build.stamp: trim-build.stamp  $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DO
 # clean-local:
 # 	rm -rf tmpl ${DOC_MODULE)
 
-CLEANFILES+= *.stamp
+CLEANFILES+= *actions *.stamp
 
 -include $(top_srcdir)/git.mk
-- 
2.24.1

From aa558de80c224921753990806cf553428fbe7057 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 20 Nov 2020 09:03:32 +0900
Subject: [PATCH] src: Fix to build emoji-*.dict in CLDR 38

root.xml and sr_Cyrl.xml have included no contents since
cldr-emoji-annotation-38 and make install failed because of no
emoji-root.dict and emoji-sr.Cyrl.dict.
Now the build creates the no content files but remove those files
in the install hook.

BUG=rhbz#1898065
---
 src/Makefile.am    | 61 ++++++++++++++++++++++------------------------
 src/emoji-parser.c |  4 ++-
 2 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 99de1ab7..742ee7d7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@
 # ibus - The Input Bus
 #
 # Copyright (c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2015-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
 # Copyright (c) 2007-2017 Red Hat, Inc.
 #
 # This library is free software; you can redistribute it and/or
@@ -248,6 +248,7 @@ AM_CPPFLAGS += -DENABLE_EMOJI_DICT
 dictdir = $(pkgdatadir)/dicts
 LANG_FILES = $(basename $(notdir $(wildcard $(EMOJI_ANNOTATION_DIR)/*.xml)))
 EMOJI_DICT_FILES = $(patsubst %,dicts/emoji-%.dict,$(LANG_FILES))
+# emoji-root.dict, emoji-sr_Cyrl.dict have no contents.
 dict_DATA = $(EMOJI_DICT_FILES)
 
 noinst_PROGRAMS += emoji-parser
@@ -265,6 +266,7 @@ dicts/emoji-%.dict: emoji-parser
 	        xml_derived_option="--xml-derived $(EMOJI_ANNOTATION_DIR)/../annotationsDerived/$*.xml"; \
 	        plus_comment="derived"; \
 	fi; \
+	is_skip=0; \
 	if test x"$*" = xen ; then \
 	    $(builddir)/emoji-parser \
 	        --unicode-emoji-dir $(UNICODE_EMOJI_DIR) \
@@ -279,48 +281,43 @@ dicts/emoji-%.dict: emoji-parser
 	        --xml $(EMOJI_ANNOTATION_DIR)/$*.xml \
 	        $$xml_derived_option \
 	        --out $@; \
+	    retval=$$?; \
+	    if test $$retval -eq 99 ; then \
+	        is_skip=1; \
+	        touch $@; \
+	    elif test $$retval -ne 0 ; then \
+	        echo "Fail to generate $@"; \
+	        abrt; \
+	    fi; \
 	fi; \
-	echo "Generated $$plus_comment $@"
+	if test $$is_skip -eq 0 ; then \
+	    echo "Generated $$plus_comment $@"; \
+	else \
+	    echo "Skip $$plus_comment $@"; \
+	fi;
 
 ibusemojigen.h: dicts/emoji-en.dict
 	$(NULL)
 
-install-data-hook: $(dict_DATA)
-	@$(NORMAL_INSTALL)
+# We put dicts/emoji-%.dict as the make target for the parallel build
+# and the make target has to be genarated even if the file size is zero.
+# But we don't want to install the zero size files and delete them
+# in install-data-hook.
+install-data-hook:
 	$(AM_V_at)list='$(wildcard dicts/*.dict)'; \
         test -n "$(dictdir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(dictdir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(dictdir)" || exit 1; \
-	fi; \
 	for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  echo "$$d$$p"; \
+	    if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	    if test -s  "$$d$$p"; then continue; fi;  \
+	    basename "$$p"; \
 	done | \
-	while read files; do \
-	  if [ x$(AM_DEFAULT_VERBOSITY) = x1 ] ; then \
-	      echo "$(INSTALL_DATA) $$files '$(DESTDIR)$(dictdir)'"; \
-	  else \
-	      echo "Installing $$files"; \
-	  fi; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(dictdir)" || exit $$?; \
+	while read file; do \
+	    if test -f "$(DESTDIR)$(dictdir)/$$file"; then \
+	        echo "Delete $(DESTDIR)$(dictdir)/$$file"; \
+	        rm "$(DESTDIR)$(dictdir)/$$file" || exit $$?; \
+	    fi; \
 	done
 
-dict__uninstall_files_from_dir = { \
-    test -z "$$files" \
-        || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-        || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-             cd "$$dir" && rm -f $$files; }; \
-    }
-
-# for make dist
-uninstall-hook:
-	@$(NORMAL_UNINSTALL)
-	$(AM_V_at)list='$(wildcard dicts/*.dict)'; \
-	test -n "$(dictdir)" || list=; \
-	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(dictdir)'; $(dict__uninstall_files_from_dir)
-
 emoji_parser_SOURCES =          \
     emoji-parser.c              \
     $(NULL)
diff --git a/src/emoji-parser.c b/src/emoji-parser.c
index 96a779c6..b117b1b4 100644
--- a/src/emoji-parser.c
+++ b/src/emoji-parser.c
@@ -1,7 +1,7 @@
 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
 /* vim:set et sts=4: */
 /* ibus - The Input Bus
- * Copyright (C) 2016-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2016-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
  * Copyright (C) 2016 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -1294,6 +1294,8 @@ main (int argc, char *argv[])
         category_file_save (output_category, list);
     if (list)
         g_slist_free (list);
+    else
+        return 99;
 
     return 0;
 }
-- 
2.24.1

From b72efea42d5f72e08e2774ae03027c246d41cab7 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 20 Nov 2020 10:56:11 +0900
Subject: [PATCH] src: Update IBusInputPurpose and IBusInputHints in
 ibustypes.h

Copy IBUS_INPUT_PURPOSE_TERMINAL, IBUS_INPUT_PURPOSE_PIN,
IBUS_INPUT_PURPOSE_TERMINAL from GTK 3.24.14
---
 src/ibustypes.h | 77 ++++++++++++++++++++++++++++++++++---------------
 1 file changed, 53 insertions(+), 24 deletions(-)

diff --git a/src/ibustypes.h b/src/ibustypes.h
index 06370a27..798ad04d 100644
--- a/src/ibustypes.h
+++ b/src/ibustypes.h
@@ -2,7 +2,7 @@
 /* vim:set et sts=4: */
 /* ibus - The Input Bus
  * Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2008-2015 Red Hat, Inc.
+ * Copyright (C) 2008-2020 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -241,29 +241,46 @@ typedef void (* IBusFreeFunc) (gpointer object);
  * @IBUS_INPUT_PURPOSE_EMAIL: Edited field expects email address
  * @IBUS_INPUT_PURPOSE_NAME: Edited field expects the name of a person
  * @IBUS_INPUT_PURPOSE_PASSWORD: Like @IBUS_INPUT_PURPOSE_FREE_FORM,
- * but characters are hidden
+ *     but characters are hidden
  * @IBUS_INPUT_PURPOSE_PIN: Like @IBUS_INPUT_PURPOSE_DIGITS, but
- * characters are hidden
+ *     characters are hidden
+ * @IBUS_INPUT_PURPOSE_TERMINAL: Allow any character, in addition to control
+ *     codes. Since 1.5.24
  *
  * Describes primary purpose of the input context.  This information
  * is particularly useful to implement intelligent behavior in
  * engines, such as automatic input-mode switch and text prediction.
  *
+ * Note that the purpose is not meant to impose a totally strict rule
+ * about allowed characters, and does not replace input validation.
+ * It is fine for an on-screen keyboard to let the user override the
+ * character set restriction that is expressed by the purpose. The
+ * application is expected to validate the entry contents, even if
+ * it specified a purpose.
+ *
+ * The difference between @IBUS_INPUT_PURPOSE_DIGITS and
+ * @IBUS_INPUT_PURPOSE_NUMBER is that the former accepts only digits
+ * while the latter also some punctuation (like commas or points, plus,
+ * minus) and “e” or “E” as in 3.14E+000.
+ *
  * This enumeration may be extended in the future; engines should
  * interpret unknown values as 'free form'.
+ *
+ * Since: 1.5.4
  */
 typedef enum
 {
-  IBUS_INPUT_PURPOSE_FREE_FORM,
-  IBUS_INPUT_PURPOSE_ALPHA,
-  IBUS_INPUT_PURPOSE_DIGITS,
-  IBUS_INPUT_PURPOSE_NUMBER,
-  IBUS_INPUT_PURPOSE_PHONE,
-  IBUS_INPUT_PURPOSE_URL,
-  IBUS_INPUT_PURPOSE_EMAIL,
-  IBUS_INPUT_PURPOSE_NAME,
-  IBUS_INPUT_PURPOSE_PASSWORD,
-  IBUS_INPUT_PURPOSE_PIN
+    IBUS_INPUT_PURPOSE_FREE_FORM,
+    IBUS_INPUT_PURPOSE_ALPHA,
+    IBUS_INPUT_PURPOSE_DIGITS,
+    IBUS_INPUT_PURPOSE_NUMBER,
+    IBUS_INPUT_PURPOSE_PHONE,
+    IBUS_INPUT_PURPOSE_URL,
+    IBUS_INPUT_PURPOSE_EMAIL,
+    IBUS_INPUT_PURPOSE_NAME,
+    IBUS_INPUT_PURPOSE_PASSWORD,
+    IBUS_INPUT_PURPOSE_PIN,
+    IBUS_INPUT_PURPOSE_TERMINAL
 } IBusInputPurpose;
 
 /**
@@ -280,24 +297,36 @@ typedef enum
  *     first word of each sentence
  * @IBUS_INPUT_HINT_INHIBIT_OSK: Suggest to not show an onscreen keyboard
  *     (e.g for a calculator that already has all the keys).
- * @IBUS_INPUT_HINT_VERTICAL_WRITING: The text is vertical.
+ * @IBUS_INPUT_HINT_VERTICAL_WRITING: The text is vertical. Since 1.5.11
+ * @IBUS_INPUT_HINT_EMOJI: Suggest offering Emoji support. Since 1.5.24
+ * @IBUS_INPUT_HINT_NO_EMOJI: Suggest not offering Emoji support. Since 1.5.24
  *
  * Describes hints that might be taken into account by engines.  Note
  * that engines may already tailor their behaviour according to the
  * #IBusInputPurpose of the entry.
+ *
+ * Some common sense is expected when using these flags - mixing
+ * @IBUS_INPUT_HINT_LOWERCASE with any of the uppercase hints makes no sense.
+ *
+ * This enumeration may be extended in the future; engines should
+ * ignore unknown values.
+ *
+ * Since: 1.5.4
  */
 typedef enum
 {
-  IBUS_INPUT_HINT_NONE                = 0,
-  IBUS_INPUT_HINT_SPELLCHECK          = 1 << 0,
-  IBUS_INPUT_HINT_NO_SPELLCHECK       = 1 << 1,
-  IBUS_INPUT_HINT_WORD_COMPLETION     = 1 << 2,
-  IBUS_INPUT_HINT_LOWERCASE           = 1 << 3,
-  IBUS_INPUT_HINT_UPPERCASE_CHARS     = 1 << 4,
-  IBUS_INPUT_HINT_UPPERCASE_WORDS     = 1 << 5,
-  IBUS_INPUT_HINT_UPPERCASE_SENTENCES = 1 << 6,
-  IBUS_INPUT_HINT_INHIBIT_OSK         = 1 << 7,
-  IBUS_INPUT_HINT_VERTICAL_WRITING    = 1 << 8
+    IBUS_INPUT_HINT_NONE                = 0,
+    IBUS_INPUT_HINT_SPELLCHECK          = 1 << 0,
+    IBUS_INPUT_HINT_NO_SPELLCHECK       = 1 << 1,
+    IBUS_INPUT_HINT_WORD_COMPLETION     = 1 << 2,
+    IBUS_INPUT_HINT_LOWERCASE           = 1 << 3,
+    IBUS_INPUT_HINT_UPPERCASE_CHARS     = 1 << 4,
+    IBUS_INPUT_HINT_UPPERCASE_WORDS     = 1 << 5,
+    IBUS_INPUT_HINT_UPPERCASE_SENTENCES = 1 << 6,
+    IBUS_INPUT_HINT_INHIBIT_OSK         = 1 << 7,
+    IBUS_INPUT_HINT_VERTICAL_WRITING    = 1 << 8,
+    IBUS_INPUT_HINT_EMOJI               = 1 << 9,
+    IBUS_INPUT_HINT_NO_EMOJI            = 1 << 10
 } IBusInputHints;
 
 #endif
-- 
2.24.1

