From: Oliver Kurth Date: Wed, 8 May 2019 22:27:19 +0000 (-0700) Subject: Fix copy/paste on Ubuntu 19.04 guest X-Git-Tag: stable-11.0.0~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=000856aea0bd78c581888c3e3771cf79c6fdb7e9;p=thirdparty%2Fopen-vm-tools.git Fix copy/paste on Ubuntu 19.04 guest Ubuntu 19.04 chooses Nautilus 3.32 as the default file browser. From 3.30, Nautilus checks mime type when pasting files from the clipboard, and the target type is also changed to UTF8_STRING instead of x-special/gnome-copied-files. To support Ubuntu 19.04, apply this change into our guest code. --- diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp index 6c40b84a1..91bae624f 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2009-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2009-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -188,11 +188,14 @@ CopyPasteUIX11::Init() Gtk::TargetEntry gnome(FCP_TARGET_NAME_GNOME_COPIED_FILES); Gtk::TargetEntry kde(FCP_TARGET_NAME_URI_LIST); + Gtk::TargetEntry nautilus(FCP_TARGET_NAME_NAUTILUS_FILES); gnome.set_info(FCP_TARGET_INFO_GNOME_COPIED_FILES); kde.set_info(FCP_TARGET_INFO_URI_LIST); + nautilus.set_info(FCP_TARGET_INFO_NAUTILUS_FILES); mListTargets.push_back(gnome); mListTargets.push_back(kde); + mListTargets.push_back(nautilus); mCP->srcRecvClipChanged.connect( sigc::mem_fun(this, &CopyPasteUIX11::GetRemoteClipboardCB)); @@ -448,6 +451,11 @@ CopyPasteUIX11::LocalGetFileRequestCB(Gtk::SelectionData& sd, // IN: } else if (FCP_TARGET_INFO_URI_LIST == info) { pre = DND_URI_LIST_PRE_KDE; post = DND_URI_LIST_POST; + } else if (FCP_TARGET_INFO_NAUTILUS_FILES == info) { + mHGCopiedUriList = + utf::string(FCP_TARGET_MIME_NAUTILUS_FILES) + "\ncopy\n"; + pre = FCP_GNOME_LIST_PRE; + post = FCP_GNOME_LIST_POST; } else { g_debug("%s: Unknown request target: %s\n", __FUNCTION__, sd.get_target().c_str()); @@ -928,6 +936,10 @@ CopyPasteUIX11::LocalGetFileContentsRequestCB(Gtk::SelectionData& sd, // IN } else if (FCP_TARGET_INFO_URI_LIST == info) { pre = DND_URI_LIST_PRE_KDE; post = DND_URI_LIST_POST; + } else if (FCP_TARGET_INFO_NAUTILUS_FILES == info) { + uriList = utf::string(FCP_TARGET_MIME_NAUTILUS_FILES) + "\ncopy\n"; + pre = FCP_GNOME_LIST_PRE; + post = FCP_GNOME_LIST_POST; } else { g_debug("%s: Unknown request target: %s\n", __FUNCTION__, sd.get_target().c_str()); diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h index f439eb6ec..4fb39e2dd 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h +++ b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h @@ -83,8 +83,12 @@ extern "C" { /* FCP target used in KDE. */ #define FCP_TARGET_NAME_URI_LIST "text/uri-list" #define FCP_TARGET_INFO_URI_LIST 1 +/* FCP target used for nautilus 3.30 or later. */ +#define FCP_TARGET_NAME_NAUTILUS_FILES "UTF8_STRING" +#define FCP_TARGET_MIME_NAUTILUS_FILES "x-special/nautilus-clipboard" +#define FCP_TARGET_INFO_NAUTILUS_FILES 2 /* Number of FCP targets. */ -#define NR_FCP_TARGETS 2 +#define NR_FCP_TARGETS 3 #define VMWARE_TARGET "vmware-target"