summaryrefslogtreecommitdiff
path: root/sys-apps/xdg-desktop-portal
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-05-06 11:33:44 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-05-06 11:33:44 +0100
commit0e52cbae2c719c3ef794ebeb0f4374fb96efcff3 (patch)
tree7e5732a7869c402a96586eca1ff1b574e59a328f /sys-apps/xdg-desktop-portal
parent0922e7f160098c343e6e41a5e167a69b9e035db6 (diff)
gentoo auto-resync : 06:05:2023 - 11:33:44
Diffstat (limited to 'sys-apps/xdg-desktop-portal')
-rw-r--r--sys-apps/xdg-desktop-portal/Manifest4
-rw-r--r--sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.16.0-delay-open-fix.patch300
-rw-r--r--sys-apps/xdg-desktop-portal/metadata.xml3
-rw-r--r--sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.16.0-r1.ebuild68
4 files changed, 374 insertions, 1 deletions
diff --git a/sys-apps/xdg-desktop-portal/Manifest b/sys-apps/xdg-desktop-portal/Manifest
index 237e975fa196..419ac555a4e4 100644
--- a/sys-apps/xdg-desktop-portal/Manifest
+++ b/sys-apps/xdg-desktop-portal/Manifest
@@ -1,3 +1,5 @@
+AUX xdg-desktop-portal-1.16.0-delay-open-fix.patch 14123 BLAKE2B 92ad185c8ef9155b3285614a230b83bbd97d741772a51e27ee026c606ca9893dd5bdb8cf3882334e0f6abb687e819df0c08cd3d0aa144a72b37ad6da778f41ef SHA512 5d36d0259bea8d40f112861044fd8f8da77aec5144b3518d5c8d77b3cc2c86a84473a34e3c20a873d72427ad5caf02a97a1282a880cfcea620eab9fac18d39fc
DIST xdg-desktop-portal-1.16.0.tar.xz 250524 BLAKE2B 9d5bd760621b114a19c1cc8895f91c43fcfed0dd067ba9678de0f11dc7835ec29c4a2c452274adbd36ee1318359caa8d7ca0c585558eb73a2a4e53528e6b02da SHA512 f7e7e96d3a6757901fbc4c0310aac0afbf37882c279a2859e06f63528049cd9b50dd2d55445d1386f03f62557c1a2ec81d4ee081200367d6269d2dffc75f0912
+EBUILD xdg-desktop-portal-1.16.0-r1.ebuild 1813 BLAKE2B 93045d29083ca641297a59969fd95dde16584f4abd30883d680a3e9717b846bf77197039b7d5bcb2c5786c3c312570306ca738dc9e2412b58463f3f2005244d9 SHA512 f159fd86f4a02132476414b963853fa523d23a340f606d15768b561e1e0e35412107d412a95737bc210c2164adc0920a7da02bdcee4825525f3b9fa3c1539db3
EBUILD xdg-desktop-portal-1.16.0.ebuild 1756 BLAKE2B e3a4ddda76a9400e68f4dbc6595266c05787f74afd07c9cc0b1ad9959a8b5f4be98ea8f9b85be21a6b0fbfb3186749adc462c48fd609a0652182f28331f2c097 SHA512 a97deb39f0f1d86fdeacabbece6131c5561f0a022c65ee2980122c748ee5cc59d9d9d9bc218a6c2deffc0b882435122995c89dc8293be8417cf9a36617fad010
-MISC metadata.xml 250 BLAKE2B f3e9395137ebb9adf46cd35c1b6156f82c04cfa94f964f6da24fe71eb560cf51b4f70ebfa10daaa4884400ec22782d819ab794dfd29e7a47559f07208397195d SHA512 78c4ff15eed76ba883b457be95dabd41e928a0e64a42b758b5eab4d8a95afca27d5ea6a7cfe0948de578b169153a05f08aadfce1ddd41a88732212a1e76e565f
+MISC metadata.xml 341 BLAKE2B 5d5ab4565c6859d6c23908ad19dd01566dcdba5c93d8fe4e232a477dd3689c60549d24f9952cf30aa32220a8b926a5262ceb9674b6b2622d914c192482917662 SHA512 7810a57f4f26d983976932f5efec72f1eb5282a0b22594ae45dec37ca77cb550f9f86c139832412fd1e14e50671231b9f91829753d099b8c90dc3100651649b8
diff --git a/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.16.0-delay-open-fix.patch b/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.16.0-delay-open-fix.patch
new file mode 100644
index 000000000000..1e1598744c46
--- /dev/null
+++ b/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.16.0-delay-open-fix.patch
@@ -0,0 +1,300 @@
+https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/74
+https://github.com/flatpak/xdg-desktop-portal/pull/985
+https://github.com/flatpak/xdg-desktop-portal/commit/2a219279997c2124c8a639b0d009c9946ec97b40
+
+Fedora's backported it as well at https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/74.
+
+From 2a219279997c2124c8a639b0d009c9946ec97b40 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
+Date: Mon, 13 Mar 2023 12:38:17 +0100
+Subject: [PATCH] portal-impl: Only return found implementation if it launched
+
+If no portal backend for a given interface is found, a fallback is
+always tried anyway, despite that fallback not being listed as
+compatible with the current desktop environment.
+
+Sometimes it's good that a fallback is returned; e.g. the
+xdg-desktop-portal-gtk file chooser backend is technically usable
+anywhere, however, some backends might be specifically designed to only
+work in a specific desktop environment, e.g. xdg-desktop-portal-gnome.
+
+In order to avoid creating portals with non-functional backends, make
+sure it's possible to create a proxy object for the interface and D-Bus
+name, and that it launched successfully (i.e. has no name owner after
+creating the proxy).
+--- a/src/portal-impl.c
++++ b/src/portal-impl.c
+@@ -29,9 +29,12 @@
+ #include <glib.h>
+ #include <gio/gio.h>
+
++#include "xdp-utils.h"
++
+ static void
+ portal_implementation_free (PortalImplementation *impl)
+ {
++ g_clear_pointer (&impl->dummy_proxies, g_hash_table_unref);
+ g_free (impl->source);
+ g_free (impl->dbus_name);
+ g_strfreev (impl->interfaces);
+@@ -55,6 +58,10 @@ register_portal (const char *path, gboolean opt_verbose, GError **error)
+ if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, error))
+ return FALSE;
+
++ impl->dummy_proxies = g_hash_table_new_full (g_str_hash,
++ g_str_equal,
++ g_free,
++ g_object_unref);
+ impl->source = g_path_get_basename (path);
+ impl->dbus_name = g_key_file_get_string (keyfile, "portal", "DBusName", error);
+ if (impl->dbus_name == NULL)
+@@ -198,8 +205,44 @@ load_installed_portals (gboolean opt_verbose)
+ implementations = g_list_sort (implementations, sort_impl_by_use_in_and_name);
+ }
+
++static gboolean
++create_dummy_proxy (PortalImplementation *impl,
++ GDBusConnection *connection,
++ const char *interface,
++ GError **error)
++{
++ g_autoptr(GDBusProxy) proxy = NULL;
++
++ g_debug ("Creating dummy proxy for %s on %s", interface, impl->dbus_name);
++ proxy = g_dbus_proxy_new_sync (connection,
++ G_DBUS_PROXY_FLAGS_NONE,
++ NULL,
++ impl->dbus_name,
++ DESKTOP_PORTAL_OBJECT_PATH,
++ interface,
++ NULL,
++ error);
++ if (!proxy)
++ return FALSE;
++
++ if (!g_dbus_proxy_get_name_owner (proxy))
++ {
++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
++ "Proxy has no owner");
++ return FALSE;
++ }
++
++ g_debug ("Dummy proxy created");
++
++ g_hash_table_insert (impl->dummy_proxies,
++ g_strdup (interface),
++ g_steal_pointer (&proxy));
++ return TRUE;
++}
++
+ PortalImplementation *
+-find_portal_implementation (const char *interface)
++find_portal_implementation (GDBusConnection *connection,
++ const char *interface)
+ {
+ const char *desktops_str = g_getenv ("XDG_CURRENT_DESKTOP");
+ g_auto(GStrv) desktops = NULL;
+@@ -216,15 +259,23 @@ find_portal_implementation (const char *interface)
+ for (l = implementations; l != NULL; l = l->next)
+ {
+ PortalImplementation *impl = l->data;
++ g_autoptr(GError) error = NULL;
+
+ if (!g_strv_contains ((const char **)impl->interfaces, interface))
+ continue;
+
+- if (g_strv_case_contains ((const char **)impl->use_in, desktops[i]))
++ if (!g_strv_case_contains ((const char **)impl->use_in, desktops[i]))
++ continue;
++
++ if (!create_dummy_proxy (impl, connection, interface, &error))
+ {
+- g_debug ("Using %s for %s in %s", impl->source, interface, desktops[i]);
+- return impl;
++ g_debug ("Failed to create dummy proxy on %s for %s: %s",
++ impl->dbus_name, interface, error->message);
++ continue;
+ }
++
++ g_debug ("Using %s for %s in %s", impl->source, interface, desktops[i]);
++ return impl;
+ }
+ }
+
+@@ -232,10 +283,18 @@ find_portal_implementation (const char *interface)
+ for (l = implementations; l != NULL; l = l->next)
+ {
+ PortalImplementation *impl = l->data;
++ g_autoptr(GError) error = NULL;
+
+ if (!g_strv_contains ((const char **)impl->interfaces, interface))
+ continue;
+
++ if (!create_dummy_proxy (impl, connection, interface, &error))
++ {
++ g_debug ("Failed to create dummy fallback proxy on %s for %s: %s",
++ impl->dbus_name, interface, error->message);
++ continue;
++ }
++
+ g_debug ("Falling back to %s for %s", impl->source, interface);
+ return impl;
+ }
+--- a/src/portal-impl.h
++++ b/src/portal-impl.h
+@@ -23,6 +23,7 @@
+ #define __PORTAL_IMPL_H__
+
+ #include <glib.h>
++#include <gio/gio.h>
+
+ typedef struct {
+ char *source;
+@@ -30,10 +31,12 @@ typedef struct {
+ char **interfaces;
+ char **use_in;
+ int priority;
++ GHashTable *dummy_proxies;
+ } PortalImplementation;
+
+ void load_installed_portals (gboolean opt_verbose);
+-PortalImplementation *find_portal_implementation (const char *interface);
++PortalImplementation *find_portal_implementation (GDBusConnection *connection,
++ const char *interface);
+ GPtrArray *find_all_portal_implementations (const char *interface);
+
+ #endif /* __PORTAL_IMPL_H__ */
+--- a/src/xdg-desktop-portal.c
++++ b/src/xdg-desktop-portal.c
+@@ -237,7 +237,8 @@ on_bus_acquired (GDBusConnection *connection,
+ init_document_proxy (connection);
+ init_permission_store (connection);
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Lockdown");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Lockdown");
+ if (implementation != NULL)
+ lockdown = xdp_dbus_impl_lockdown_proxy_new_sync (connection,
+ G_DBUS_PROXY_FLAGS_NONE,
+@@ -259,40 +260,48 @@ on_bus_acquired (GDBusConnection *connection,
+ export_portal_implementation (connection, settings_create (connection, impls));
+ g_ptr_array_free (impls, TRUE);
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.FileChooser");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.FileChooser");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ file_chooser_create (connection, implementation->dbus_name, lockdown));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.AppChooser");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.AppChooser");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ open_uri_create (connection, implementation->dbus_name, lockdown));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Print");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Print");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ print_create (connection, implementation->dbus_name, lockdown));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Notification");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Notification");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ notification_create (connection, implementation->dbus_name));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Inhibit");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Inhibit");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ inhibit_create (connection, implementation->dbus_name));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Access");
+- implementation2 = find_portal_implementation ("org.freedesktop.impl.portal.Screenshot");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Access");
++ implementation2 = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Screenshot");
+ if (implementation != NULL && implementation2 != NULL)
+ export_portal_implementation (connection,
+ screenshot_create (connection,
+ implementation->dbus_name,
+ implementation2->dbus_name));
+
+- implementation2 = find_portal_implementation ("org.freedesktop.impl.portal.Background");
++ implementation2 = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Background");
+ if (implementation != NULL)
+ {
+ export_portal_implementation (connection,
+@@ -313,47 +322,55 @@ on_bus_acquired (GDBusConnection *connection,
+ implementation->dbus_name,
+ implementation2->dbus_name));
+
+- implementation2 = find_portal_implementation ("org.freedesktop.impl.portal.Wallpaper");
++ implementation2 = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Wallpaper");
+ if (implementation != NULL && implementation2 != NULL)
+ export_portal_implementation (connection,
+ wallpaper_create (connection,
+ implementation->dbus_name,
+ implementation2->dbus_name));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Account");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Account");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ account_create (connection, implementation->dbus_name));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Email");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Email");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ email_create (connection, implementation->dbus_name));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.Secret");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.Secret");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ secret_create (connection, implementation->dbus_name));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.GlobalShortcuts");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.GlobalShortcuts");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ global_shortcuts_create (connection, implementation->dbus_name));
+
+ #ifdef HAVE_GLIB_2_66
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.DynamicLauncher");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.DynamicLauncher");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ dynamic_launcher_create (connection, implementation->dbus_name));
+ #endif
+
+ #ifdef HAVE_PIPEWIRE
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.ScreenCast");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.ScreenCast");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ screen_cast_create (connection, implementation->dbus_name));
+
+- implementation = find_portal_implementation ("org.freedesktop.impl.portal.RemoteDesktop");
++ implementation = find_portal_implementation (connection,
++ "org.freedesktop.impl.portal.RemoteDesktop");
+ if (implementation != NULL)
+ export_portal_implementation (connection,
+ remote_desktop_create (connection, implementation->dbus_name));
+
diff --git a/sys-apps/xdg-desktop-portal/metadata.xml b/sys-apps/xdg-desktop-portal/metadata.xml
index 8641e5bdd399..004564dfa989 100644
--- a/sys-apps/xdg-desktop-portal/metadata.xml
+++ b/sys-apps/xdg-desktop-portal/metadata.xml
@@ -5,4 +5,7 @@
<email>kde@gentoo.org</email>
<name>Gentoo KDE Project</name>
</maintainer>
+ <upstream>
+ <remote-id type="github">flatpak/xdg-desktop-portal</remote-id>
+ </upstream>
</pkgmetadata>
diff --git a/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.16.0-r1.ebuild b/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.16.0-r1.ebuild
new file mode 100644
index 000000000000..3a9bda386772
--- /dev/null
+++ b/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.16.0-r1.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools systemd
+
+DESCRIPTION="Desktop integration portal"
+HOMEPAGE="https://flatpak.org/ https://github.com/flatpak/xdg-desktop-portal"
+SRC_URI="https://github.com/flatpak/${PN}/releases/download/${PV}/${P}.tar.xz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+IUSE="geolocation screencast systemd"
+
+DEPEND="
+ >=dev-libs/glib-2.66:2
+ dev-libs/json-glib
+ >=sys-fs/fuse-3.10.0:3[suid]
+ x11-libs/gdk-pixbuf
+ geolocation? ( >=app-misc/geoclue-2.5.3:2.0 )
+ screencast? ( >=media-video/pipewire-0.3:= )
+ systemd? ( sys-apps/systemd )
+"
+RDEPEND="${DEPEND}
+ sys-apps/dbus
+"
+BDEPEND="
+ dev-util/gdbus-codegen
+ sys-devel/gettext
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-delay-open-fix.patch
+)
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_configure() {
+ local myeconfargs=(
+ --disable-docbook-docs # requires flatpak
+ --disable-libportal # not packaged
+ --with-systemduserunitdir="$(systemd_get_userunitdir)"
+ $(use_enable geolocation geoclue)
+ $(use_enable screencast pipewire)
+ $(use_with systemd)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+pkg_postinst() {
+ if ! has_version gui-libs/xdg-desktop-portal-lxqt && ! has_version gui-libs/xdg-desktop-portal-wlr && \
+ ! has_version kde-plasma/xdg-desktop-portal-kde && ! has_version sys-apps/xdg-desktop-portal-gnome && \
+ ! has_version sys-apps/xdg-desktop-portal-gtk; then
+ elog "${PN} is not usable without any of the following XDP"
+ elog "implementations installed:"
+ elog " gui-libs/xdg-desktop-portal-lxqt"
+ elog " gui-libs/xdg-desktop-portal-wlr"
+ elog " kde-plasma/xdg-desktop-portal-kde"
+ elog " sys-apps/xdg-desktop-portal-gnome"
+ elog " sys-apps/xdg-desktop-portal-gtk"
+ fi
+}