]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix copy/paste on Ubuntu 19.04 guest
authorOliver Kurth <okurth@vmware.com>
Wed, 8 May 2019 22:27:19 +0000 (15:27 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 8 May 2019 22:27:19 +0000 (15:27 -0700)
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.

open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp
open-vm-tools/services/plugins/dndcp/dnd/dnd.h

index 6c40b84a1d7c8a765ae876335c6ac89a753c5e69..91bae624f72de8f02fb0586fc1040b93c5b176df 100644 (file)
@@ -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());
index f439eb6ec5e9b1385413e4d9a1c5c81cb8e0bf44..4fb39e2ddb8c260d3cda89503ad3d1c87327b54d 100644 (file)
@@ -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"