From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:43 +0000 (-0700) Subject: CnP formatted text doesn't keep text format in Fedora 25 X-Git-Tag: stable-10.2.0~177 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a11b7dda01aaefa63f57cbe2f15352c06f2c55eb;p=thirdparty%2Fopen-vm-tools.git CnP formatted text doesn't keep text format in Fedora 25 In Fedora24, the selection target name for rtf is text/richtext. In Fedora25, the selection target name for rtf is changed to text/rtf, which Tools did not support. Add support for the new selection target name "text/rtf". --- diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp index 3b09b6c13..01ab1a3cd 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-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2009-2017 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 @@ -266,7 +266,7 @@ CopyPasteUIX11::VmxCopyPasteVersionChanged(RpcChannel *chan, // IN * CopyPasteUIX11::GetLocalClipboard -- * * Retrives the data from local clipboard and sends it to host. Send empty - * data back if there is no data or can not get data successfully. For + * data back if there is no data or can not get data successfully. For * guest->host copy/paste. * * Results: @@ -313,7 +313,7 @@ CopyPasteUIX11::GetLocalClipboard(void) * * CopyPasteUIX11::GetCurrentTime -- * - * Get current time in microseconds. + * Get current time in microseconds. * * Results: * Time in microseconds. @@ -546,7 +546,8 @@ CopyPasteUIX11::LocalGetTextOrRTFRequestCB(Gtk::SelectionData& sd, // IN/OUT __FUNCTION__, target.c_str()); if (target == TARGET_NAME_APPLICATION_RTF || - target == TARGET_NAME_TEXT_RICHTEXT) { + target == TARGET_NAME_TEXT_RICHTEXT || + target == TARGET_NAME_TEXT_RTF) { if (0 == mHGRTFData.size()) { g_debug("%s: Can not get valid RTF data\n", __FUNCTION__); return; @@ -753,7 +754,7 @@ again: /* Try to get RTF data from clipboard. */ bool haveRTF = false; if (refClipboard->wait_is_target_available(TARGET_NAME_APPLICATION_RTF)) { - g_debug("%s: RTF is available\n", __FUNCTION__); + g_debug("%s: APP RTF is available\n", __FUNCTION__); format = TARGET_NAME_APPLICATION_RTF; haveRTF = true; } @@ -762,6 +763,11 @@ again: format = TARGET_NAME_TEXT_RICHTEXT; haveRTF = true; } + if (refClipboard->wait_is_target_available(TARGET_NAME_TEXT_RTF)) { + g_debug("%s: TEXT_RTF is available\n", __FUNCTION__); + format = TARGET_NAME_TEXT_RTF; + haveRTF = true; + } if (mCP->CheckCapability(DND_CP_CAP_RTF_CP) && haveRTF) { /* @@ -1200,9 +1206,11 @@ CopyPasteUIX11::GetRemoteClipboardCB(const CPClipboard *clip) // IN if (CPClipboard_GetItem(clip, CPFORMAT_RTF, &buf, &sz)) { g_debug("%s: RTF data, size %" FMTSZ "u.\n", __FUNCTION__, sz); Gtk::TargetEntry appRtf(TARGET_NAME_APPLICATION_RTF); - Gtk::TargetEntry textRtf(TARGET_NAME_TEXT_RICHTEXT); + Gtk::TargetEntry textRichText(TARGET_NAME_TEXT_RICHTEXT); + Gtk::TargetEntry textRtf(TARGET_NAME_TEXT_RTF); targets.push_back(appRtf); + targets.push_back(textRichText); targets.push_back(textRtf); mHGRTFData = std::string((const char *)buf); mIsClipboardOwner = true; diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h index f9499572b..90f108c6b 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h +++ b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2005-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2005-2017 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 @@ -90,6 +90,7 @@ extern "C" { #define TARGET_NAME_COMPOUND_TEXT "COMPOUND_TEXT" #define TARGET_NAME_APPLICATION_RTF "application/rtf" #define TARGET_NAME_TEXT_RICHTEXT "text/richtext" +#define TARGET_NAME_TEXT_RTF "text/rtf" #define DRAG_TARGET_NAME_URI_LIST "text/uri-list" #define DRAG_LEAVE_TIMEOUT 500 diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp index 1760c86f6..21387b85d 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2009-2017 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 @@ -260,6 +260,7 @@ DnDUIX11::InitGtk() /* RTF text DnD. */ targets.push_back(Gtk::TargetEntry(TARGET_NAME_APPLICATION_RTF)); targets.push_back(Gtk::TargetEntry(TARGET_NAME_TEXT_RICHTEXT)); + targets.push_back(Gtk::TargetEntry(TARGET_NAME_TEXT_RTF)); /* Plain text DnD. */ targets.push_back(Gtk::TargetEntry(TARGET_NAME_UTF8_STRING)); @@ -401,6 +402,7 @@ DnDUIX11::OnSrcDragBegin(const CPClipboard *clip, // IN if (CPClipboard_ItemExists(&mClipboard, CPFORMAT_RTF)) { targets->add(Glib::ustring(TARGET_NAME_APPLICATION_RTF)); targets->add(Glib::ustring(TARGET_NAME_TEXT_RICHTEXT)); + targets->add(Glib::ustring(TARGET_NAME_TEXT_RTF)); } actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE; @@ -1560,9 +1562,11 @@ DnDUIX11::RequestData( /* Then check RTF. */ targets->add(Glib::ustring(TARGET_NAME_APPLICATION_RTF)); targets->add(Glib::ustring(TARGET_NAME_TEXT_RICHTEXT)); + targets->add(Glib::ustring(TARGET_NAME_TEXT_RTF)); target = mDetWnd->drag_dest_find_target(dc, targets); targets->remove(Glib::ustring(TARGET_NAME_APPLICATION_RTF)); targets->remove(Glib::ustring(TARGET_NAME_TEXT_RICHTEXT)); + targets->remove(Glib::ustring(TARGET_NAME_TEXT_RTF)); if (target != "") { mDetWnd->drag_get_data(dc, target, time); mNumPendingRequest++; diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.h b/open-vm-tools/services/plugins/dndcp/dndUIX11.h index 196255570..d4fda4c0e 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.h +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2009-2017 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 @@ -192,7 +192,8 @@ private: static inline bool TargetIsRichText(const utf::string& target) { return target == TARGET_NAME_APPLICATION_RTF - || target == TARGET_NAME_TEXT_RICHTEXT; + || target == TARGET_NAME_TEXT_RICHTEXT + || target == TARGET_NAME_TEXT_RTF; } void OnWorkAreaChanged(Glib::RefPtr screen);