Resolve #2284094 Fix preedit in Flatpak with new DBus unique name

- Add directory %%{_prefix}/lib/systemd/user/gnome-session.target.wants
- Add directory %%{_libdir}/gtk-4.0/%{gtk4_binary_version}/immodules
This commit is contained in:
Takao Fujiwara 2024-06-01 23:04:02 +09:00
parent 3dc77d7066
commit 1df9affaed
2 changed files with 252 additions and 2 deletions

View File

@ -806,7 +806,7 @@ index ac478855..e2f96a37 100644
From 759105df1d83ae25d9eea801a7c91e67dca43cb8 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 25 May 2024 19:23:23 +0900
Subject: [PATCH] bus: Change IBus unique name to :1.0 from IBUS_SERVICE_IBUS
Subject: [PATCH 1/6] bus: Change IBus unique name to :1.0 from IBUS_SERVICE_IBUS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -1053,3 +1053,246 @@ index 1dd304cd..37b6347b 100644
--
2.45.0
From a4d58cb859cad4a0c12e2c2a34f440f77cd73bae Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 1 Jun 2024 20:20:19 +0900
Subject: [PATCH 2/6] portal: Let Flatpak application accept new IBus unique name
ibus-portal can accept the connection from IBUS_SERVICE_IBUS only
but now the IBus unique name is changed to IBUS_NAME_OWNER_NAME
as the D-Bus name owner and probably I think the name check is
not needed and just delete it.
BUG=https://github.com/ibus/ibus/issues/2639
Fixes: https://github.com/ibus/ibus/commit/759105d
---
portal/portal.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/portal/portal.c b/portal/portal.c
index c2e4fc7f..34da9679 100644
--- a/portal/portal.c
+++ b/portal/portal.c
@@ -400,9 +400,6 @@ portal_context_g_signal (GDBusProxy *proxy,
GError *error = NULL;
GDBusConnection *connection;
- if (g_strcmp0 (sender_name, IBUS_SERVICE_IBUS) != 0)
- return;
-
connection = g_dbus_interface_skeleton_get_connection (
G_DBUS_INTERFACE_SKELETON (portal_context));
if (!g_dbus_connection_emit_signal (connection,
--
2.45.0
From 02632ccdd430fdc3d1a58025d31c5ec72d9a7989 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 1 Jun 2024 20:32:29 +0900
Subject: [PATCH 3/6] portal: Support new sync ibus_input_context_process_key_event()
IBus clients have been enhanced with the new synchronous
"ProcessKeyEvent" to fix the long-standing issues and ibus-portal
also needs to support it.
Fixes: https://github.com/ibus/ibus/commit/38f09c6
---
portal/org.freedesktop.IBus.Portal.xml | 7 +++-
portal/portal.c | 54 ++++++++++++++++++++++++--
2 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/portal/org.freedesktop.IBus.Portal.xml b/portal/org.freedesktop.IBus.Portal.xml
index 376ad424..0b3f6864 100644
--- a/portal/org.freedesktop.IBus.Portal.xml
+++ b/portal/org.freedesktop.IBus.Portal.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright (C) 2017-2019 Red Hat, Inc.
+ Copyright (C) 2017-2024 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
@@ -128,8 +128,13 @@
<arg type='v' name='prop' />
</signal>
+ <property name='PostProcessKeyEvent' type='(a(yv))' access='read'>
+ </property>
<property name='ContentType' type='(uu)' access='write' />
<property name='ClientCommitPreedit' type='(b)' access='write' />
+ <property name='EffectivePostProcessKeyEvent' type='(b)' access='write'>
+ </property>
+
</interface>
<interface name='org.freedesktop.IBus.Service'>
diff --git a/portal/portal.c b/portal/portal.c
index 34da9679..5cd38779 100644
--- a/portal/portal.c
+++ b/portal/portal.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) 2017-2021 Red Hat, Inc.
+ * Copyright (C) 2017-2024 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
@@ -66,8 +66,10 @@ struct _IBusPortalClass
enum
{
- PROP_CONTENT_TYPE = 1,
+ PROP_POST_PROCESS_KEY_EVENT = 1,
+ PROP_CONTENT_TYPE,
PROP_CLIENT_COMMIT_PREEDIT,
+ PROP_EFFECTIVE_POST_PROCESS_KEY_EVENT,
N_PROPERTIES
};
@@ -330,6 +332,23 @@ ibus_portal_context_set_property (IBusPortalContext *portal_context,
NULL /* user_data */
);
break;
+ case PROP_EFFECTIVE_POST_PROCESS_KEY_EVENT:
+ g_dbus_proxy_call (G_DBUS_PROXY (portal_context->context),
+ "org.freedesktop.DBus.Properties.Set",
+ g_variant_new ("(ssv)",
+ IBUS_INTERFACE_INPUT_CONTEXT,
+ "EffectivePostProcessKeyEvent",
+ g_value_get_variant (value)),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, /* cancellable */
+ NULL, /* callback */
+ NULL /* user_data */
+ );
+ break;
+ case PROP_POST_PROCESS_KEY_EVENT:
+ g_warning ("No support for setting content type");
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (portal_context, prop_id, pspec);
}
@@ -341,10 +360,37 @@ ibus_portal_context_get_property (IBusPortalContext *portal_context,
GValue *value,
GParamSpec *pspec)
{
+ GVariant *result;
+ GVariant *variant = NULL;
+ GError *error = NULL;
switch (prop_id) {
+ case PROP_POST_PROCESS_KEY_EVENT:
+ result = g_dbus_proxy_call_sync (G_DBUS_PROXY (portal_context->context),
+ "org.freedesktop.DBus.Properties.Get",
+ g_variant_new (
+ "(ss)",
+ IBUS_INTERFACE_INPUT_CONTEXT,
+ "PostProcessKeyEvent"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, /* cancellable */
+ &error);
+ if (error) {
+ g_warning ("Error PostProcessKeyEvent: %s", error->message);
+ g_error_free (error);
+ break;
+ }
+ g_variant_get (result, "(v)", &variant);
+ if (!variant) {
+ g_warning ("No child in PostProcessKeyEvent");
+ break;
+ }
+ g_value_set_variant (value, variant);
+ break;
case PROP_CONTENT_TYPE:
case PROP_CLIENT_COMMIT_PREEDIT:
- g_warning ("No support for setting content type");
+ case PROP_EFFECTIVE_POST_PROCESS_KEY_EVENT:
+ g_warning ("No support for getting content type");
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (portal_context, prop_id, pspec);
@@ -387,7 +433,7 @@ ibus_portal_context_class_init (IBusPortalContextClass *klass)
skeleton_class->g_authorize_method = ibus_portal_context_g_authorize_method;
ibus_dbus_input_context_override_properties (gobject_class,
- PROP_CONTENT_TYPE);
+ PROP_POST_PROCESS_KEY_EVENT);
}
static void
--
2.45.0
From 871c8312aa4bd6b785d7d9c779a1f9f51b709802 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 1 Jun 2024 21:27:38 +0900
Subject: [PATCH 5/6] Fix Flatpak build for dnf and pyoverridesdir
`dnf` is not available during Flatpak builds with `flatpak-builder` and
the steps are omitted in autogen.sh to check FLATPAK_ID environment
variable.
When IBus is built with the Json files in test directory, the build
tries to install IBus.py file into pyoverridesdir likes
/usr/lib*/python3.12/site-packages/gi/overrides
But the directory is readonly with `flatpak-builder` and could be
failed.
Now `--disable-pygobject` option is added to `configure`.
IBus modules are embedded in Flatpak platforms likes GNOME, Freedesktop
and this issue might not happen in the platform builds since
the pyoverridesdir does not exist yet so this might fix the build
issues with Json files only in test directory.
---
autogen.sh | 2 +-
configure.ac | 15 +++++++++++++--
4 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index 90e126ec..cde8aaef 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -42,7 +42,7 @@ cd "$srcdir"
touch ChangeLog
}
-(test "x$DISABLE_INSTALL_PKGS" = "x") && {
+(test "x$DISABLE_INSTALL_PKGS" = "x") && (test "x$FLATPAK_ID" = "x" ) && {
(test -f /etc/fedora-release ) && {
rpm -q $FEDORA_PKG1 || exit 1
rpm -q $FEDORA_PKG2 || exit 1
diff --git a/configure.ac b/configure.ac
index a5210004..fd1d15f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -509,9 +509,20 @@ AM_CONDITIONAL([ENABLE_DAEMON], [true])
PYGOBJECT_REQUIRED=3.0.0
-PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
- [enable_pygobject=yes], [enable_pygobject=no])
+# When IBus is built with the Json files in test directory, the build
+# tries to install IBus.py file into pyoverridesdir
+# but the directory is readonly with `flatpak-builder`
+AC_ARG_ENABLE(pygobject,
+ AS_HELP_STRING([--disable-pygobject],
+ [Disable pygobject.]),
+ [enable_pygobject=$enableval],
+ [enable_pygobject=yes]
+)
+if test "x$enable_pygobject" = "xyes"; then
+ PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
+ [enable_pygobject=yes], [enable_pygobject=no])
+fi
if test "x$enable_pygobject" = "xyes"; then
PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
--
2.45.0

View File

@ -61,7 +61,7 @@
Name: ibus
Version: 1.5.30
# https://github.com/fedora-infra/rpmautospec/issues/101
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.1-or-later
URL: https://github.com/ibus/%name/wiki
@ -519,6 +519,7 @@ dconf update || :
%{_sysconfdir}/dconf/profile/ibus
%dir %{_sysconfdir}/xdg/Xwayland-session.d
%{_sysconfdir}/xdg/Xwayland-session.d/10-ibus-x11
%dir %{_prefix}/lib/systemd/user/gnome-session.target.wants
%{_prefix}/lib/systemd/user/gnome-session.target.wants/*.service
%{_prefix}/lib/systemd/user/org.freedesktop.IBus.session.*.service
%python3_sitearch/gi/overrides/__pycache__/*.py*
@ -550,6 +551,7 @@ dconf update || :
%if %{with gtk4}
%files gtk4
%dir %{_libdir}/gtk-4.0/%{gtk4_binary_version}/immodules
%{_libdir}/gtk-4.0/%{gtk4_binary_version}/immodules/libim-ibus.so
%endif
@ -623,6 +625,11 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Sat Jun 01 2024 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.30-3
- Resolve #2284094 Fix preedit in Flatpak with new DBus unique name
- Add directory %%{_prefix}/lib/systemd/user/gnome-session.target.wants
- Add directory %%{_libdir}/gtk-4.0/%{gtk4_binary_version}/immodules
* Fri May 24 2024 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.30-2
- Resolve #2252227 Fix display buffer overflow
- Change IBus unique name to :1.0 from IBUS_SERVICE_IBUS