public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Takao Fujiwara <tfujiwar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ibus] autotool: Migrate upstream fixes
Date: Sun, 31 May 2026 02:07:17 GMT [thread overview]
Message-ID: <178019323783.1.63508555038622714.rpms-ibus-66e07d2dbc09@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/ibus
Branch : autotool
Commit : 66e07d2dbc09bce7848b96a11cf75a25851ff063
Author : Takao Fujiwara <tfujiwar@redhat.com>
Date : 2019-11-18T13:38:50+09:00
Stats : +2578/-15 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/ibus/c/66e07d2dbc09bce7848b96a11cf75a25851ff063?branch=autotool
Log:
Migrate upstream fixes
- Replace push with cd for Posix SH
- Use XDG_CONFIG_HOME for Unix socket directory
- Fix deprecated APIs
- Fix restart crash with inotify read()
- Fix Bug 1658187 exit `ibus emoji` with Escape key
- Add fr(bepo_afnor) keymap
- Add file list in registry file for Silverblue
---
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index 6faa10f..bbd872a 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -1,3 +1,1047 @@
+From fcb2187dd46d71031867f3bd43196c2448693469 Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Fri, 6 Sep 2019 20:59:49 +0900
+Subject: [PATCH] src/tests: Replace push with cd for Posix SH
+
+BUG=https://github.com/ibus/ibus/issues/2124
+BUG=https://github.com/ibus/ibus/issues/2126
+---
+ src/tests/ibus-config.c | 2 +-
+ src/tests/runtest | 5 +++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/tests/ibus-config.c b/src/tests/ibus-config.c
+index 9b925ad9..5e845f10 100644
+--- a/src/tests/ibus-config.c
++++ b/src/tests/ibus-config.c
+@@ -114,7 +114,7 @@ test_config_set_get (void)
+ value_bits |= (1 << 1);
+ }
+ else {
+- g_warning ("unknow value name=%s", name);
++ g_warning ("Unknown value name=%s", name);
+ }
+ ibus_config_unset (config, "test", name);
+ g_variant_unref (value);
+diff --git a/src/tests/runtest b/src/tests/runtest
+index 1fcc9283..ed38992f 100755
+--- a/src/tests/runtest
++++ b/src/tests/runtest
+@@ -111,7 +111,8 @@ fi
+ run_test_case()
+ {
+ test -d $tstdir || mkdir $tstdir
+- pushd $tstdir
++ backup_dir=$PWD
++ cd $tstdir
+
+ need_bus=no
+ for t in $BUS_REQUIRED_TESTS; do
+@@ -190,7 +191,7 @@ run_test_case()
+
+ retval=`expr $retval \| $?`
+
+- popd
++ cd $backup_dir
+
+ func_cleanup $tstdir
+ }
+--
+2.21.0
+
+From 48a8d7ed58bdfb02c24c8039bae1cb15d4fc1bce Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Fri, 6 Sep 2019 21:24:24 +0900
+Subject: [PATCH] Delete deprecated g_type_class_add_private since glib 2.58
+
+G_DEFINE_TYPE_WITH_PRIVATE() and G_ADD_PRIVATE() have been available
+since 2.38.
+IBusService has custom GBaseInitFunc and GBaseFinalizeFunc in
+ibus_service_get_type() and implements ibus_service_private_offset
+and ibus_service_get_instance_private() directly without
+G_DEFINE_TYPE_WITH_PRIVATE().
+---
+ bus/ibusimpl.c | 7 +++---
+ src/ibusbus.c | 8 +++---
+ src/ibuscomponent.c | 10 ++++----
+ src/ibusconfig.c | 9 +++----
+ src/ibusemoji.c | 14 +++++------
+ src/ibusengine.c | 10 +++-----
+ src/ibusenginedesc.c | 10 ++++----
+ src/ibusenginesimple.c | 8 +++---
+ src/ibusfactory.c | 8 +++---
+ src/ibushotkey.c | 55 ++++++++++++------------------------------
+ src/ibusinputcontext.c | 12 ++++-----
+ src/ibusobject.c | 8 +++---
+ src/ibusobservedpath.c | 6 ++---
+ src/ibusproperty.c | 8 +++---
+ src/ibusregistry.c | 10 +++-----
+ src/ibusserializable.c | 24 ++++++++++++++----
+ src/ibusservice.c | 34 +++++++++++++++++++-------
+ src/ibusunicode.c | 24 ++++++++----------
+ src/ibusxevent.c | 22 ++++++++---------
+ 19 files changed, 135 insertions(+), 152 deletions(-)
+
+diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
+index bbbb5770..39b16139 100644
+--- a/bus/ibusimpl.c
++++ b/bus/ibusimpl.c
+@@ -2,8 +2,8 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2011-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2008-2018 Red Hat, Inc.
++ * Copyright (C) 2011-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2008-2019 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
+@@ -2180,7 +2180,8 @@ bus_ibus_impl_registry_destroy (BusIBusImpl *ibus)
+
+ g_clear_pointer (&ibus->engine_table, g_hash_table_destroy);
+
+- g_clear_pointer (&ibus->registry, ibus_object_destroy);
++ ibus_object_destroy (IBUS_OBJECT (ibus->registry));
++ ibus->registry = NULL;
+
+ if (ibus->extension_register_keys)
+ g_clear_pointer (&ibus->extension_register_keys, g_variant_unref);
+diff --git a/src/ibusbus.c b/src/ibusbus.c
+index 09054851..0783e7bb 100644
+--- a/src/ibusbus.c
++++ b/src/ibusbus.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+@@ -36,7 +36,7 @@
+ #include "ibusconfig.h"
+
+ #define IBUS_BUS_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_BUS, IBusBusPrivate))
++ ((IBusBusPrivate *)ibus_bus_get_instance_private (o))
+
+ enum {
+ CONNECTED,
+@@ -115,7 +115,7 @@ static void ibus_bus_get_property (IBusBus *bus,
+
+ static void ibus_bus_close_connection (IBusBus *bus);
+
+-G_DEFINE_TYPE (IBusBus, ibus_bus, IBUS_TYPE_OBJECT)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusBus, ibus_bus, IBUS_TYPE_OBJECT)
+
+ static void
+ ibus_bus_class_init (IBusBusClass *class)
+@@ -234,8 +234,6 @@ ibus_bus_class_init (IBusBusClass *class)
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+-
+- g_type_class_add_private (class, sizeof (IBusBusPrivate));
+ }
+
+ static void
+diff --git a/src/ibuscomponent.c b/src/ibuscomponent.c
+index a933e79b..9837f47c 100644
+--- a/src/ibuscomponent.c
++++ b/src/ibuscomponent.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* bus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2008-2010 Red Hat, Inc.
++ * Copyright (C) 2008-2019 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
+@@ -58,7 +58,7 @@ struct _IBusComponentPrivate {
+ };
+
+ #define IBUS_COMPONENT_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_COMPONENT, IBusComponentPrivate))
++ ((IBusComponentPrivate *)ibus_component_get_instance_private (o))
+
+ // static guint _signals[LAST_SIGNAL] = { 0 };
+
+@@ -90,7 +90,9 @@ static void ibus_component_parse_observed_paths
+ XMLNode *node,
+ gboolean access_fs);
+
+-G_DEFINE_TYPE (IBusComponent, ibus_component, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusComponent,
++ ibus_component,
++ IBUS_TYPE_SERIALIZABLE)
+
+ static void
+ ibus_component_class_init (IBusComponentClass *class)
+@@ -99,8 +101,6 @@ ibus_component_class_init (IBusComponentClass *class)
+ IBusObjectClass *object_class = IBUS_OBJECT_CLASS (class);
+ IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (class);
+
+- g_type_class_add_private (class, sizeof (IBusComponentPrivate));
+-
+ gobject_class->set_property = (GObjectSetPropertyFunc) ibus_component_set_property;
+ gobject_class->get_property = (GObjectGetPropertyFunc) ibus_component_get_property;
+ object_class->destroy = (IBusObjectDestroyFunc) ibus_component_destroy;
+diff --git a/src/ibusconfig.c b/src/ibusconfig.c
+index 621a4e53..713fe251 100644
+--- a/src/ibusconfig.c
++++ b/src/ibusconfig.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2008-2010 Red Hat, Inc.
++ * Copyright (C) 2008-2019 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
+@@ -27,7 +27,7 @@
+ #include "ibuserror.h"
+
+ #define IBUS_CONFIG_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_CONFIG, IBusConfigPrivate))
++ ((IBusConfigPrivate *)ibus_config_get_instance_private (o))
+
+ enum {
+ VALUE_CHANGED,
+@@ -65,6 +65,7 @@ static void _signal_unsubscribe (GDBusProxy *proxy,
+ static void _remove_all_match_rules (IBusConfig *config);
+
+ G_DEFINE_TYPE_WITH_CODE (IBusConfig, ibus_config, IBUS_TYPE_PROXY,
++ G_ADD_PRIVATE (IBusConfig)
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
+ G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
+ );
+@@ -75,8 +76,6 @@ ibus_config_class_init (IBusConfigClass *class)
+ GDBusProxyClass *dbus_proxy_class = G_DBUS_PROXY_CLASS (class);
+ IBusProxyClass *proxy_class = IBUS_PROXY_CLASS (class);
+
+- g_type_class_add_private (class, sizeof (IBusConfigPrivate));
+-
+ dbus_proxy_class->g_signal = ibus_config_g_signal;
+ proxy_class->destroy = ibus_config_real_destroy;
+
+@@ -116,7 +115,7 @@ ibus_config_init (IBusConfig *config)
+ static void
+ ibus_config_real_destroy (IBusProxy *proxy)
+ {
+- IBusConfigPrivate *priv = IBUS_CONFIG_GET_PRIVATE (proxy);
++ IBusConfigPrivate *priv = IBUS_CONFIG_GET_PRIVATE (IBUS_CONFIG (proxy));
+
+ _signal_unsubscribe (G_DBUS_PROXY (proxy), priv->watch_config_signal_id);
+ _remove_all_match_rules (IBUS_CONFIG (proxy));
+diff --git a/src/ibusemoji.c b/src/ibusemoji.c
+index d56c48aa..ae8907a2 100644
+--- a/src/ibusemoji.c
++++ b/src/ibusemoji.c
+@@ -1,8 +1,8 @@
+ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+ /* vim:set et sts=4: */
+ /* bus - The Input Bus
+- * Copyright (C) 2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2017 Red Hat, Inc.
++ * Copyright (C) 2017-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2017-2019 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
+@@ -47,9 +47,7 @@ struct _IBusEmojiDataPrivate {
+ };
+
+ #define IBUS_EMOJI_DATA_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+- IBUS_TYPE_EMOJI_DATA, \
+- IBusEmojiDataPrivate))
++ ((IBusEmojiDataPrivate *)ibus_emoji_data_get_instance_private (o))
+
+ /* functions prototype */
+ static void ibus_emoji_data_set_property (IBusEmojiData *emoji,
+@@ -68,7 +66,9 @@ static gint ibus_emoji_data_deserialize (IBusEmojiData *emoji,
+ static gboolean ibus_emoji_data_copy (IBusEmojiData *emoji,
+ const IBusEmojiData *src);
+
+-G_DEFINE_TYPE (IBusEmojiData, ibus_emoji_data, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusEmojiData,
++ ibus_emoji_data,
++ IBUS_TYPE_SERIALIZABLE)
+
+ static void
+ ibus_emoji_data_class_init (IBusEmojiDataClass *class)
+@@ -89,8 +89,6 @@ ibus_emoji_data_class_init (IBusEmojiDataClass *class)
+ serializable_class->copy =
+ (IBusSerializableCopyFunc) ibus_emoji_data_copy;
+
+- g_type_class_add_private (class, sizeof (IBusEmojiDataPrivate));
+-
+ /* install properties */
+ /**
+ * IBusEmojiData:emoji:
+diff --git a/src/ibusengine.c b/src/ibusengine.c
+index 7fb4e856..9aeafbf9 100644
+--- a/src/ibusengine.c
++++ b/src/ibusengine.c
+@@ -2,8 +2,8 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2008-2018 Red Hat, Inc.
++ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2008-2019 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
+@@ -32,7 +32,7 @@
+ #include "ibusxevent.h"
+
+ #define IBUS_ENGINE_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_ENGINE, IBusEnginePrivate))
++ ((IBusEnginePrivate *)ibus_engine_get_instance_private (o))
+
+ enum {
+ PROCESS_KEY_EVENT,
+@@ -187,7 +187,7 @@ static void ibus_engine_dbus_property_changed
+ GVariant *value);
+
+
+-G_DEFINE_TYPE (IBusEngine, ibus_engine, IBUS_TYPE_SERVICE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusEngine, ibus_engine, IBUS_TYPE_SERVICE)
+
+ static const gchar introspection_xml[] =
+ "<node>"
+@@ -830,8 +830,6 @@ ibus_engine_class_init (IBusEngineClass *class)
+ G_TYPE_UINT,
+ G_TYPE_UINT);
+
+- g_type_class_add_private (class, sizeof (IBusEnginePrivate));
+-
+ text_empty = ibus_text_new_from_static_string ("");
+ g_object_ref_sink (text_empty);
+ }
+diff --git a/src/ibusenginedesc.c b/src/ibusenginedesc.c
+index 22622865..064588bd 100644
+--- a/src/ibusenginedesc.c
++++ b/src/ibusenginedesc.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* bus - The Input Bus
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2008-2015 Red Hat, Inc.
++ * Copyright (C) 2008-2019 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
+@@ -72,7 +72,7 @@ struct _IBusEngineDescPrivate {
+ };
+
+ #define IBUS_ENGINE_DESC_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_ENGINE_DESC, IBusEngineDescPrivate))
++ ((IBusEngineDescPrivate *)ibus_engine_desc_get_instance_private (o))
+
+ // static guint _signals[LAST_SIGNAL] = { 0 };
+
+@@ -95,7 +95,9 @@ static gboolean ibus_engine_desc_copy (IBusEngineDesc *des
+ static gboolean ibus_engine_desc_parse_xml_node (IBusEngineDesc *desc,
+ XMLNode *node);
+
+-G_DEFINE_TYPE (IBusEngineDesc, ibus_engine_desc, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusEngineDesc,
++ ibus_engine_desc,
++ IBUS_TYPE_SERIALIZABLE)
+
+
+ static void
+@@ -113,8 +115,6 @@ ibus_engine_desc_class_init (IBusEngineDescClass *class)
+ serializable_class->deserialize = (IBusSerializableDeserializeFunc) ibus_engine_desc_deserialize;
+ serializable_class->copy = (IBusSerializableCopyFunc) ibus_engine_desc_copy;
+
+- g_type_class_add_private (class, sizeof (IBusEngineDescPrivate));
+-
+ /* install properties */
+ /**
+ * IBusEngineDesc:name:
+diff --git a/src/ibusenginesimple.c b/src/ibusenginesimple.c
+index b623e149..43bd5283 100644
+--- a/src/ibusenginesimple.c
++++ b/src/ibusenginesimple.c
+@@ -45,7 +45,7 @@
+
+ #define X11_DATADIR X11_DATA_PREFIX "/share/X11/locale"
+ #define IBUS_ENGINE_SIMPLE_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_ENGINE_SIMPLE, IBusEngineSimplePrivate))
++ ((IBusEngineSimplePrivate *)ibus_engine_simple_get_instance_private (o))
+
+ #define SET_COMPOSE_BUFFER_ELEMENT_NEXT(buffer, index, value) { \
+ if ((index) >= COMPOSE_BUFFER_SIZE && \
+@@ -150,7 +150,9 @@ static void ibus_engine_simple_commit_str (IBusEngineSimple *simple,
+ static void ibus_engine_simple_update_preedit_text
+ (IBusEngineSimple *simple);
+
+-G_DEFINE_TYPE (IBusEngineSimple, ibus_engine_simple, IBUS_TYPE_ENGINE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusEngineSimple,
++ ibus_engine_simple,
++ IBUS_TYPE_ENGINE)
+
+ static void
+ ibus_engine_simple_class_init (IBusEngineSimpleClass *class)
+@@ -170,8 +172,6 @@ ibus_engine_simple_class_init (IBusEngineSimpleClass *class)
+ engine_class->page_up = ibus_engine_simple_page_up;
+ engine_class->candidate_clicked
+ = ibus_engine_simple_candidate_clicked;
+-
+- g_type_class_add_private (class, sizeof (IBusEngineSimplePrivate));
+ }
+
+ static void
+diff --git a/src/ibusfactory.c b/src/ibusfactory.c
+index e915c931..cb9b53cc 100644
+--- a/src/ibusfactory.c
++++ b/src/ibusfactory.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2008-2015 Red Hat, Inc.
++ * Copyright (C) 2008-2019 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
+@@ -26,7 +26,7 @@
+ #include "ibusinternal.h"
+
+ #define IBUS_FACTORY_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_FACTORY, IBusFactoryPrivate))
++ ((IBusFactoryPrivate *)ibus_factory_get_instance_private (o))
+
+ enum {
+ CREATE_ENGINE,
+@@ -87,7 +87,7 @@ static void ibus_factory_engine_destroy_cb
+ (IBusEngine *engine,
+ IBusFactory *factory);
+
+-G_DEFINE_TYPE (IBusFactory, ibus_factory, IBUS_TYPE_SERVICE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusFactory, ibus_factory, IBUS_TYPE_SERVICE)
+
+ static const gchar introspection_xml[] =
+ "<node>"
+@@ -158,8 +158,6 @@ ibus_factory_class_init (IBusFactoryClass *class)
+
+ ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), introspection_xml);
+
+- g_type_class_add_private (class, sizeof (IBusFactoryPrivate));
+-
+ /**
+ * IBusFactory::create-engine:
+ * @factory: the factory which received the signal
+diff --git a/src/ibushotkey.c b/src/ibushotkey.c
+index 249ed5d2..d4ab7c23 100644
+--- a/src/ibushotkey.c
++++ b/src/ibushotkey.c
+@@ -2,8 +2,8 @@
+ /* vim:set et sts=4: */
+ /* IBus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2008-2018 Red Hat, Inc.
++ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2008-2019 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
+@@ -27,7 +27,7 @@
+ #include "ibusshare.h"
+
+ #define IBUS_HOTKEY_PROFILE_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_HOTKEY_PROFILE, IBusHotkeyProfilePrivate))
++ ((IBusHotkeyProfilePrivate *)ibus_hotkey_profile_get_instance_private (o))
+
+ enum {
+ TRIGGER,
+@@ -79,7 +79,10 @@ static guint normalize_modifiers (guint key
+ guint modifiers);
+ static gboolean is_modifier (guint keyval);
+
+-static IBusSerializableClass *parent_class = NULL;
++G_DEFINE_TYPE_WITH_PRIVATE (IBusHotkeyProfile,
++ ibus_hotkey_profile,
++ IBUS_TYPE_SERIALIZABLE)
++
+
+ static guint profile_signals[LAST_SIGNAL] = { 0 };
+
+@@ -141,43 +144,12 @@ ibus_hotkey_cmp_with_data (IBusHotkey *hotkey1,
+
+
+
+-GType
+-ibus_hotkey_profile_get_type (void)
+-{
+- static GType type = 0;
+-
+- static const GTypeInfo type_info = {
+- sizeof (IBusHotkeyProfileClass),
+- (GBaseInitFunc) NULL,
+- (GBaseFinalizeFunc) NULL,
+- (GClassInitFunc) ibus_hotkey_profile_class_init,
+- NULL, /* class finalize */
+- NULL, /* class data */
+- sizeof (IBusHotkeyProfile),
+- 0,
+- (GInstanceInitFunc) ibus_hotkey_profile_init,
+- };
+-
+- if (type == 0) {
+- type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
+- "IBusHotkeyProfile",
+- &type_info,
+- 0);
+- }
+-
+- return type;
+-}
+-
+ static void
+ ibus_hotkey_profile_class_init (IBusHotkeyProfileClass *class)
+ {
+ IBusObjectClass *object_class = IBUS_OBJECT_CLASS (class);
+ IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (class);
+
+- parent_class = (IBusSerializableClass *) g_type_class_peek_parent (class);
+-
+- g_type_class_add_private (class, sizeof (IBusHotkeyProfilePrivate));
+-
+ object_class->destroy = (IBusObjectDestroyFunc) ibus_hotkey_profile_destroy;
+
+ serializable_class->serialize = (IBusSerializableSerializeFunc) ibus_hotkey_profile_serialize;
+@@ -255,7 +227,8 @@ ibus_hotkey_profile_destroy (IBusHotkeyProfile *profile)
+ priv->hotkeys = NULL;
+ }
+
+- IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *)profile);
++ IBUS_OBJECT_CLASS (ibus_hotkey_profile_parent_class)->
++ destroy ((IBusObject *)profile);
+ }
+
+ static gboolean
+@@ -264,7 +237,8 @@ ibus_hotkey_profile_serialize (IBusHotkeyProfile *profile,
+ {
+ gboolean retval;
+
+- retval = parent_class->serialize ((IBusSerializable *) profile, builder);
++ retval = IBUS_SERIALIZABLE_CLASS (ibus_hotkey_profile_parent_class)->
++ serialize ((IBusSerializable *) profile, builder);
+ g_return_val_if_fail (retval, FALSE);
+
+ return TRUE;
+@@ -276,7 +250,8 @@ ibus_hotkey_profile_deserialize (IBusHotkeyProfile *profile,
+ {
+ gint retval;
+
+- retval = parent_class->deserialize ((IBusSerializable *) profile, variant);
++ retval = IBUS_SERIALIZABLE_CLASS (ibus_hotkey_profile_parent_class)->
++ deserialize ((IBusSerializable *) profile, variant);
+ g_return_val_if_fail (retval, 0);
+
+ return retval;
+@@ -288,8 +263,8 @@ ibus_hotkey_profile_copy (IBusHotkeyProfile *dest,
+ {
+ gboolean retval;
+
+- retval = parent_class->copy ((IBusSerializable *)dest,
+- (IBusSerializable *)src);
++ retval = IBUS_SERIALIZABLE_CLASS (ibus_hotkey_profile_parent_class)->
++ copy ((IBusSerializable *)dest, (IBusSerializable *)src);
+ g_return_val_if_fail (retval, FALSE);
+
+ g_return_val_if_fail (IBUS_IS_HOTKEY_PROFILE (dest), FALSE);
+diff --git a/src/ibusinputcontext.c b/src/ibusinputcontext.c
+index a809ef08..2b1438fc 100644
+--- a/src/ibusinputcontext.c
++++ b/src/ibusinputcontext.c
+@@ -2,8 +2,8 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2008-2018 Red Hat, Inc.
++ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2008-2019 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
+@@ -31,7 +31,7 @@
+ #include "ibuserror.h"
+
+ #define IBUS_INPUT_CONTEXT_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_INPUT_CONTEXT, IBusInputContextPrivate))
++ ((IBusInputContextPrivate *)ibus_input_context_get_instance_private (o))
+
+ enum {
+ ENABLED,
+@@ -83,7 +83,9 @@ static void ibus_input_context_g_signal (GDBusProxy *proxy,
+ const gchar *signal_name,
+ GVariant *parameters);
+
+-G_DEFINE_TYPE (IBusInputContext, ibus_input_context, IBUS_TYPE_PROXY)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusInputContext,
++ ibus_input_context,
++ IBUS_TYPE_PROXY)
+
+ static void
+ ibus_input_context_class_init (IBusInputContextClass *class)
+@@ -91,8 +93,6 @@ ibus_input_context_class_init (IBusInputContextClass *class)
+ IBusProxyClass *ibus_proxy_class = IBUS_PROXY_CLASS (class);
+ GDBusProxyClass *g_dbus_proxy_class = G_DBUS_PROXY_CLASS (class);
+
+- g_type_class_add_private (class, sizeof (IBusInputContextPrivate));
+-
+ ibus_proxy_class->destroy = ibus_input_context_real_destroy;
+
+ g_dbus_proxy_class->g_signal = ibus_input_context_g_signal;
+diff --git a/src/ibusobject.c b/src/ibusobject.c
+index 258048c0..15d9aa3a 100644
+--- a/src/ibusobject.c
++++ b/src/ibusobject.c
+@@ -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-2013 Red Hat, Inc.
++ * Copyright (C) 2008-2019 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
+@@ -25,7 +25,7 @@
+ #include "ibusinternal.h"
+
+ #define IBUS_OBJECT_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_OBJECT, IBusObjectPrivate))
++ ((IBusObjectPrivate *)ibus_object_get_instance_private (o))
+
+ enum {
+ DESTROY,
+@@ -53,7 +53,7 @@ static void ibus_object_dispose (IBusObject *obj);
+ static void ibus_object_finalize (IBusObject *obj);
+ static void ibus_object_real_destroy (IBusObject *obj);
+
+-G_DEFINE_TYPE (IBusObject, ibus_object, G_TYPE_INITIALLY_UNOWNED)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusObject, ibus_object, G_TYPE_INITIALLY_UNOWNED)
+
+ static void
+ ibus_object_class_init (IBusObjectClass *class)
+@@ -86,8 +86,6 @@ ibus_object_class_init (IBusObjectClass *class)
+ _ibus_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+- g_type_class_add_private (class, sizeof (IBusObjectPrivate));
+-
+ #ifdef DEBUG_MEMORY
+ _count_table = g_hash_table_new (g_direct_hash, g_direct_equal);
+ #endif
+diff --git a/src/ibusobservedpath.c b/src/ibusobservedpath.c
+index cbb846df..5b79f1fe 100644
+--- a/src/ibusobservedpath.c
++++ b/src/ibusobservedpath.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input IBus
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2008-2015 Red Hat, Inc.
++ * Copyright (C) 2008-2019 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
+@@ -37,7 +37,7 @@ struct _IBusObservedPathPrivate {
+ typedef struct _IBusObservedPathPrivate IBusObservedPathPrivate;
+
+ #define IBUS_OBSERVED_PATH_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_OBSERVED_PATH, IBusObservedPathPrivate))
++ ((IBusObservedPathPrivate *)ibus_observed_path_get_instance_private (o))
+
+ // static guint _signals[LAST_SIGNAL] = { 0 };
+
+@@ -60,8 +60,6 @@ ibus_observed_path_class_init (IBusObservedPathClass *class)
+ IBusObjectClass *object_class = IBUS_OBJECT_CLASS (class);
+ IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (class);
+
+- // g_type_class_add_private (class, sizeof (IBusObservedPathPrivate));
+-
+ object_class->destroy = (IBusObjectDestroyFunc) ibus_observed_path_destroy;
+
+ serializable_class->serialize = (IBusSerializableSerializeFunc) ibus_observed_path_serialize;
+diff --git a/src/ibusproperty.c b/src/ibusproperty.c
+index c6a37534..e87d26b6 100644
+--- a/src/ibusproperty.c
++++ b/src/ibusproperty.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* IBus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2008-2010 Red Hat, Inc.
++ * Copyright (C) 2008-2019 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
+@@ -59,7 +59,7 @@ struct _IBusPropertyPrivate {
+ };
+
+ #define IBUS_PROPERTY_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_PROPERTY, IBusPropertyPrivate))
++ ((IBusPropertyPrivate *)ibus_property_get_instance_private (o))
+
+ /* functions prototype */
+ static void ibus_property_set_property (IBusProperty *prop,
+@@ -78,7 +78,7 @@ static gint ibus_property_deserialize (IBusProperty *prop,
+ static gboolean ibus_property_copy (IBusProperty *dest,
+ const IBusProperty *src);
+
+-G_DEFINE_TYPE (IBusProperty, ibus_property, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusProperty, ibus_property, IBUS_TYPE_SERIALIZABLE)
+
+ static void
+ ibus_property_class_init (IBusPropertyClass *class)
+@@ -87,8 +87,6 @@ ibus_property_class_init (IBusPropertyClass *class)
+ IBusObjectClass *object_class = IBUS_OBJECT_CLASS (class);
+ IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (class);
+
+- g_type_class_add_private (class, sizeof (IBusPropertyPrivate));
+-
+ gobject_class->set_property = (GObjectSetPropertyFunc) ibus_property_set_property;
+ gobject_class->get_property = (GObjectGetPropertyFunc) ibus_property_get_property;
+
+diff --git a/src/ibusregistry.c b/src/ibusregistry.c
+index b0483998..43990d5f 100644
+--- a/src/ibusregistry.c
++++ b/src/ibusregistry.c
+@@ -2,8 +2,8 @@
+ /* vim:set et sts=4: */
+ /* bus - The Input Bus
+ * Copyright (C) 2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2015 Red Hat, Inc.
++ * Copyright (C) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2015-2019 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
+@@ -55,7 +55,7 @@ struct _IBusRegistryPrivate {
+ };
+
+ #define IBUS_REGISTRY_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_REGISTRY, IBusRegistryPrivate))
++ ((IBusRegistryPrivate *)ibus_registry_get_instance_private (o))
+
+ /* functions prototype */
+ static void ibus_registry_destroy (IBusRegistry *registry);
+@@ -67,7 +67,7 @@ static gint ibus_registry_deserialize (IBusRegistry *registry,
+ static gboolean ibus_registry_copy (IBusRegistry *dest,
+ const IBusRegistry *src);
+
+-G_DEFINE_TYPE (IBusRegistry, ibus_registry, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusRegistry, ibus_registry, IBUS_TYPE_SERIALIZABLE)
+
+ static void
+ ibus_registry_class_init (IBusRegistryClass *class)
+@@ -84,8 +84,6 @@ ibus_registry_class_init (IBusRegistryClass *class)
+ (IBusSerializableDeserializeFunc) ibus_registry_deserialize;
+ serializable_class->copy = (IBusSerializableCopyFunc) ibus_registry_copy;
+
+- g_type_class_add_private (class, sizeof (IBusRegistryPrivate));
+-
+ /* install signals */
+ /**
+ * IBusRegistry::changed:
+diff --git a/src/ibusserializable.c b/src/ibusserializable.c
+index a8d4dd65..231020b7 100644
+--- a/src/ibusserializable.c
++++ b/src/ibusserializable.c
+@@ -2,8 +2,8 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2008-2018 Red Hat, Inc.
++ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2008-2019 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
+@@ -24,7 +24,7 @@
+ #include "ibusserializable.h"
+
+ #define IBUS_SERIALIZABLE_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_SERIALIZABLE, IBusSerializablePrivate))
++ ((IBusSerializablePrivate *)ibus_serializable_get_instance_private (o))
+
+ enum {
+ LAST_SIGNAL,
+@@ -50,7 +50,15 @@ static gboolean ibus_serializable_real_copy (IBusSerializable *des
+ const IBusSerializable *src);
+
+ static IBusObjectClass *parent_class = NULL;
++static gint ibus_serializable_private_offset;
+
++G_GNUC_UNUSED
++static inline gpointer
++ibus_serializable_get_instance_private (IBusSerializable *self)
++{
++ return (G_STRUCT_MEMBER_P (self, ibus_serializable_private_offset));
++}
++
+ GType
+ ibus_serializable_get_type (void)
+ {
+@@ -73,6 +81,9 @@ ibus_serializable_get_type (void)
+ "IBusSerializable",
+ &type_info,
+ 0);
++ ibus_serializable_private_offset =
++ g_type_add_instance_private (type,
++ sizeof (IBusSerializablePrivate));
+ }
+
+ return type;
+@@ -101,7 +112,10 @@ ibus_serializable_class_init (IBusSerializableClass *class)
+
+ parent_class = (IBusObjectClass *) g_type_class_peek_parent (class);
+
+- g_type_class_add_private (class, sizeof (IBusSerializablePrivate));
++ if (ibus_serializable_private_offset) {
++ g_type_class_adjust_private_offset (class,
++ &ibus_serializable_private_offset);
++ }
+
+ object_class->destroy = (IBusObjectDestroyFunc) ibus_serializable_destroy;
+
+@@ -184,7 +198,7 @@ ibus_serializable_real_copy (IBusSerializable *dest,
+ {
+ IBusSerializablePrivate *src_priv;
+ IBusSerializablePrivate *dest_priv;
+- src_priv = IBUS_SERIALIZABLE_GET_PRIVATE (src);
++ src_priv = IBUS_SERIALIZABLE_GET_PRIVATE (IBUS_SERIALIZABLE (src));
+ dest_priv = IBUS_SERIALIZABLE_GET_PRIVATE (dest);
+
+ g_datalist_foreach (&src_priv->attachments,
+diff --git a/src/ibusservice.c b/src/ibusservice.c
+index eb370e8b..60255bd5 100644
+--- a/src/ibusservice.c
++++ b/src/ibusservice.c
+@@ -2,8 +2,8 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2008-2018 Red Hat, Inc.
++ * Copyright (C) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2008-2019 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
+@@ -24,7 +24,7 @@
+ #include "ibusinternal.h"
+
+ #define IBUS_SERVICE_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_SERVICE, IBusServicePrivate))
++ ((IBusServicePrivate *)ibus_service_get_instance_private (o))
+
+ enum {
+ LAST_SIGNAL
+@@ -133,6 +133,13 @@ static const GDBusInterfaceVTable ibus_service_interface_vtable = {
+ };
+
+ static IBusObjectClass *ibus_service_parent_class = NULL;
++static gint ibus_service_private_offset;
++
++static inline gpointer
++ibus_service_get_instance_private (IBusService *self)
++{
++ return (G_STRUCT_MEMBER_P (self, ibus_service_private_offset));
++}
+
+ GType
+ ibus_service_get_type (void)
+@@ -156,6 +163,9 @@ ibus_service_get_type (void)
+ "IBusService",
+ &type_info,
+ 0);
++ ibus_service_private_offset =
++ g_type_add_instance_private (type,
++ sizeof (IBusServicePrivate));
+ }
+
+ return type;
+@@ -198,12 +208,20 @@ ibus_service_class_init (IBusServiceClass *class)
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+ IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (class);
+
+- ibus_service_parent_class = IBUS_OBJECT_CLASS (g_type_class_peek_parent (class));
++ ibus_service_parent_class =
++ IBUS_OBJECT_CLASS (g_type_class_peek_parent (class));
++ if (ibus_service_private_offset) {
++ g_type_class_adjust_private_offset (class,
++ &ibus_service_private_offset);
++ }
+
+ gobject_class->constructed = ibus_service_constructed;
+- gobject_class->set_property = (GObjectSetPropertyFunc) ibus_service_set_property;
+- gobject_class->get_property = (GObjectGetPropertyFunc) ibus_service_get_property;
+- ibus_object_class->destroy = (IBusObjectDestroyFunc) ibus_service_destroy;
++ gobject_class->set_property =
++ (GObjectSetPropertyFunc) ibus_service_set_property;
++ gobject_class->get_property =
++ (GObjectGetPropertyFunc) ibus_service_get_property;
++ ibus_object_class->destroy =
++ (IBusObjectDestroyFunc) ibus_service_destroy;
+
+ /* virtual functions */
+ class->service_method_call = ibus_service_service_method_call;
+@@ -252,8 +270,6 @@ ibus_service_class_init (IBusServiceClass *class)
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB)
+ );
+-
+- g_type_class_add_private (class, sizeof (IBusServicePrivate));
+ }
+
+ static void
+diff --git a/src/ibusunicode.c b/src/ibusunicode.c
+index aac9c135..9e6f6b2b 100644
+--- a/src/ibusunicode.c
++++ b/src/ibusunicode.c
+@@ -1,8 +1,8 @@
+ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+ /* vim:set et sts=4: */
+ /* bus - The Input Bus
+- * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2018 Red Hat, Inc.
++ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2018-2019 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
+@@ -64,13 +64,9 @@ typedef struct {
+ } IBusUnicodeDataLoadData;
+
+ #define IBUS_UNICODE_DATA_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+- IBUS_TYPE_UNICODE_DATA, \
+- IBusUnicodeDataPrivate))
++ ((IBusUnicodeDataPrivate *)ibus_unicode_data_get_instance_private (o))
+ #define IBUS_UNICODE_BLOCK_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+- IBUS_TYPE_UNICODE_BLOCK, \
+- IBusUnicodeBlockPrivate))
++ ((IBusUnicodeBlockPrivate *)ibus_unicode_block_get_instance_private (o))
+
+ /* functions prototype */
+ static void ibus_unicode_data_set_property (IBusUnicodeData *unicode,
+@@ -106,8 +102,12 @@ static gint ibus_unicode_block_deserialize (IBusUnicodeBlock *block,
+ static gboolean ibus_unicode_block_copy (IBusUnicodeBlock *dest,
+ const IBusUnicodeBlock *src);
+
+-G_DEFINE_TYPE (IBusUnicodeData, ibus_unicode_data, IBUS_TYPE_SERIALIZABLE)
+-G_DEFINE_TYPE (IBusUnicodeBlock, ibus_unicode_block, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusUnicodeData,
++ ibus_unicode_data,
++ IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusUnicodeBlock,
++ ibus_unicode_block,
++ IBUS_TYPE_SERIALIZABLE)
+
+ static void
+ ibus_unicode_data_class_init (IBusUnicodeDataClass *class)
+@@ -128,8 +128,6 @@ ibus_unicode_data_class_init (IBusUnicodeDataClass *class)
+ serializable_class->copy =
+ (IBusSerializableCopyFunc) ibus_unicode_data_copy;
+
+- g_type_class_add_private (class, sizeof (IBusUnicodeDataPrivate));
+-
+ /* install properties */
+ /**
+ * IBusUnicodeData:code:
+@@ -690,8 +688,6 @@ ibus_unicode_block_class_init (IBusUnicodeBlockClass *class)
+ serializable_class->copy =
+ (IBusSerializableCopyFunc) ibus_unicode_block_copy;
+
+- g_type_class_add_private (class, sizeof (IBusUnicodeBlockPrivate));
+-
+ /* install properties */
+ /**
+ * IBusUnicodeBlock:start:
+diff --git a/src/ibusxevent.c b/src/ibusxevent.c
+index 287bb99b..a2ea7b57 100644
+--- a/src/ibusxevent.c
++++ b/src/ibusxevent.c
+@@ -1,8 +1,8 @@
+ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+- * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+- * Copyright (C) 2018 Red Hat, Inc.
++ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright (C) 2018-2019 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
+@@ -24,13 +24,11 @@
+
+ #define IBUS_EXTENSION_EVENT_VERSION 1
+ #define IBUS_EXTENSION_EVENT_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+- IBUS_TYPE_EXTENSION_EVENT, \
+- IBusExtensionEventPrivate))
++ ((IBusExtensionEventPrivate *)ibus_extension_event_get_instance_private (o))
+
+ #define IBUS_X_EVENT_VERSION 1
+ #define IBUS_X_EVENT_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_X_EVENT, IBusXEventPrivate))
++ ((IBusXEventPrivate *)ibus_x_event_get_instance_private (o))
+
+ enum {
+ PROP_0,
+@@ -128,8 +126,12 @@ static gint ibus_x_event_deserialize (IBusXEvent *event,
+ static gboolean ibus_x_event_copy (IBusXEvent *dest,
+ const IBusXEvent *src);
+
+-G_DEFINE_TYPE (IBusExtensionEvent, ibus_extension_event, IBUS_TYPE_SERIALIZABLE)
+-G_DEFINE_TYPE (IBusXEvent, ibus_x_event, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusExtensionEvent,
++ ibus_extension_event,
++ IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusXEvent,
++ ibus_x_event,
++ IBUS_TYPE_SERIALIZABLE)
+
+ static void
+ ibus_extension_event_class_init (IBusExtensionEventClass *class)
+@@ -228,8 +230,6 @@ ibus_extension_event_class_init (IBusExtensionEventClass *class)
+ "",
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+-
+- g_type_class_add_private (class, sizeof (IBusExtensionEventPrivate));
+ }
+
+ static void
+@@ -779,8 +779,6 @@ ibus_x_event_class_init (IBusXEventClass *class)
+ "",
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+-
+- g_type_class_add_private (class, sizeof (IBusXEventPrivate));
+ }
+
+ static void
+--
+2.21.0
+
From 3d442dbf936d197aa11ca0a71663c2bc61696151 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 13 Sep 2019 15:59:03 +0900
@@ -148,28 +1192,267 @@ index 3a626230..2439de14 100644
g_error ("Your socket address does not have the format unix:tmpdir=$DIR "
@@ -152,7 +203,7 @@ bus_server_init (void)
server = g_dbus_server_new_sync (
- g_address, /* the place where the socket file lives, e.g. /tmp, abstract namespace, etc. */
+ g_address, /* the place where the socket file lives, e.g. /tmp, abstract namespace, etc. */
+ flags, guid,
+- NULL /* observer */,
++ observer,
+ NULL /* cancellable */,
+ &error);
+ if (server == NULL) {
+@@ -162,7 +213,13 @@ bus_server_init (void)
+ }
+ g_free (guid);
+
+- g_signal_connect (server, "new-connection", G_CALLBACK (bus_new_connection_cb), NULL);
++ g_signal_connect (observer, "allow-mechanism",
++ G_CALLBACK (bus_allow_mechanism_cb), NULL);
++ g_signal_connect (observer, "authorize-authenticated-peer",
++ G_CALLBACK (bus_authorize_authenticated_peer_cb), NULL);
++ g_object_unref (observer);
++ g_signal_connect (server, "new-connection",
++ G_CALLBACK (bus_new_connection_cb), NULL);
+
+ g_dbus_server_start (server);
+
+--
+2.21.0
+
+From a141a14102da038e3f35557ec42e14e322cfdff1 Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Fri, 13 Sep 2019 20:19:36 +0900
+Subject: [PATCH] bus: Use XDG_RUNTIME_DIR for Unix socket directory
+
+g_dbus_server_new_sync() is failed with address "unix:tmpdir=/tmp/ibus"
+in BSD systems because BSD systems do not support abstract socket files
+and use the real files but no directory "/tmp/ibus". Now the default
+directory will be an unique "unix:tmpdir=$XDG_RUNTIME_DIR/ibus" by user
+in Linux and "unix:tmpdir=/tmp" in BSD and mkdir() runs with the directory
+mode 0700 not to modify by malicious users.
+
+BUG=https://github.com/ibus/ibus/issues/2116
+---
+ bus/global.c | 6 ++--
+ bus/server.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++-----
+ configure.ac | 25 +++++++++++++
+ 3 files changed, 120 insertions(+), 10 deletions(-)
+
+diff --git a/bus/global.c b/bus/global.c
+index 2ba8b2a7..8758d923 100644
+--- a/bus/global.c
++++ b/bus/global.c
+@@ -2,7 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright (C) 2008-2010 Red Hat, Inc.
++ * Copyright (C) 2008-2019 Red Hat, Inc.
+ * Copyright (c) 2012 Google, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+@@ -21,10 +21,12 @@
+ * USA
+ */
+
++#include <config.h>
++
+ #include "global.h"
+
+ gchar **g_argv = NULL;
+-gchar *g_address = "unix:tmpdir=/tmp/ibus";
++gchar *g_address = IBUS_SOCKET_DIR;
+ gchar *g_cache = "auto";
+ gboolean g_mempro = FALSE;
+ gboolean g_verbose = FALSE;
+diff --git a/bus/server.c b/bus/server.c
+index 2439de14..d9c30e44 100644
+--- a/bus/server.c
++++ b/bus/server.c
+@@ -22,6 +22,8 @@
+ */
+ #include "server.h"
+
++#include <errno.h>
++#include <glib/gstdio.h>
+ #include <gio/gio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -180,28 +182,102 @@ bus_acquired_handler (GDBusConnection *connection,
+ NULL);
+ }
+
++static gchar *
++_bus_extract_address (void)
++{
++ gchar *socket_address = g_strdup (g_address);
++ gchar *p;
++
++#define IF_REPLACE_VARIABLE_WITH_FUNC(variable, func, format) \
++ if ((p = g_strstr_len (socket_address, -1, (variable)))) { \
++ gchar *sub1 = g_strndup (socket_address, p - socket_address); \
++ gchar *sub2 = g_strdup (p + strlen (variable)); \
++ gchar *tmp = g_strdup_printf ("%s" format "%s", \
++ sub1, (func) (), sub2); \
++ g_free (sub1); \
++ g_free (sub2); \
++ g_free (socket_address); \
++ socket_address = tmp; \
++ }
++
++ IF_REPLACE_VARIABLE_WITH_FUNC ("$XDG_RUNTIME_DIR",
++ g_get_user_runtime_dir,
++ "%s")
++ else
++ IF_REPLACE_VARIABLE_WITH_FUNC ("$XDG_CACHE_HOME",
++ g_get_user_cache_dir,
++ "%s")
++ else
++ IF_REPLACE_VARIABLE_WITH_FUNC ("$UID", getuid, "%d")
++
++#undef IF_REPLACE_VARIABLE_WITH_FUNC
++
++ return socket_address;
++}
++
+ void
+ bus_server_init (void)
+ {
+- GError *error = NULL;
++#define IBUS_UNIX_TMPDIR "unix:tmpdir="
++#define IBUS_UNIX_PATH "unix:path="
++#define IBUS_UNIX_ABSTRACT "unix:abstract="
++#define IBUS_UNIX_DIR "unix:dir="
++
++ gchar *socket_address;
+ GDBusServerFlags flags = G_DBUS_SERVER_FLAGS_NONE;
+ gchar *guid;
+ GDBusAuthObserver *observer;
++ GError *error = NULL;
++ gchar *unix_dir = NULL;
+
+ dbus = bus_dbus_impl_get_default ();
+ ibus = bus_ibus_impl_get_default ();
+ bus_dbus_impl_register_object (dbus, (IBusService *)ibus);
+
+ /* init server */
++ socket_address = _bus_extract_address ();
++
++#define IF_GET_UNIX_DIR(prefix) \
++ if (g_str_has_prefix (socket_address, (prefix))) { \
++ unix_dir = g_strdup (socket_address + strlen (prefix)); \
++ }
++
++ IF_GET_UNIX_DIR (IBUS_UNIX_TMPDIR)
++ else
++ IF_GET_UNIX_DIR (IBUS_UNIX_PATH)
++ else
++ IF_GET_UNIX_DIR (IBUS_UNIX_ABSTRACT)
++ else
++ IF_GET_UNIX_DIR (IBUS_UNIX_DIR)
++ else {
++ g_error ("Your socket address \"%s\" does not correspond with "
++ "one of the following formats; "
++ IBUS_UNIX_TMPDIR "DIR, " IBUS_UNIX_PATH "FILE, "
++ IBUS_UNIX_ABSTRACT "FILE, " IBUS_UNIX_DIR "DIR.",
++ socket_address);
++ }
++ if (!g_file_test (unix_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
++ /* Require mkdir for BSD system. */
++ if (g_mkdir_with_parents (unix_dir, 0) != 0) {
++ g_error ("mkdir is failed in: %s: %s",
++ unix_dir, g_strerror (errno));
++ }
++ /* The mode 0700 can eliminate malicious users change the mode.
++ * `chmod` runs for the last directory only not to change the modes
++ * of the parent directories. E.g. "/tmp/ibus".
++ */
++ if (g_chmod (unix_dir, 0700) != 0) {
++ g_error ("chmod(700) is failed in: %s: %s",
++ unix_dir, g_strerror (errno));
++ }
++ }
++ g_free (unix_dir);
+ guid = g_dbus_generate_guid ();
+ observer = g_dbus_auth_observer_new ();
+- if (!g_str_has_prefix (g_address, "unix:tmpdir=") &&
+- !g_str_has_prefix (g_address, "unix:path=")) {
+- g_error ("Your socket address does not have the format unix:tmpdir=$DIR "
+- "or unix:path=$FILE; %s", g_address);
+- }
+ server = g_dbus_server_new_sync (
+- g_address, /* the place where the socket file lives, e.g. /tmp, abstract namespace, etc. */
++ /* the place where the socket file lives, e.g. /tmp,
++ * abstract namespace, etc. */
++ socket_address,
flags, guid,
-- NULL /* observer */,
-+ observer,
+ observer,
NULL /* cancellable */,
- &error);
+@@ -209,8 +285,9 @@ bus_server_init (void)
if (server == NULL) {
-@@ -162,7 +213,13 @@ bus_server_init (void)
+ g_error ("g_dbus_server_new_sync() is failed with address %s "
+ "and guid %s: %s",
+- g_address, guid, error->message);
++ socket_address, guid, error->message);
}
++ g_free (socket_address);
g_free (guid);
-- g_signal_connect (server, "new-connection", G_CALLBACK (bus_new_connection_cb), NULL);
-+ g_signal_connect (observer, "allow-mechanism",
-+ G_CALLBACK (bus_allow_mechanism_cb), NULL);
-+ g_signal_connect (observer, "authorize-authenticated-peer",
-+ G_CALLBACK (bus_authorize_authenticated_peer_cb), NULL);
-+ g_object_unref (observer);
-+ g_signal_connect (server, "new-connection",
-+ G_CALLBACK (bus_new_connection_cb), NULL);
+ g_signal_connect (observer, "allow-mechanism",
+@@ -235,6 +312,12 @@ bus_server_init (void)
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ bus_acquired_handler,
+ NULL, NULL, NULL, NULL);
++
++#undef IF_GET_UNIX_DIR
++#undef IBUS_UNIX_TMPDIR
++#undef IBUS_UNIX_PATH
++#undef IBUS_UNIX_ABSTRACT
++#undef IBUS_UNIX_DIR
+ }
- g_dbus_server_start (server);
+ const gchar *
+diff --git a/configure.ac b/configure.ac
+index c47e23dc..0c1ee40e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -702,6 +702,30 @@ the UCD files from https://www.unicode.org/Public/UNIDATA/)
+ enable_unicode_dict="yes (enabled, use --disable-unicode-dict to disable)"
+ fi
++AC_ARG_WITH(socket-dir,
++ AS_HELP_STRING([--with-socket-dir[=DIR]],
++ [Set the default socket directory to connect ibus-daemon with D-Bus
++ connections (default: "$XDG_RUNTIME_DIR/ibus").
++ The best practice of the socket directory would be unique per user
++ not to modify by malicious users but XDG_RUNTIME_DIR is not integrated
++ in BSD systems and the BSD's default is "/tmp".
++ "$XDG_RUMTIME_DIR", "$XDG_CACHE_HOME", "$UID" are extracted by
++ ibus-daemon.
++ ibus-daemon also runs mkdir for the socket directory since BSD
++ systems do not support abstract socket paths.
++ The socket path on a NFS mount would not be a good idea likes
++ "/home/$USER" because the directory is not sometimes accessible
++ with the network condition.]),
++ [IBUS_SOCKET_DIR=$with_socket_dir],
++ [case $host in
++ *linux*) IBUS_SOCKET_DIR='unix:tmpdir=$XDG_RUNTIME_DIR/ibus';;
++ *) IBUS_SOCKET_DIR='unix:tmpdir=/tmp';;
++ esac]
++
++)
++AC_DEFINE_UNQUOTED(IBUS_SOCKET_DIR, "$IBUS_SOCKET_DIR",
++ [The default socket directory to connect ibus-daemon.])
++
+ # Check iso-codes.
+ PKG_CHECK_MODULES(ISOCODES, [
+ iso-codes
+@@ -793,6 +817,7 @@ Build options:
+ CLDR annotation directory $EMOJI_ANNOTATION_DIR
+ Enable Unicode dict $enable_unicode_dict
+ UCD directory $UCD_DIR
++ Socket directory "$IBUS_SOCKET_DIR"
+ Run test cases $enable_tests
+ Install tests $enable_install_tests
+ ])
--
2.21.0
@@ -203,3 +1486,1272 @@ index 5fd37f10..dd9d31d4 100644
--
2.21.0
+From 5742e1b399e5d50f34f35b1cda74e548b95554da Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Wed, 2 Oct 2019 16:41:27 +0900
+Subject: [PATCH] Revert XDG_RUNTIME_DIR to XDG_CONFIG_HOME
+
+Some users failed to run ibus-daemon with XDG_RUNTIME_DIR because
+the directory is not created by `su` command.
+Now the IBus socket files will be generated in XDG_CACHE_HOME.
+
+BUG=https://github.com/ibus/ibus/issues/2135
+---
+ configure.ac | 6 ++++--
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0c1ee40e..84589be0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -705,10 +705,12 @@ fi
+ AC_ARG_WITH(socket-dir,
+ AS_HELP_STRING([--with-socket-dir[=DIR]],
+ [Set the default socket directory to connect ibus-daemon with D-Bus
+- connections (default: "$XDG_RUNTIME_DIR/ibus").
++ connections (default: "$XDG_CACHE_HOME/ibus").
+ The best practice of the socket directory would be unique per user
+ not to modify by malicious users but XDG_RUNTIME_DIR is not integrated
+ in BSD systems and the BSD's default is "/tmp".
++ XDG_RUMTIME_DIR is not useful now because XDG_RUMTIME_DIR is available
++ by login but not `su` command but ibus-daemon can be run with su.
+ "$XDG_RUMTIME_DIR", "$XDG_CACHE_HOME", "$UID" are extracted by
+ ibus-daemon.
+ ibus-daemon also runs mkdir for the socket directory since BSD
+@@ -718,7 +720,7 @@ AC_ARG_WITH(socket-dir,
+ with the network condition.]),
+ [IBUS_SOCKET_DIR=$with_socket_dir],
+ [case $host in
+- *linux*) IBUS_SOCKET_DIR='unix:tmpdir=$XDG_RUNTIME_DIR/ibus';;
++ *linux*) IBUS_SOCKET_DIR='unix:tmpdir=$XDG_CACHE_HOME/ibus';;
+ *) IBUS_SOCKET_DIR='unix:tmpdir=/tmp';;
+ esac]
+
+--
+2.21.0
+
+From 35863d81d15e3d3463cd5dafd0473afb193c57e3 Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Wed, 30 Oct 2019 17:29:25 +0900
+Subject: [PATCH] Fix deprecated APIs
+
+- Fix deprecated gtk_misc_set_padding(), gtk_widget_set_margin_left(),
+ gtk_widget_set_margin_right() in emojilang.py, enginedialog.py,
+ setup.ui, candidatearea.vala, candidatepanel.vala, switcher.vala
+ since GTK 3.12
+
+- Fix g_new0() argument 1 range [18446744071562067968, 18446744073709551615]
+ exceeds maximum object size 9223372036854775807
+ [-Walloc-size-larger-than=] by adding g_assert() in ibuscomposetable.c
+
+- Fix gdk_keymap_get_default() with gdk_keymap_get_for_display() in
+ bindingcommon.vala
+
+- Fix string.utf8_offset() with string.next_char() in emojier.vala
+
+- Fix Posix.SIGUSR1 with Posix.Signal.USR1 in panel.vala
+---
+ bus/ibusimpl.c | 1 +
+ configure.ac | 3 ++-
+ setup/emojilang.py | 14 +++++++-------
+ setup/enginedialog.py | 18 +++++++++---------
+ setup/setup.ui | 34 +++++++++++++++++-----------------
+ src/ibuscomposetable.c | 1 +
+ ui/gtk3/bindingcommon.vala | 6 +++---
+ ui/gtk3/candidatearea.vala | 9 +++++----
+ ui/gtk3/candidatepanel.vala | 10 +++++-----
+ ui/gtk3/emojier.vala | 4 +++-
+ ui/gtk3/panel.vala | 4 ++--
+ ui/gtk3/switcher.vala | 9 +++++----
+ 12 files changed, 60 insertions(+), 53 deletions(-)
+
+diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
+index 39b16139..85761d30 100644
+--- a/bus/ibusimpl.c
++++ b/bus/ibusimpl.c
+@@ -2180,6 +2180,7 @@ bus_ibus_impl_registry_destroy (BusIBusImpl *ibus)
+
+ g_clear_pointer (&ibus->engine_table, g_hash_table_destroy);
+
++ /* g_clear_pointer() does not set the cast. */
+ ibus_object_destroy (IBUS_OBJECT (ibus->registry));
+ ibus->registry = NULL;
+
+diff --git a/configure.ac b/configure.ac
+index 84589be0..ab74a380 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -53,6 +53,7 @@ m4_define([ibus_binary_version],
+
+ # Required versions of other packages.
+ m4_define([glib_required_version], [2.46.0])
++m4_define([gtk3_required_version], [3.12.0])
+
+ # VALA_TARGET_GLIB_VERSION is used by valac --ccode --target-glib .
+ # VALA_TARGET_GLIB_VERSION and glib_required_version will be different
+@@ -238,7 +239,7 @@ fi
+ if test x"$enable_gtk3" = x"yes"; then
+ # check for gtk3
+ PKG_CHECK_MODULES(GTK3, [
+- gtk+-3.0
++ gtk+-3.0 >= gtk3_required_version
+ ])
+ PKG_CHECK_EXISTS([gdk-wayland-3.0],
+ [enable_gdk3_wayland=yes],
+diff --git a/setup/emojilang.py b/setup/emojilang.py
+index 8250589d..58757d86 100644
+--- a/setup/emojilang.py
++++ b/setup/emojilang.py
+@@ -3,7 +3,7 @@
+ #
+ # ibus - The Input Bus
+ #
+-# Copyright (c) 2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
++# Copyright (c) 2017-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ # Copyright (c) 2017 Red Hat, Inc.
+ #
+ # This program is free software; you can redistribute it and/or
+@@ -83,8 +83,8 @@ class EmojiLangChooser(Gtk.Dialog):
+ hscrollbar_policy = Gtk.PolicyType.NEVER,
+ vscrollbar_policy = Gtk.PolicyType.NEVER,
+ shadow_type = Gtk.ShadowType.IN,
+- margin_left = 6,
+- margin_right = 6,
++ margin_start = 6,
++ margin_end = 6,
+ margin_top = 6,
+ margin_bottom = 6)
+ self.vbox.add(self.__scrolled)
+@@ -192,8 +192,8 @@ class EmojiLangChooser(Gtk.Dialog):
+ label = Gtk.Label(label = text)
+ label.set_halign(alignment)
+ label.set_valign(Gtk.Align.CENTER)
+- label.set_margin_left(20)
+- label.set_margin_right(20)
++ label.set_margin_start(20)
++ label.set_margin_end(20)
+ label.set_margin_top(6)
+ label.set_margin_bottom(6)
+ hbox.pack_start(label, True, True, 0)
+@@ -235,8 +235,8 @@ class EmojiLangChooser(Gtk.Dialog):
+ row.set_tooltip_text(_("More…"))
+ arrow = Gtk.Image.new_from_icon_name('view-more-symbolic',
+ Gtk.IconSize.MENU)
+- arrow.set_margin_left(20)
+- arrow.set_margin_right(20)
++ arrow.set_margin_start(20)
++ arrow.set_margin_end(20)
+ arrow.set_margin_top(6)
+ arrow.set_margin_bottom(6)
+ arrow.set_halign(Gtk.Align.CENTER)
+diff --git a/setup/enginedialog.py b/setup/enginedialog.py
+index 2c472deb..72deada8 100644
+--- a/setup/enginedialog.py
++++ b/setup/enginedialog.py
+@@ -4,7 +4,7 @@
+ # ibus - The Input Bus
+ #
+ # Copyright (c) 2015 Peng Huang <shawn.p.huang@gmail.com>
+-# Copyright (c) 2015 Takao Fujiwara <takao.fujiwara1@gmail.com>
++# Copyright (c) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ # Copyright (c) 2013-2015 Red Hat, Inc.
+ #
+ # This program is free software; you can redistribute it and/or
+@@ -70,8 +70,8 @@ class EngineDialog(Gtk.Dialog):
+ hscrollbar_policy = Gtk.PolicyType.NEVER,
+ vscrollbar_policy = Gtk.PolicyType.NEVER,
+ shadow_type = Gtk.ShadowType.IN,
+- margin_left = 6,
+- margin_right = 6,
++ margin_start = 6,
++ margin_end = 6,
+ margin_top = 6,
+ margin_bottom = 6)
+ self.vbox.add(self.__scrolled)
+@@ -94,8 +94,8 @@ class EngineDialog(Gtk.Dialog):
+ self.__filter_timeout_id = 0
+ self.__filter_word = None
+ self.__filter_entry = Gtk.SearchEntry(hexpand = True,
+- margin_left = 6,
+- margin_right = 6,
++ margin_start = 6,
++ margin_end = 6,
+ margin_top = 6,
+ margin_bottom = 6)
+ self.__filter_entry.set_no_show_all(True)
+@@ -164,8 +164,8 @@ class EngineDialog(Gtk.Dialog):
+ label = Gtk.Label(label = text)
+ label.set_halign(alignment)
+ label.set_valign(Gtk.Align.CENTER)
+- label.set_margin_left(20)
+- label.set_margin_right(20)
++ label.set_margin_start(20)
++ label.set_margin_end(20)
+ label.set_margin_top(6)
+ label.set_margin_bottom(6)
+ hbox.pack_start(label, True, True, 0)
+@@ -205,8 +205,8 @@ class EngineDialog(Gtk.Dialog):
+ row.set_tooltip_text(_("More…"))
+ arrow = Gtk.Image.new_from_icon_name('view-more-symbolic',
+ Gtk.IconSize.MENU)
+- arrow.set_margin_left(20)
+- arrow.set_margin_right(20)
++ arrow.set_margin_start(20)
++ arrow.set_margin_end(20)
+ arrow.set_margin_top(6)
+ arrow.set_margin_bottom(6)
+ arrow.set_halign(Gtk.Align.CENTER)
+diff --git a/setup/setup.ui b/setup/setup.ui
+index 9d9d7ee9..56453054 100644
+--- a/setup/setup.ui
++++ b/setup/setup.ui
+@@ -90,8 +90,8 @@
+ <property name="spacing">18</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+- <property name="margin_left">12</property>
+- <property name="margin_right">12</property>
++ <property name="margin_start">12</property>
++ <property name="margin_end">12</property>
+ <child>
+ <object class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+@@ -105,7 +105,7 @@
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <property name="margin_top">6</property>
+- <property name="margin_left">12</property>
++ <property name="margin_start">12</property>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+@@ -366,7 +366,7 @@
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <property name="margin_top">6</property>
+- <property name="margin_left">12</property>
++ <property name="margin_start">12</property>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+@@ -589,8 +589,8 @@
+ <property name="can_focus">False</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+- <property name="margin_left">12</property>
+- <property name="margin_right">12</property>
++ <property name="margin_start">12</property>
++ <property name="margin_end">12</property>
+ <child>
+ <object class="GtkBox" id="hbox1">
+ <property name="orientation">horizontal</property>
+@@ -658,7 +658,7 @@
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">start</property>
+- <property name="margin_left">12</property>
++ <property name="margin_start">12</property>
+ <child>
+ <object class="GtkButton" id="button_engine_add">
+ <property name="label" translatable="yes">_Add</property>
+@@ -811,7 +811,7 @@
+ <property name="max_width_chars">74</property>
+ <property name="label" translatable="yes"><small><i>The active input method can be switched around from the selected ones in the above list by pressing the keyboard shortcut keys or clicking the panel icon.</i></small></property>
+ <property name="use_markup">True</property>
+- <!-- property name="margin_left">0</property -->
++ <!-- property name="margin_start">0</property -->
+ </object>
+ <packing>
+ <property name="expand">True</property>
+@@ -850,8 +850,8 @@
+ <property name="spacing">18</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+- <property name="margin_left">12</property>
+- <property name="margin_right">12</property>
++ <property name="margin_start">12</property>
++ <property name="margin_end">12</property>
+ <child>
+ <object class="GtkFrame" id="frame_emoji1">
+ <property name="visible">True</property>
+@@ -865,7 +865,7 @@
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <property name="margin_top">6</property>
+- <property name="margin_left">12</property>
++ <property name="margin_start">12</property>
+ <child>
+ <object class="GtkLabel" id="label_emoji1">
+ <property name="visible">True</property>
+@@ -1004,7 +1004,7 @@
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <property name="margin_top">6</property>
+- <property name="margin_left">12</property>
++ <property name="margin_start">12</property>
+ <property name="row_homogeneous">false</property>
+ <child>
+ <object class="GtkLabel" id="label_emoji_font">
+@@ -1187,8 +1187,8 @@
+ <property name="can_focus">False</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+- <property name="margin_left">12</property>
+- <property name="margin_right">12</property>
++ <property name="margin_start">12</property>
++ <property name="margin_end">12</property>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+@@ -1202,7 +1202,7 @@
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <property name="margin_top">6</property>
+- <property name="margin_left">24</property>
++ <property name="margin_start">24</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton_use_sys_layout">
+ <property name="label" translatable="yes">Use system keyboard layout</property>
+@@ -1251,7 +1251,7 @@
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <property name="margin_top">6</property>
+- <property name="margin_left">24</property>
++ <property name="margin_start">24</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton_use_global_engine">
+ <property name="label" translatable="yes">Share the same input method among all applications</property>
+@@ -1348,7 +1348,7 @@ Homepage: https://github.com/ibus/ibus/wiki
+ <property name="halign">start</property>
+ <property name="draw_indicator">True</property>
+ <property name="margin_top">6</property>
+- <property name="margin_left">12</property>
++ <property name="margin_start">12</property>
+ </object>
+ </child>
+ <child type="label">
+diff --git a/src/ibuscomposetable.c b/src/ibuscomposetable.c
+index dd9d31d4..e4e3a7cd 100644
+--- a/src/ibuscomposetable.c
++++ b/src/ibuscomposetable.c
+@@ -1058,6 +1058,7 @@ ibus_compose_table_list_add_array (GSList *compose_tables,
+ int i;
+ guint16 *ibus_compose_seqs = NULL;
+
++ g_assert (length >= 0);
+ g_return_val_if_fail (data != NULL, compose_tables);
+ g_return_val_if_fail (max_seq_len <= IBUS_MAX_COMPOSE_LEN, compose_tables);
+
+diff --git a/ui/gtk3/bindingcommon.vala b/ui/gtk3/bindingcommon.vala
+index 4171f29d..150d4c39 100644
+--- a/ui/gtk3/bindingcommon.vala
++++ b/ui/gtk3/bindingcommon.vala
+@@ -3,7 +3,7 @@
+ * ibus - The Input Bus
+ *
+ * Copyright(c) 2018 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright(c) 2018 Takao Fujwiara <takao.fujiwara1@gmail.com>
++ * Copyright(c) 2018-2019 Takao Fujwiara <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
+@@ -75,8 +75,8 @@ class BindingCommon {
+ // workaround a bug in gdk vapi vala > 0.18
+ // https://bugzilla.gnome.org/show_bug.cgi?id=677559
+ #if VALA_0_18
+- Gdk.Keymap.get_default().map_virtual_modifiers(
+- ref switch_modifiers);
++ Gdk.Keymap.get_for_display(Gdk.Display.get_default()
++ ).map_virtual_modifiers(ref switch_modifiers);
+ #else
+ if ((switch_modifiers & Gdk.ModifierType.SUPER_MASK) != 0)
+ switch_modifiers |= Gdk.ModifierType.MOD4_MASK;
+diff --git a/ui/gtk3/candidatearea.vala b/ui/gtk3/candidatearea.vala
+index 781ecd1e..b22ab5da 100644
+--- a/ui/gtk3/candidatearea.vala
++++ b/ui/gtk3/candidatearea.vala
+@@ -3,7 +3,7 @@
+ * ibus - The Input Bus
+ *
+ * Copyright(c) 2011-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright(c) 2015-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright(c) 2015-2019 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
+@@ -215,9 +215,10 @@ class CandidateArea : Gtk.Box {
+ candidate.show();
+ m_candidates += candidate;
+
+- /* Use Gtk.Widget.set_margin_start() since gtk 3.12 */
+- label.set_padding(8, 0);
+- candidate.set_padding(8, 0);
++ label.set_margin_start (8);
++ label.set_margin_end (8);
++ candidate.set_margin_start (8);
++ candidate.set_margin_end (8);
+
+ // Make a copy of i to workaround a bug in vala.
+ // https://bugzilla.gnome.org/show_bug.cgi?id=628336
+diff --git a/ui/gtk3/candidatepanel.vala b/ui/gtk3/candidatepanel.vala
+index d404c659..8994cdb9 100644
+--- a/ui/gtk3/candidatepanel.vala
++++ b/ui/gtk3/candidatepanel.vala
+@@ -3,7 +3,7 @@
+ * ibus - The Input Bus
+ *
+ * Copyright(c) 2011-2015 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright(c) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright(c) 2015-2019 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
+@@ -242,16 +242,16 @@ public class CandidatePanel : Gtk.Box{
+ m_preedit_label.set_size_request(20, -1);
+ m_preedit_label.set_halign(Gtk.Align.START);
+ m_preedit_label.set_valign(Gtk.Align.CENTER);
+- /* Use Gtk.Widget.set_margin_start() since gtk 3.12 */
+- m_preedit_label.set_padding(8, 0);
++ m_preedit_label.set_margin_start(8);
++ m_preedit_label.set_margin_end(8);
+ m_preedit_label.set_no_show_all(true);
+
+ m_aux_label = new Gtk.Label(null);
+ m_aux_label.set_size_request(20, -1);
+ m_aux_label.set_halign(Gtk.Align.START);
+ m_aux_label.set_valign(Gtk.Align.CENTER);
+- /* Use Gtk.Widget.set_margin_start() since gtk 3.12 */
+- m_aux_label.set_padding(8, 0);
++ m_aux_label.set_margin_start(8);
++ m_aux_label.set_margin_end(8);
+ m_aux_label.set_no_show_all(true);
+
+ m_candidate_area = new CandidateArea(m_vertical_panel_system);
+diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
+index fc15cffe..4e52769c 100644
+--- a/ui/gtk3/emojier.vala
++++ b/ui/gtk3/emojier.vala
+@@ -2147,11 +2147,13 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+ ncandidates));
+ int char_count = text.text.char_count();
+ int start_index = -1;
++ unowned string title = text.text;
+ for (int i = 0; i < char_count; i++) {
+- if (text.text.utf8_offset(i).has_prefix(language)) {
++ if (title.has_prefix(language)) {
+ start_index = i;
+ break;
+ }
++ title = title.next_char();
+ }
+ if (start_index >= 0) {
+ var attr = new IBus.Attribute(
+diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
+index 2054658e..680c86ed 100644
+--- a/ui/gtk3/panel.vala
++++ b/ui/gtk3/panel.vala
+@@ -1053,7 +1053,7 @@ class Panel : IBus.PanelService {
+
+ private void show_setup_dialog() {
+ if (m_setup_pid != 0) {
+- if (Posix.kill(m_setup_pid, Posix.SIGUSR1) == 0)
++ if (Posix.kill(m_setup_pid, Posix.Signal.USR1) == 0)
+ return;
+ m_setup_pid = 0;
+ }
+@@ -1087,7 +1087,7 @@ class Panel : IBus.PanelService {
+
+ string copyright =
+ "Copyright © 2007-2015 Peng Huang\n" +
+- "Copyright © 2015 Takao Fujiwara\n" +
++ "Copyright © 2015-2019 Takao Fujiwara\n" +
+ "Copyright © 2007-2015 Red Hat, Inc.\n";
+
+ m_about_dialog.set_copyright(copyright);
+diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
+index 0de44e98..a4529c88 100644
+--- a/ui/gtk3/switcher.vala
++++ b/ui/gtk3/switcher.vala
+@@ -3,7 +3,7 @@
+ * ibus - The Input Bus
+ *
+ * Copyright(c) 2011-2016 Peng Huang <shawn.p.huang@gmail.com>
+- * Copyright(c) 2015-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
++ * Copyright(c) 2015-2019 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
+@@ -125,9 +125,10 @@ class Switcher : Gtk.Window {
+ Atk.Object obj = m_label.get_accessible();
+ obj.set_role (Atk.Role.STATUSBAR);
+
+- /* Use Gtk.Widget.set_margin_start() and
+- * Gtk.Widget.set_margin_top() since gtk 3.12 */
+- m_label.set_padding(3, 3);
++ m_label.set_margin_start(3);
++ m_label.set_margin_end(3);
++ m_label.set_margin_top(3);
++ m_label.set_margin_bottom(3);
+ vbox.pack_end(m_label, false, false, 0);
+
+ grab_focus();
+--
+2.21.0
+
+From efeb7b9689126e4f05bd1e10441cdc4a3720ff1c Mon Sep 17 00:00:00 2001
+From: Robert Hoffmann <externer.dl.hoffmann@muenchen.de>
+Date: Fri, 1 Nov 2019 21:55:13 +0900
+Subject: [PATCH] bus: Fix restart crash with inotify read()
+
+Do not close inotify desciptors when restarting the server. This
+may lead to crashes in glib.
+
+Fixes crash in libglib/libgio with
+GLib-GIO-ERROR : inotify read(): Bad file descriptor
+
+See also src/tests/ibus-bus.c: start_exit_async():
+ /* When `./runtest ibus-bus` runs, ibus-daemon sometimes failed to
+ * restart because closing a file descriptor was failed in
+ * bus/server.c:_restart_server() with a following error:
+ * "inotify read(): Bad file descriptor"
+
+Test plan:
+Run
+$ ibus restart
+several times. Without the patch ibus-daemon will crash occasionally.
+
+BUG=https://github.com/ibus/ibus/pull/2148
+---
+ bus/server.c | 28 ++++++++++++++++++++++++----
+ 1 file changed, 24 insertions(+), 4 deletions(-)
+
+diff --git a/bus/server.c b/bus/server.c
+index d9c30e44..a7554a88 100644
+--- a/bus/server.c
++++ b/bus/server.c
+@@ -26,6 +26,8 @@
+ #include <glib/gstdio.h>
+ #include <gio/gio.h>
+ #include <stdlib.h>
++#include <fcntl.h>
++#include <errno.h>
+ #include <string.h>
+
+ #include "dbusimpl.h"
+@@ -45,16 +47,33 @@ _restart_server (void)
+ {
+ gchar *exe;
+ gint fd;
++ ssize_t r;
++ int MAXSIZE = 0xFFF;
++ char proclnk[MAXSIZE];
++ char filename[MAXSIZE];
+
+- exe = g_strdup_printf ("/proc/%d/exe", getpid ());
+- exe = g_file_read_link (exe, NULL);
++ exe = g_file_read_link ("/proc/self/exe", NULL);
+
+ if (exe == NULL)
+- exe = BINDIR "/ibus-daemon";
++ exe = g_strdup (BINDIR "/ibus-daemon");
+
+ /* close all fds except stdin, stdout, stderr */
+ for (fd = 3; fd <= sysconf (_SC_OPEN_MAX); fd ++) {
+- close (fd);
++ errno = 0;
++ /* only close valid fds */
++ if (fcntl (fd, F_GETFD) != -1 || errno != EBADF) {
++ g_sprintf (proclnk, "/proc/self/fd/%d", fd);
++ r = readlink (proclnk, filename, MAXSIZE);
++ if (r < 0) {
++ continue;
++ }
++ filename[r] = '\0';
++
++ /* Do not close 'anon_inode:inotify' fds, that may crash in glib */
++ if (g_strcmp0 (filename, "anon_inode:inotify") != 0) {
++ close (fd);
++ }
++ }
+ }
+
+ _restart = FALSE;
+@@ -69,6 +88,7 @@ _restart_server (void)
+ execv (exe, g_argv);
+ }
+ g_warning ("execv %s failed!", g_argv[0]);
++ g_free (exe);
+ exit (-1);
+ }
+
+--
+2.21.0
+
+From 26a8105b7003953e56bf04426ee89a93482a45c5 Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Sun, 10 Nov 2019 09:53:27 +0900
+Subject: [PATCH] ui/gtk3: Fix to exit `ibus emoji` with Escape key
+
+When Escape key is pressed, the current ibus-ui-emojier should exit
+although another daemon one is alive.
+
+`ibus emoji` was used in Wayland desktop as a workaround but now
+IBus emoji functions are moved to the engine's pre-edit and the same
+function is available with Ctrl-Sfhit-e and space key so this problem
+would not be so visible.
+
+BUG=rhbz#1658187
+---
+ ui/gtk3/emojier.vala | 5 ++--
+ ui/gtk3/emojierapp.vala | 63 +++++++++++++++++++++++++++++------------
+ 2 files changed, 48 insertions(+), 20 deletions(-)
+
+diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
+index 4e52769c..13bacebd 100644
+--- a/ui/gtk3/emojier.vala
++++ b/ui/gtk3/emojier.vala
+@@ -320,6 +320,7 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+
+ public signal void candidate_clicked(uint index, uint button, uint state);
+ public signal void commit_text(string text);
++ public signal void cancel();
+
+ public IBusEmojier() {
+ GLib.Object(
+@@ -1789,8 +1790,7 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+ show_emoji_variants(emojis);
+ return true;
+ }
+- if (m_input_context_path != "")
+- m_result = text;
++ m_result = text;
+ if (need_commit_signal)
+ commit_text(text);
+ return false;
+@@ -1897,6 +1897,7 @@ public class IBusEmojier : Gtk.ApplicationWindow {
+ // PageUp/PageDown.
+ remove_all_children();
+ }
++ cancel();
+ return false;
+ }
+
+diff --git a/ui/gtk3/emojierapp.vala b/ui/gtk3/emojierapp.vala
+index e8331989..783c611c 100644
+--- a/ui/gtk3/emojierapp.vala
++++ b/ui/gtk3/emojierapp.vala
+@@ -3,6 +3,7 @@
+ * ibus - The Input Bus
+ *
+ * Copyright (c) 2017 Peng Wu <alexepico@gmail.com>
++ * Copyright (c) 2017-2019 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
+@@ -40,6 +41,33 @@ public class EmojiApplication : Gtk.Application {
+ }
+
+
++ private void save_selected_string(string? selected_string,
++ bool cancelled) {
++ if (cancelled) {
++ m_command_line.print("%s\n", _("Canceled to choose an emoji."));
++ return;
++ }
++ GLib.return_if_fail(selected_string != null);
++ Gtk.Clipboard clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD);
++ clipboard.set_text(selected_string, -1);
++ clipboard.store();
++
++ var emojier_favorites = m_settings_emoji.get_strv("favorites");
++ bool has_favorite = false;
++ foreach (unowned string favorite in emojier_favorites) {
++ if (favorite == selected_string) {
++ has_favorite = true;
++ break;
++ }
++ }
++ if (!has_favorite) {
++ emojier_favorites += selected_string;
++ m_settings_emoji.set_strv("favorites", emojier_favorites);
++ }
++ m_command_line.print("%s\n", _("Copied an emoji to your clipboard."));
++ }
++
++
+ private void show_dialog(ApplicationCommandLine command_line) {
+ m_command_line = command_line;
+ m_emojier.reset();
+@@ -55,7 +83,7 @@ public class EmojiApplication : Gtk.Application {
+ return;
+ if (button == IBusEmojier.BUTTON_CLOSE_BUTTON) {
+ m_emojier.hide();
+- m_command_line.print("%s\n", _("Canceled to choose an emoji."));
++ save_selected_string(null, true);
+ m_command_line = null;
+ return;
+ }
+@@ -74,23 +102,7 @@ public class EmojiApplication : Gtk.Application {
+ }
+ string emoji = m_emojier.get_current_candidate();
+ m_emojier.hide();
+- Gtk.Clipboard clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD);
+- clipboard.set_text(emoji, -1);
+- clipboard.store();
+-
+- var emojier_favorites = m_settings_emoji.get_strv("favorites");
+- bool has_favorite = false;
+- foreach (unowned string favorite in emojier_favorites) {
+- if (favorite == emoji) {
+- has_favorite = true;
+- break;
+- }
+- }
+- if (!has_favorite) {
+- emojier_favorites += emoji;
+- m_settings_emoji.set_strv("favorites", emojier_favorites);
+- }
+- m_command_line.print("%s\n", _("Copied an emoji to your clipboard."));
++ save_selected_string(emoji, false);
+ m_command_line = null;
+ }
+
+@@ -202,6 +214,21 @@ public class EmojiApplication : Gtk.Application {
+ m_emojier.candidate_clicked.connect((i, b, s) => {
+ candidate_clicked_lookup_table(i, b, s);
+ });
++ m_emojier.cancel.connect(() => {
++ if (m_command_line == null)
++ return;
++ m_emojier.hide();
++ save_selected_string(null, true);
++ m_command_line = null;
++ });
++ m_emojier.commit_text.connect(() => {
++ if (m_command_line == null)
++ return;
++ m_emojier.hide();
++ string selected_string = m_emojier.get_selected_string();
++ save_selected_string(selected_string, false);
++ m_command_line = null;
++ });
+ }
+
+ activate_dialog(command_line);
+--
+2.21.0
+
+From 76b1773c6ef529888bcd62c4f8207c89ba23503f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano-Tarumi?= <fmang@mg0.fr>
+Date: Mon, 18 Nov 2019 12:05:35 +0900
+Subject: [PATCH] engine-simple: Add the French bepo_afnor layout
+
+BUG=https://github.com/ibus/ibus/pull/2155
+---
+ engine/simple.xml.in | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/engine/simple.xml.in b/engine/simple.xml.in
+index 4445c254..fc1541ec 100644
+--- a/engine/simple.xml.in
++++ b/engine/simple.xml.in
+@@ -283,6 +283,18 @@
+ <icon>ibus-keyboard</icon>
+ <rank>1</rank>
+ </engine>
++ <engine>
++ <name>xkb:fr:bepo_afnor:fra</name>
++ <language>fr</language>
++ <license>GPL</license>
++ <author>Peng Huang <shawn.p.huang@gmail.com></author>
++ <layout>fr</layout>
++ <layout_variant>bepo_afnor</layout_variant>
++ <longname>French (Bepo, ergonomic, Dvorak way, AFNOR)</longname>
++ <description>French (Bepo, ergonomic, Dvorak way, AFNOR)</description>
++ <icon>ibus-keyboard</icon>
++ <rank>1</rank>
++ </engine>
+ <engine>
+ <name>xkb:fr:dvorak:fra</name>
+ <language>fr</language>
+--
+2.21.0
+
+From 7f335dcc3dcfe51f74f1dc4e13315e1031d4561e Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Mon, 18 Nov 2019 11:33:04 +0900
+Subject: [PATCH] src: Add file list in registry file
+
+Under Fedora Silverblue, st_mtime in /usr/share/ibus/component is
+1 Jan 1970 even if ibus engines are installed and ibus-daemon
+cannot detect new engines.
+Now IBusObservedPath saves hashed file list besides st_mtime of
+the compnent directory to detect the installed engines newly.
+
+BUG=https://github.com/ibus/ibus/issues/2132
+---
+ src/ibuscomponent.c | 7 +-
+ src/ibusobservedpath.c | 275 ++++++++++++++++++++++++++++++++++++-----
+ src/ibusregistry.c | 2 +-
+ 3 files changed, 250 insertions(+), 34 deletions(-)
+
+diff --git a/src/ibuscomponent.c b/src/ibuscomponent.c
+index 9837f47c..bbff10fd 100644
+--- a/src/ibuscomponent.c
++++ b/src/ibuscomponent.c
+@@ -2,6 +2,7 @@
+ /* vim:set et sts=4: */
+ /* bus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
++ * Copyright (C) 2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2019 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+@@ -499,11 +500,7 @@ ibus_component_output (IBusComponent *component,
+
+ for (p = component->priv->observed_paths; p != NULL; p = p->next ) {
+ IBusObservedPath *path = (IBusObservedPath *) p->data;
+-
+- g_string_append_indent (output, indent + 2);
+- g_string_append_printf (output, "<path mtime=\"%ld\" >%s</path>\n",
+- path->mtime,
+- path->path);
++ ibus_observed_path_output (path, output, indent + 2);
+ }
+
+ g_string_append_indent (output, indent + 1);
+diff --git a/src/ibusobservedpath.c b/src/ibusobservedpath.c
+index 5b79f1fe..bf7229b7 100644
+--- a/src/ibusobservedpath.c
++++ b/src/ibusobservedpath.c
+@@ -2,6 +2,7 @@
+ /* vim:set et sts=4: */
+ /* ibus - The Input IBus
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
++ * Copyright (C) 2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2019 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+@@ -30,9 +31,9 @@ enum {
+ };
+
+
+-/* IBusObservedPathPriv */
++/* IBusObservedPathPrivate */
+ struct _IBusObservedPathPrivate {
+- gpointer pad;
++ guint *file_hash_list;
+ };
+ typedef struct _IBusObservedPathPrivate IBusObservedPathPrivate;
+
+@@ -52,7 +53,9 @@ static gboolean ibus_observed_path_copy (IBusObservedPath *des
+ static gboolean ibus_observed_path_parse_xml_node (IBusObservedPath *path,
+ XMLNode *node);
+
+-G_DEFINE_TYPE (IBusObservedPath, ibus_observed_path, IBUS_TYPE_SERIALIZABLE)
++G_DEFINE_TYPE_WITH_PRIVATE (IBusObservedPath,
++ ibus_observed_path,
++ IBUS_TYPE_SERIALIZABLE)
+
+ static void
+ ibus_observed_path_class_init (IBusObservedPathClass *class)
+@@ -84,7 +87,9 @@ static gboolean
+ ibus_observed_path_serialize (IBusObservedPath *path,
+ GVariantBuilder *builder)
+ {
++ IBusObservedPathPrivate *priv = IBUS_OBSERVED_PATH_GET_PRIVATE (path);
+ gboolean retval;
++ guint i;
+
+ retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->
+ serialize ((IBusSerializable *)path, builder);
+@@ -93,6 +98,15 @@ ibus_observed_path_serialize (IBusObservedPath *path,
+ g_variant_builder_add (builder, "s", path->path);
+ g_variant_builder_add (builder, "x", path->mtime);
+
++ if (!priv->file_hash_list) {
++ g_variant_builder_add (builder, "u", 0);
++ return TRUE;
++ }
++ for (i = 0; priv->file_hash_list[i]; i++);
++ g_variant_builder_add (builder, "u", i);
++ for (i = 0; priv->file_hash_list[i]; i++)
++ g_variant_builder_add (builder, "u", priv->file_hash_list[i]);
++
+ return TRUE;
+ }
+
+@@ -100,7 +114,9 @@ static gint
+ ibus_observed_path_deserialize (IBusObservedPath *path,
+ GVariant *variant)
+ {
++ IBusObservedPathPrivate *priv = IBUS_OBSERVED_PATH_GET_PRIVATE (path);
+ gint retval;
++ guint i, length = 0;
+
+ retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->
+ deserialize ((IBusSerializable *)path, variant);
+@@ -109,6 +125,15 @@ ibus_observed_path_deserialize (IBusObservedPath *path,
+ ibus_g_variant_get_child_string (variant, retval++, &path->path);
+ g_variant_get_child (variant, retval++, "x", &path->mtime);
+
++ if (g_variant_n_children (variant) < retval + 2)
++ return retval;
++ g_variant_get_child (variant, retval++, "u", &length);
++ if (!length)
++ return retval;
++ priv->file_hash_list = g_new0 (guint, length + 1);
++ for (i = 0; i < length; i++)
++ g_variant_get_child (variant, retval++, "u", &priv->file_hash_list[i]);
++
+ return retval;
+ }
+
+@@ -116,14 +141,27 @@ static gboolean
+ ibus_observed_path_copy (IBusObservedPath *dest,
+ const IBusObservedPath *src)
+ {
++ IBusObservedPathPrivate *dest_priv = IBUS_OBSERVED_PATH_GET_PRIVATE (dest);
++ IBusObservedPathPrivate *src_priv =
++ IBUS_OBSERVED_PATH_GET_PRIVATE ((IBusObservedPath *)src);
+ gboolean retval;
++ guint i;
+
+- retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->copy ((IBusSerializable *)dest, (IBusSerializable *)src);
++ retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->
++ copy ((IBusSerializable *)dest, (IBusSerializable *)src);
+ g_return_val_if_fail (retval, FALSE);
+
+ dest->path = g_strdup (src->path);
+ dest->mtime = src->mtime;
+
++ g_clear_pointer (&dest_priv->file_hash_list, g_free);
++ if (!src_priv->file_hash_list)
++ return TRUE;
++ for (i = 0; src_priv->file_hash_list[i]; i++);
++ dest_priv->file_hash_list = g_new0 (guint, i + 1);
++ for (i = 0; src_priv->file_hash_list[i]; i++)
++ dest_priv->file_hash_list[i] = src_priv->file_hash_list[i];
++
+ return TRUE;
+ }
+
+@@ -137,23 +175,48 @@ ibus_observed_path_copy (IBusObservedPath *dest,
+
+ void
+ ibus_observed_path_output (IBusObservedPath *path,
+- GString *output,
+- gint indent)
++ GString *output,
++ gint indent)
+ {
++ IBusObservedPathPrivate *priv = IBUS_OBSERVED_PATH_GET_PRIVATE (path);
++ guint i;
++
+ g_assert (IBUS_IS_OBSERVED_PATH (path));
+ g_assert (output);
+
+- g_string_append_indent (output, indent);
+- g_string_append_printf (output, "<path mtime=\"%ld\" >%s</path>\n",
+- path->mtime,
+- path->path);
++ if (!priv->file_hash_list) {
++ g_string_append_indent (output, indent);
++ g_string_append_printf (output, "<path mtime=\"%ld\" >%s</path>\n",
++ path->mtime,
++ path->path);
++ } else {
++ g_string_append_indent (output, indent);
++ g_string_append_printf (
++ output,
++ "<path mtime=\"%ld\" type=\"dir\" path=\"%s\">\n",
++ path->mtime,
++ path->path);
++ for (i = 0; priv->file_hash_list[i]; i++) {
++ g_string_append_indent (output, indent + 1);
++ g_string_append_printf (output, "<file hash=\"%u\" />\n",
++ priv->file_hash_list[i]);
++ }
++ g_string_append_indent (output, indent);
++ g_string_append_printf (output, "</path>\n");
++ }
+ }
+
+ gboolean
+ ibus_observed_path_check_modification (IBusObservedPath *path)
+ {
++ IBusObservedPathPrivate *priv = IBUS_OBSERVED_PATH_GET_PRIVATE (path);
+ gchar *real_path = NULL;
+ struct stat buf;
++ gboolean retval = FALSE;
++ GDir *dir = NULL;
++ const gchar *name;
++ guint i = 0;
++ guint file_num = 0;
+
+ g_assert (IBUS_IS_OBSERVED_PATH (path));
+
+@@ -169,11 +232,71 @@ ibus_observed_path_check_modification (IBusObservedPath *path)
+ buf.st_mtime = 0;
+ }
+
+- g_free (real_path);
+
+- if (path->mtime == buf.st_mtime)
+- return FALSE;
+- return TRUE;
++ if (path->mtime != buf.st_mtime) {
++ retval = TRUE;
++ goto end_check_modification;
++ }
++
++ /* If an ibus engine is installed, normal file system updates
++ * the directory mtime of "/usr/share/ibus/component" and
++ * path->mtime of the cache file and buf.st_mtime of the current directory
++ * could have the different values.
++ *
++ * But under a special file system, the buf.st_mtime is not updated
++ * even if an ibus engine is installed, likes Fedora Silverblue
++ * and ibus_observed_path_check_modification() could not detect
++ * the installed ibus engines.
++ * Now path->priv->file_hash_list reserves the hash list of the files
++ * in the observed directory and if a new ibus engine is installed,
++ * the hash of the compose file does not exists in the cache's
++ * file_hash_list and ibus-daemon regenerate the cache successfully.
++ */
++ if (!priv->file_hash_list) {
++ /* If the cache version is old, ibus_registry_load_cache() returns
++ * FALSE and ibus_registry_check_modification() and this are not
++ * called.
++ * If the cache version is the latest, the cache file includes the
++ * filled file_hash_list for directories with ibus_observed_path_new()
++ * when the cache was generated.
++ * Then if file_hash_list is null, it's a simple file in ibus
++ * components and return here simply.
++ */
++ goto end_check_modification;
++ }
++ dir = g_dir_open (real_path, 0, NULL);
++ g_return_val_if_fail (dir, FALSE);
++
++ while ((name = g_dir_read_name (dir)) != NULL) {
++ guint current_hash;
++ gboolean has_file = FALSE;
++
++ if (!g_str_has_suffix (name, ".xml"))
++ continue;
++ current_hash = g_str_hash (name);
++ for (i = 0; priv->file_hash_list[i]; i++) {
++ if (current_hash == priv->file_hash_list[i]) {
++ has_file = TRUE;
++ break;
++ }
++ }
++ if (!has_file) {
++ retval = TRUE;
++ goto end_check_modification;
++ }
++ file_num++;
++ }
++ if (!retval) {
++ for (i = 0; priv->file_hash_list[i]; i++);
++ if (file_num != i)
++ retval = TRUE;
++ }
++
++end_check_modification:
++ if (dir)
++ g_dir_close (dir);
++ g_free (real_path);
++ return retval;
+ }
+
+ static void
+@@ -224,7 +347,7 @@ ibus_observed_path_traverse (IBusObservedPath *path,
+ paths = g_list_append (paths, sub);
+ paths = g_list_concat (paths,
+ ibus_observed_path_traverse (sub, dir_only));
+- } else if (!dir_only) {
++ } else if (sub->is_exist && !dir_only) {
+ paths = g_list_append (paths, sub);
+ }
+ }
+@@ -233,36 +356,102 @@ ibus_observed_path_traverse (IBusObservedPath *path,
+ return paths;
+ }
+
++
++static gboolean
++ibus_observed_path_parse_file (IBusObservedPath *path,
++ XMLNode *node,
++ int *nth)
++{
++ IBusObservedPathPrivate *priv = IBUS_OBSERVED_PATH_GET_PRIVATE (path);
++ gchar **attr;
++
++ for (attr = node->attributes; attr[0]; attr += 2) {
++ guint hash = 0;
++
++ if (g_strcmp0 (*attr, "hash") == 0)
++ hash = atol (attr[1]);
++ else if (g_strcmp0 (*attr, "name") == 0)
++ hash = g_str_hash (attr[1]);
++ if (hash) {
++ if (!priv->file_hash_list) {
++ *nth = 0;
++ priv->file_hash_list = g_new0 (guint, *nth + 2);
++ } else {
++ priv->file_hash_list = g_renew (guint, priv->file_hash_list,
++ *nth + 2);
++ }
++ priv->file_hash_list[*nth] = hash;
++ priv->file_hash_list[*nth + 1] = 0;
++ *nth += 1;
++ continue;
++ }
++ g_warning ("Unkonwn attribute %s", attr[0]);
++ }
++
++ return TRUE;
++}
++
++
+ static gboolean
+ ibus_observed_path_parse_xml_node (IBusObservedPath *path,
+ XMLNode *node)
+ {
++ gchar **attr;
++ const gchar *full_path = node->text;
++ GList *p;
++ int i = 0;
++
+ g_assert (IBUS_IS_OBSERVED_PATH (path));
+ g_assert (node);
+
+- if (G_UNLIKELY (g_strcmp0 (node->name, "path") != 0)) {
++ if (G_UNLIKELY (g_strcmp0 (node->name, "path") != 0))
+ return FALSE;
++
++ for (attr = node->attributes; attr[0]; attr += 2) {
++ if (g_strcmp0 (*attr, "mtime") == 0) {
++ path->mtime = atol (attr[1]);
++ continue;
++ }
++ if (g_strcmp0 (*attr, "path") == 0) {
++ full_path = attr[1];
++ continue;
++ }
++ if (g_strcmp0 (*attr, "type") == 0) {
++ if (!g_strcmp0 (attr[1], "dir"))
++ path->is_dir = TRUE;
++ else if (!g_strcmp0 (attr[1], "file"))
++ path->is_dir = FALSE;
++ else
++ g_warning ("The type attribute can be \"dir\" or \"file\".");
++ continue;
++ }
++ g_warning ("Unkonwn attribute %s", attr[0]);
+ }
+
+- if (node->text[0] == '~' && node->text[1] != G_DIR_SEPARATOR) {
+- g_warning ("Invalid path \"%s\"", node->text);
++ if (full_path[0] == '~' && full_path[1] != G_DIR_SEPARATOR) {
++ g_warning ("Invalid path \"%s\"", full_path);
+ return FALSE;
+ }
+
+- path->path = g_strdup (node->text);
++ path->path = g_strdup (full_path);
+
+- gchar **attr;
+- for (attr = node->attributes; attr[0]; attr += 2) {
+- if (g_strcmp0 (*attr, "mtime") == 0) {
+- path->mtime = atol (attr[1]);
++ if (!path->is_dir)
++ return TRUE;
++
++ for (i = 0, p = node->sub_nodes; p != NULL; p = p->next) {
++ XMLNode *sub_node = (XMLNode *)p->data;
++
++ if (G_UNLIKELY (g_strcmp0 (sub_node->name, "file") != 0)) {
++ g_warning ("Unkonwn tag %s", sub_node->name);
+ continue;
+ }
+- g_warning ("Unkonwn attribute %s", attr[0]);
++ ibus_observed_path_parse_file (path, sub_node, &i);
+ }
+
+ return TRUE;
+ }
+
++
+ IBusObservedPath *
+ ibus_observed_path_new_from_xml_node (XMLNode *node,
+ gboolean fill_stat)
+@@ -288,16 +477,46 @@ IBusObservedPath *
+ ibus_observed_path_new (const gchar *path,
+ gboolean fill_stat)
+ {
+- g_assert (path);
+-
+ IBusObservedPath *op;
++ IBusObservedPathPrivate *priv;
++ GList *file_list, *l;
++ guint i = 0;
+
++ g_assert (path);
+ op = (IBusObservedPath *) g_object_new (IBUS_TYPE_OBSERVED_PATH, NULL);
+ op->path = g_strdup (path);
+
+- if (fill_stat) {
+- ibus_observed_path_fill_stat (op);
++ priv = IBUS_OBSERVED_PATH_GET_PRIVATE (op);
++ l = file_list = ibus_observed_path_traverse (op, FALSE);
++ for (; l; l = l->next) {
++ IBusObservedPath *sub = l->data;
++ const gchar *file = NULL;
++
++ g_return_val_if_fail (sub && sub->path, op);
++
++ file = sub->path;
++ if (!g_str_has_suffix (file, ".xml"))
++ continue;
++ if (g_str_has_prefix (file, path)) {
++ file += strlen (path);
++ if (*file == '/')
++ file++;
++ /* Ignore sub directories */
++ if (strchr (file, '/'))
++ continue;
++ }
++ if (!i)
++ priv->file_hash_list = g_new0 (guint, i + 2);
++ else
++ priv->file_hash_list = g_renew (guint, priv->file_hash_list, i + 2);
++ priv->file_hash_list[i] = g_str_hash (file);
++ priv->file_hash_list[i + 1] = 0;
++ ++i;
+ }
++ g_list_free_full (file_list, (GDestroyNotify)ibus_observed_path_destroy);
++
++ if (fill_stat)
++ ibus_observed_path_fill_stat (op);
+
+ return op;
+ }
+diff --git a/src/ibusregistry.c b/src/ibusregistry.c
+index 43990d5f..378388d9 100644
+--- a/src/ibusregistry.c
++++ b/src/ibusregistry.c
+@@ -29,7 +29,7 @@
+ #include "ibusregistry.h"
+
+ #define IBUS_CACHE_MAGIC 0x49425553 /* "IBUS" */
+-#define IBUS_CACHE_VERSION 0x00010512
++#define IBUS_CACHE_VERSION 0x00010522
+
+ enum {
+ CHANGED,
+--
+2.21.0
+
diff --git a/ibus.spec b/ibus.spec
index 495d956..59e7a8a 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -35,7 +35,7 @@
Name: ibus
Version: 1.5.21
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@@ -269,6 +269,7 @@ fi
#autoreconf -f -i -v
#make -C ui/gtk3 maintainer-clean-generic
#make -C tools maintainer-clean-generic
+autoreconf -f -i -v
%configure \
--disable-static \
--enable-gtk2 \
@@ -290,6 +291,7 @@ fi
--enable-install-tests \
%{nil}
+make -C ui/gtk3 maintainer-clean-generic
make %{?_smp_mflags}
%install
@@ -461,6 +463,15 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
+* Mon Nov 18 2019 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.21-4
+- Replace push with cd for Posix SH
+- Use XDG_CONFIG_HOME for Unix socket directory
+- Fix deprecated APIs
+- Fix restart crash with inotify read()
+- Fix Bug 1658187 exit `ibus emoji` with Escape key
+- Add fr(bepo_afnor) keymap
+- Add file list in registry file for Silverblue
+
* Fri Oct 04 2019 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.21-3
- Fix to allocate compose output buffer with more than two chars
reply other threads:[~2026-05-31 2:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178019323783.1.63508555038622714.rpms-ibus-66e07d2dbc09@fedoraproject.org \
--to=tfujiwar@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox