From d1dee958a08656252ea46db4ae62c55dffced4e3 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 10 Apr 2023 08:56:48 -0700 Subject: [PATCH] Backport MR #78 to help with apps launching slow on KDE (#2176759) --- 78.patch | 56 +++++++++++++++++++++++++++++++++++ xdg-desktop-portal-gnome.spec | 4 +++ 2 files changed, 60 insertions(+) create mode 100644 78.patch diff --git a/78.patch b/78.patch new file mode 100644 index 0000000..dadd5ad --- /dev/null +++ b/78.patch @@ -0,0 +1,56 @@ +From deb46a4d5ce170e33a9a999def5457375eef122f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Thu, 9 Mar 2023 18:22:30 +0100 +Subject: [PATCH] systemd: Launch after gnome-session-initialized.target + +This means we can rely on various entities being there on the D-Bus thus +won't need to manually wait for them. +--- + data/xdg-desktop-portal-gnome.service.in | 1 + + src/externalwindow-wayland.c | 12 ------------ + 2 files changed, 1 insertion(+), 12 deletions(-) + +diff --git a/data/xdg-desktop-portal-gnome.service.in b/data/xdg-desktop-portal-gnome.service.in +index 62ff2f9..8fc2e1a 100644 +--- a/data/xdg-desktop-portal-gnome.service.in ++++ b/data/xdg-desktop-portal-gnome.service.in +@@ -1,5 +1,6 @@ + [Unit] + Description=Portal service (GNOME implementation) ++After=gnome-session-initialized.target + + [Service] + Type=dbus +diff --git a/src/externalwindow-wayland.c b/src/externalwindow-wayland.c +index b09d8a0..88be4c8 100644 +--- a/src/externalwindow-wayland.c ++++ b/src/externalwindow-wayland.c +@@ -263,7 +263,6 @@ on_service_channel_name_appeared (GDBusConnection *connection, + GdkDisplay * + init_external_window_wayland_display (GError **error) + { +- guint watch_name_id; + gboolean name_appeared = FALSE; + g_autoptr(OrgGnomeMutterServiceChannel) proxy = NULL; + g_autoptr(GVariant) fd_variant = NULL; +@@ -272,17 +271,6 @@ init_external_window_wayland_display (GError **error) + g_autofree char *fd_str = NULL; + GdkDisplay *display; + +- watch_name_id = +- g_bus_watch_name (G_BUS_TYPE_SESSION, +- "org.gnome.Mutter.ServiceChannel", +- G_BUS_NAME_WATCHER_FLAGS_NONE, +- on_service_channel_name_appeared, +- NULL, +- &name_appeared, NULL); +- while (!name_appeared) +- g_main_context_iteration (NULL, TRUE); +- g_bus_unwatch_name (watch_name_id); +- + proxy = org_gnome_mutter_service_channel_proxy_new_for_bus_sync ( + G_BUS_TYPE_SESSION, + (G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | +-- +GitLab + diff --git a/xdg-desktop-portal-gnome.spec b/xdg-desktop-portal-gnome.spec index 775e901..a3933f2 100644 --- a/xdg-desktop-portal-gnome.spec +++ b/xdg-desktop-portal-gnome.spec @@ -10,6 +10,10 @@ Summary: Backend implementation for xdg-desktop-portal using GNOME License: LGPL-2.1-or-later URL: https://gitlab.gnome.org/GNOME/%{name} Source0: https://download.gnome.org/sources/%{name}/44/%{name}-%{tarball_version}.tar.xz +# https://bugzilla.redhat.com/show_bug.cgi?id=2176759 +# https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/78 +# Help fix apps hanging on start in KDE with GNOME portal installed +Patch0: 78.patch BuildRequires: desktop-file-utils BuildRequires: gcc