From 9dc4d5ce283a8dadc91493f60171530671850c71 Mon Sep 17 00:00:00 2001 From: mx1up <178714+mx1up@users.noreply.github.com> Date: Sat, 5 Sep 2026 22:14:15 +0200 Subject: [PATCH 1/3] [desktop_drop] Linux: prefer text/uri-list over the portal transfer target GTK matches the first destination target the drag source also offers, and 0.8.1 registered `application/vnd.portal.filetransfer` ahead of the URI targets. KDE (Dolphin) and Deepin (dde-fileManager) advertise that portal target on ordinary X11 drags too, not just from sandboxed sources. When it is chosen, `org.freedesktop.portal.FileTransfer.RetrieveFiles` rejects the key with `org.freedesktop.DBus.Error.AccessDenied: Invalid transfer`, `_resolvePortalFiles` returns an empty list, and the drop is silently lost. Register the URI targets first and demote the portal key and the bare STRING target to fallbacks, so the portal path is taken only when the source offers nothing better (a genuine sandboxed peer). No Dart change needed: `on_drag_data_received` already routes `text/uri-list` through `performOperation_linux`. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01EqCpJWAkdfQzBF85aZe8EZ --- packages/desktop_drop/CHANGELOG.md | 4 +++ .../desktop_drop/linux/desktop_drop_plugin.cc | 29 ++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/packages/desktop_drop/CHANGELOG.md b/packages/desktop_drop/CHANGELOG.md index 1cdd8e94..78429267 100644 --- a/packages/desktop_drop/CHANGELOG.md +++ b/packages/desktop_drop/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +* [desktop_drop] [Linux] prefer the `text/uri-list` drag target over `application/vnd.portal.filetransfer`. File managers such as Dolphin and dde-fileManager advertise the portal target on plain X11 drags too, where `org.freedesktop.portal.FileTransfer.RetrieveFiles` rejects the key with `AccessDenied: Invalid transfer` and the drop is silently lost. The portal target is now a fallback, used only when the source offers nothing else. + ## 0.8.4 * fix: use builtInKotlin property to conditionally apply KGP [#500](https://github.com/MixinNetwork/flutter-plugins/pull/500) diff --git a/packages/desktop_drop/linux/desktop_drop_plugin.cc b/packages/desktop_drop/linux/desktop_drop_plugin.cc index d706bd6a..582bff66 100644 --- a/packages/desktop_drop/linux/desktop_drop_plugin.cc +++ b/packages/desktop_drop/linux/desktop_drop_plugin.cc @@ -112,14 +112,29 @@ void desktop_drop_plugin_register_with_registrar(FlPluginRegistrar *registrar) { g_object_new(desktop_drop_plugin_get_type(), nullptr)); auto *fl_view = fl_plugin_registrar_get_view(registrar); - // Register portal file transfer target FIRST (highest priority) - // then STRING, then URI targets - static GtkTargetEntry entries[] = { - {strdup("application/vnd.portal.filetransfer"), GTK_TARGET_OTHER_APP, 0}, - {strdup("STRING"), GTK_TARGET_OTHER_APP, 0} - }; - gtk_drag_dest_set(GTK_WIDGET(fl_view), GTK_DEST_DEFAULT_ALL, entries, 2, GDK_ACTION_COPY); + // Match `text/uri-list` before `application/vnd.portal.filetransfer`. + // + // GTK picks the first destination target the drag source also offers, so + // whichever target is registered first wins. The portal transfer key is + // only resolvable when the source is sandboxed and has actually registered + // a FileTransfer with the document portal. File managers such as Dolphin + // and dde-fileManager advertise `application/vnd.portal.filetransfer` on + // plain X11 drags as well, where `RetrieveFiles` then rejects the key with + // `org.freedesktop.DBus.Error.AccessDenied: Invalid transfer` and the drop + // is silently lost. Register the URI targets first and keep the portal key + // (and a bare STRING) as fallbacks for sources that offer nothing better. + gtk_drag_dest_set(GTK_WIDGET(fl_view), GTK_DEST_DEFAULT_ALL, nullptr, 0, + GDK_ACTION_COPY); gtk_drag_dest_add_uri_targets(GTK_WIDGET(fl_view)); + GtkTargetList *target_list = gtk_drag_dest_get_target_list(GTK_WIDGET(fl_view)); + if (target_list != nullptr) { + gtk_target_list_add( + target_list, + gdk_atom_intern_static_string("application/vnd.portal.filetransfer"), + GTK_TARGET_OTHER_APP, 0); + gtk_target_list_add(target_list, gdk_atom_intern_static_string("STRING"), + GTK_TARGET_OTHER_APP, 0); + } g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); FlMethodChannel *channel = From 87496155a2f1c7d695fa92a3d4e1da5c7392d6b0 Mon Sep 17 00:00:00 2001 From: mx1up <178714+mx1up@users.noreply.github.com> Date: Sat, 5 Sep 2026 22:27:10 +0200 Subject: [PATCH 2/3] [desktop_drop] changelog: link the PR Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01EqCpJWAkdfQzBF85aZe8EZ --- packages/desktop_drop/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/desktop_drop/CHANGELOG.md b/packages/desktop_drop/CHANGELOG.md index 78429267..e770f96a 100644 --- a/packages/desktop_drop/CHANGELOG.md +++ b/packages/desktop_drop/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -* [desktop_drop] [Linux] prefer the `text/uri-list` drag target over `application/vnd.portal.filetransfer`. File managers such as Dolphin and dde-fileManager advertise the portal target on plain X11 drags too, where `org.freedesktop.portal.FileTransfer.RetrieveFiles` rejects the key with `AccessDenied: Invalid transfer` and the drop is silently lost. The portal target is now a fallback, used only when the source offers nothing else. +* [desktop_drop] [Linux] prefer the `text/uri-list` drag target over `application/vnd.portal.filetransfer`. File managers such as Dolphin and dde-fileManager advertise the portal target on plain X11 drags too, where `org.freedesktop.portal.FileTransfer.RetrieveFiles` rejects the key with `AccessDenied: Invalid transfer` and the drop is silently lost. The portal target is now a fallback, used only when the source offers nothing else. [#501](https://github.com/MixinNetwork/flutter-plugins/pull/501) ## 0.8.4 From 63da272843d75a3c7f4f43f5a42360ca4b3fdf02 Mon Sep 17 00:00:00 2001 From: mx1up <178714+mx1up@users.noreply.github.com> Date: Mon, 7 Sep 2026 10:19:50 +0200 Subject: [PATCH 3/3] honor release policy (reserved for maintainer) Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- packages/desktop_drop/CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/desktop_drop/CHANGELOG.md b/packages/desktop_drop/CHANGELOG.md index e770f96a..1cdd8e94 100644 --- a/packages/desktop_drop/CHANGELOG.md +++ b/packages/desktop_drop/CHANGELOG.md @@ -1,9 +1,5 @@ # Changelog -## Unreleased - -* [desktop_drop] [Linux] prefer the `text/uri-list` drag target over `application/vnd.portal.filetransfer`. File managers such as Dolphin and dde-fileManager advertise the portal target on plain X11 drags too, where `org.freedesktop.portal.FileTransfer.RetrieveFiles` rejects the key with `AccessDenied: Invalid transfer` and the drop is silently lost. The portal target is now a fallback, used only when the source offers nothing else. [#501](https://github.com/MixinNetwork/flutter-plugins/pull/501) - ## 0.8.4 * fix: use builtInKotlin property to conditionally apply KGP [#500](https://github.com/MixinNetwork/flutter-plugins/pull/500)