Accepting request 1036951 from M17N
OBS-URL: https://build.opensuse.org/request/show/1036951 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ibus?expand=0&rev=119
This commit is contained in:
commit
939d653c2f
4
20-defaults-openSUSE.conf
Normal file
4
20-defaults-openSUSE.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[Service]
|
||||||
|
# For now, Plasma Wayland does not support /etc/xdg/Xwayland-session.d
|
||||||
|
# so always enable --xim
|
||||||
|
Environment="IBUS_DAEMON_ARGS=--xim"
|
@ -11,5 +11,5 @@ esac
|
|||||||
# sleep for a little while to avoid duplicate startup
|
# sleep for a little while to avoid duplicate startup
|
||||||
# sleep 2
|
# sleep 2
|
||||||
|
|
||||||
ibus-daemon --xim -d
|
ibus start --service-file org.freedesktop.IBus.session.generic.service
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -10,4 +10,3 @@ StartupNotify=false
|
|||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-KDE-autostart-after=panel
|
X-KDE-autostart-after=panel
|
||||||
X-KDE-StartupNotify=false
|
X-KDE-StartupNotify=false
|
||||||
X-systemd-skip=true
|
|
||||||
|
158
ibus-ui-gtk3-restart-via-systemd.patch
Normal file
158
ibus-ui-gtk3-restart-via-systemd.patch
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
|
||||||
|
index 452b14c8..81c246a2 100644
|
||||||
|
--- a/ui/gtk3/panel.vala
|
||||||
|
+++ b/ui/gtk3/panel.vala
|
||||||
|
@@ -1292,7 +1292,7 @@ class Panel : IBus.PanelService {
|
||||||
|
m_sys_menu.append(new Gtk.SeparatorMenuItem());
|
||||||
|
|
||||||
|
item = new Gtk.MenuItem.with_label(_("Restart"));
|
||||||
|
- item.activate.connect((i) => m_bus.exit(true));
|
||||||
|
+ item.activate.connect((i) => restart_daemon());
|
||||||
|
m_sys_menu.append(item);
|
||||||
|
|
||||||
|
item = new Gtk.MenuItem.with_label(_("Quit"));
|
||||||
|
@@ -1305,6 +1305,144 @@ class Panel : IBus.PanelService {
|
||||||
|
return m_sys_menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private const string systemd_service_file = "org.freedesktop.IBus.session.generic.service";
|
||||||
|
+
|
||||||
|
+ GLib.DBusConnection? get_session_bus() {
|
||||||
|
+ try {
|
||||||
|
+ return GLib.Bus.get_sync (GLib.BusType.SESSION, null);
|
||||||
|
+ } catch (GLib.IOError e) {
|
||||||
|
+ debug("%s\n", e.message);
|
||||||
|
+ }
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ string?
|
||||||
|
+ get_ibus_systemd_object_path(GLib.DBusConnection connection) {
|
||||||
|
+ string object_path = null;
|
||||||
|
+ assert(systemd_service_file != null);
|
||||||
|
+ try {
|
||||||
|
+ var variant = connection.call_sync (
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ "/org/freedesktop/systemd1",
|
||||||
|
+ "org.freedesktop.systemd1.Manager",
|
||||||
|
+ "GetUnit",
|
||||||
|
+ new GLib.Variant("(s)", systemd_service_file),
|
||||||
|
+ new GLib.VariantType("(o)"),
|
||||||
|
+ GLib.DBusCallFlags.NONE,
|
||||||
|
+ -1,
|
||||||
|
+ null);
|
||||||
|
+ variant.get("(o)", ref object_path);
|
||||||
|
+ debug("Succeed to get an object path \"%s\" for IBus " +
|
||||||
|
+ "systemd service file \"%s\".\n",
|
||||||
|
+ object_path, systemd_service_file);
|
||||||
|
+ return object_path;
|
||||||
|
+ } catch (GLib.Error e) {
|
||||||
|
+ debug("IBus systemd service file \"%s\" is not installed " +
|
||||||
|
+ "in your system: %s\n",
|
||||||
|
+ systemd_service_file, e.message);
|
||||||
|
+ }
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ bool
|
||||||
|
+ is_running_daemon_via_systemd(GLib.DBusConnection connection,
|
||||||
|
+ string object_path) {
|
||||||
|
+ string? state = null;
|
||||||
|
+ try {
|
||||||
|
+ while (true) {
|
||||||
|
+ var variant = connection.call_sync (
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ object_path,
|
||||||
|
+ "org.freedesktop.DBus.Properties",
|
||||||
|
+ "Get",
|
||||||
|
+ new GLib.Variant("(ss)",
|
||||||
|
+ "org.freedesktop.systemd1.Unit",
|
||||||
|
+ "ActiveState"),
|
||||||
|
+ new GLib.VariantType("(v)"),
|
||||||
|
+ GLib.DBusCallFlags.NONE,
|
||||||
|
+ -1,
|
||||||
|
+ null);
|
||||||
|
+ GLib.Variant child = null;
|
||||||
|
+ variant.get("(v)", ref child);
|
||||||
|
+ state = child.dup_string();
|
||||||
|
+ debug("systemd state is \"%s\" for an object " +
|
||||||
|
+ "path \"%s\".\n", state, object_path);
|
||||||
|
+ if (state != "activating")
|
||||||
|
+ break;
|
||||||
|
+ Posix.sleep(1);
|
||||||
|
+ }
|
||||||
|
+ } catch (GLib.Error e) {
|
||||||
|
+ debug("%s\n", e.message);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ if (state == "active")
|
||||||
|
+ return true;
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ bool
|
||||||
|
+ start_daemon_via_systemd(GLib.DBusConnection connection,
|
||||||
|
+ bool restart) {
|
||||||
|
+ string object_path = null;
|
||||||
|
+ string method = "StartUnit";
|
||||||
|
+ assert(systemd_service_file != null);
|
||||||
|
+ if (restart)
|
||||||
|
+ method = "RestartUnit";
|
||||||
|
+ try {
|
||||||
|
+ var variant = connection.call_sync (
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ "/org/freedesktop/systemd1",
|
||||||
|
+ "org.freedesktop.systemd1.Manager",
|
||||||
|
+ method,
|
||||||
|
+ new GLib.Variant("(ss)", systemd_service_file, "fail"),
|
||||||
|
+ new GLib.VariantType("(o)"),
|
||||||
|
+ GLib.DBusCallFlags.NONE,
|
||||||
|
+ -1,
|
||||||
|
+ null);
|
||||||
|
+ variant.get("(o)", ref object_path);
|
||||||
|
+ debug("Succeed to restart IBus daemon via IBus systemd " +
|
||||||
|
+ "service file \"%s\": \"%s\"\n",
|
||||||
|
+ systemd_service_file, object_path);
|
||||||
|
+ return true;
|
||||||
|
+ } catch (GLib.Error e) {
|
||||||
|
+ debug("Failed to %s IBus daemon via IBus systemd " +
|
||||||
|
+ "service file \"%s\": %s\n",
|
||||||
|
+ restart ? "restart" : "start",
|
||||||
|
+ systemd_service_file, e.message);
|
||||||
|
+ }
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private void restart_daemon() {
|
||||||
|
+ do {
|
||||||
|
+ GLib.DBusConnection? connection = get_session_bus();
|
||||||
|
+ if (connection == null)
|
||||||
|
+ break;
|
||||||
|
+ var object_path = get_ibus_systemd_object_path(connection);
|
||||||
|
+ if (object_path == null)
|
||||||
|
+ break;
|
||||||
|
+ if (is_running_daemon_via_systemd(connection,
|
||||||
|
+ object_path)) {
|
||||||
|
+ var result = start_daemon_via_systemd(connection, true);
|
||||||
|
+ if (!result) {
|
||||||
|
+ var dialog = new Gtk.MessageDialog(
|
||||||
|
+ null,
|
||||||
|
+ Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||||
|
+ Gtk.MessageType.ERROR,
|
||||||
|
+ Gtk.ButtonsType.CLOSE,
|
||||||
|
+ "Failed to restart IBus daemon via IBus systemd");
|
||||||
|
+ dialog.response.connect((id) => {
|
||||||
|
+ dialog.destroy();
|
||||||
|
+ });
|
||||||
|
+ dialog.show_all();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return;
|
||||||
|
+ } while (false);
|
||||||
|
+ // ibus-daemon is not launched via systemd
|
||||||
|
+ m_bus.exit(true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private Gtk.Menu create_activate_menu() {
|
||||||
|
m_ime_menu = new Gtk.Menu();
|
||||||
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Nov 18 13:48:57 UTC 2022 - Fuminobu Takeyama <ftake@geeko.jp>
|
||||||
|
|
||||||
|
- Switch to use systemd service file to start ibus daemon
|
||||||
|
* Fix boo#1201421
|
||||||
|
* Add ibus-ui-gtk3-restart-via-systemd.patch
|
||||||
|
* Enable ibus-autostart for xdg-autostart-generator
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Aug 29 15:18:08 UTC 2022 - Fuminobu Takeyama <ftake@geeko.jp>
|
Mon Aug 29 15:18:08 UTC 2022 - Fuminobu Takeyama <ftake@geeko.jp>
|
||||||
|
|
||||||
|
10
ibus.spec
10
ibus.spec
@ -48,6 +48,7 @@ Source4: xim.d-ibus-121
|
|||||||
Source7: macros.ibus
|
Source7: macros.ibus
|
||||||
Source10: ibus-autostart
|
Source10: ibus-autostart
|
||||||
Source11: ibus-autostart.desktop
|
Source11: ibus-autostart.desktop
|
||||||
|
Source12: 20-defaults-openSUSE.conf
|
||||||
Source99: baselibs.conf
|
Source99: baselibs.conf
|
||||||
# PATFH-FIX-OPENSUSE ibus-xim-fix-re-focus-after-lock.patch bnc#874869 tiwai@suse.de
|
# PATFH-FIX-OPENSUSE ibus-xim-fix-re-focus-after-lock.patch bnc#874869 tiwai@suse.de
|
||||||
# Fix lost XIM input after screenlock
|
# Fix lost XIM input after screenlock
|
||||||
@ -72,6 +73,9 @@ Patch12: ibus-disable-engines-preload-in-GNOME.patch
|
|||||||
# Qt5 does not be update to the new version and patch for ibus on Leap 15,
|
# Qt5 does not be update to the new version and patch for ibus on Leap 15,
|
||||||
# it still needs this patch on leap 15. (boo#1187202)
|
# it still needs this patch on leap 15. (boo#1187202)
|
||||||
Patch15: ibus-socket-name-compatibility.patch
|
Patch15: ibus-socket-name-compatibility.patch
|
||||||
|
# PATCH-FIX-UPSTREAM ibus-ui-gtk3-restart-via-systemd.patch
|
||||||
|
# Allow ibus-ui-gtk3 to restart ibus-daemon when it is launched by systemd
|
||||||
|
Patch16: ibus-ui-gtk3-restart-via-systemd.patch
|
||||||
BuildRequires: pkgconfig(iso-codes)
|
BuildRequires: pkgconfig(iso-codes)
|
||||||
BuildRequires: pkgconfig(libnotify)
|
BuildRequires: pkgconfig(libnotify)
|
||||||
BuildRequires: pkgconfig(systemd)
|
BuildRequires: pkgconfig(systemd)
|
||||||
@ -229,6 +233,7 @@ cp -r %{SOURCE11} .
|
|||||||
%if 0%{?suse_version} <= 1500
|
%if 0%{?suse_version} <= 1500
|
||||||
%patch15 -p1
|
%patch15 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%patch16 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-static \
|
%configure --disable-static \
|
||||||
@ -279,6 +284,10 @@ install -c -m 0755 ibus-autostart %{buildroot}%{_bindir}/ibus-autostart
|
|||||||
mkdir -p %{buildroot}%{_sysconfdir}/xdg/autostart
|
mkdir -p %{buildroot}%{_sysconfdir}/xdg/autostart
|
||||||
install -c -m 0644 ibus-autostart.desktop %{buildroot}%{_sysconfdir}/xdg/autostart/ibus-autostart.desktop
|
install -c -m 0644 ibus-autostart.desktop %{buildroot}%{_sysconfdir}/xdg/autostart/ibus-autostart.desktop
|
||||||
|
|
||||||
|
# systemd conf
|
||||||
|
mkdir -p %{buildroot}%{_userunitdir}/org.freedesktop.IBus.session.generic.service.d
|
||||||
|
install -c -m 0644 %{SOURCE12} %{buildroot}%{_userunitdir}/org.freedesktop.IBus.session.generic.service.d
|
||||||
|
|
||||||
PRIORITY=40
|
PRIORITY=40
|
||||||
pushd %{buildroot}%{_distconfdir}/X11/xim.d/
|
pushd %{buildroot}%{_distconfdir}/X11/xim.d/
|
||||||
for lang in am ar as bn el fa gu he hi hr ja ka kk kn ko lo ml my \
|
for lang in am ar as bn el fa gu he hi hr ja ka kk kn ko lo ml my \
|
||||||
@ -418,6 +427,7 @@ fi
|
|||||||
%dir %{_userunitdir}/gnome-session.target.wants
|
%dir %{_userunitdir}/gnome-session.target.wants
|
||||||
%{_userunitdir}/gnome-session.target.wants/org.freedesktop.IBus.session.GNOME.service
|
%{_userunitdir}/gnome-session.target.wants/org.freedesktop.IBus.session.GNOME.service
|
||||||
%{_userunitdir}/*.service
|
%{_userunitdir}/*.service
|
||||||
|
%{_userunitdir}/org.freedesktop.IBus.session.generic.service.d
|
||||||
|
|
||||||
%if %{with_emoji}
|
%if %{with_emoji}
|
||||||
%{_datadir}/applications/org.freedesktop.IBus.Panel.Emojier.desktop
|
%{_datadir}/applications/org.freedesktop.IBus.Panel.Emojier.desktop
|
||||||
|
Loading…
Reference in New Issue
Block a user