From: VMware, Inc <> Date: Tue, 26 Apr 2011 20:33:02 +0000 (-0700) Subject: Internal branch sync. Included in this change: X-Git-Tag: 2011.04.25-402641~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=67c6930e3e4c0e8ade0343dfe020c1901b91564c;p=thirdparty%2Fopen-vm-tools.git Internal branch sync. Included in this change: . DnD: cache the file list so that we can provide a valid response after the DnD operation has finished. Also add "ftp" to the supported schemes. . changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp index 9279da7e3..67751e17a 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp @@ -309,7 +309,6 @@ CopyPasteUIX11::LocalGetFileRequestCB(Gtk::SelectionData& sd, // IN: guint info) // IN: { g_debug("%s: enter.\n", __FUNCTION__); - mHGCopiedUriList = ""; VmTimeType curTime; curTime = GetCurrentTime(); @@ -340,8 +339,8 @@ CopyPasteUIX11::LocalGetFileRequestCB(Gtk::SelectionData& sd, // IN: * On KDE (at least), we can see this multiple times, so ignore if * we are already getting files. */ - g_debug("%s: already processing a GetFile request, returning.\n", - __FUNCTION__); + g_debug("%s: GetFiles already started, returning uriList [%s]\n", + __FUNCTION__, mHGCopiedUriList.c_str()); sd.set(sd.get_target().c_str(), mHGCopiedUriList.c_str()); return; } diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h index 62069ac27..6000fa35d 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h +++ b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h @@ -58,7 +58,7 @@ /* Strings used for formatting various types of data */ #define DND_URI_LIST_PRE "file://" #define DND_URI_LIST_PRE_KDE "file:" -#define DND_URI_NON_FILE_SCHEMES {"ssh", "sftp", "smb", "dav", "davs", NULL} +#define DND_URI_NON_FILE_SCHEMES {"ssh", "sftp", "smb", "dav", "davs", "ftp", NULL} #define DND_URI_LIST_POST "\r\n" #define DND_TEXT_PLAIN_PRE "" #define DND_TEXT_PLAIN_POST "" @@ -137,6 +137,12 @@ typedef struct { #if !defined(SWIG) +typedef enum { + DND_FILE_TRANSFER_NOT_STARTED = 0, + DND_FILE_TRANSFER_IN_PROGRESS, + DND_FILE_TRANSFER_FINISHED, +} DND_FILE_TRANSFER_STATUS; + /* * Comment out the following for SWIG. We don't currently need to use any of * these data structures or call any of these functions from test scripts, and diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp index 03ca3eaee..570acf75b 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp @@ -64,14 +64,13 @@ DnDUIX11::DnDUIX11(ToolsAppCtx *ctx) m_DnD(NULL), m_detWnd(NULL), m_blockCtrl(NULL), - m_HGGetDataInProgress(false), + m_HGGetFileStatus(DND_FILE_TRANSFER_NOT_STARTED), m_blockAdded(false), m_GHDnDInProgress(false), m_GHDnDDataReceived(false), m_unityMode(false), m_inHGDrag(false), m_effect(DROP_NONE), - m_fileTransferStarted(false), m_mousePosX(0), m_mousePosY(0), m_dc(NULL), @@ -268,12 +267,11 @@ DnDUIX11::CommonResetCB(void) { g_debug("%s: entering\n", __FUNCTION__); m_GHDnDDataReceived = false; - m_HGGetDataInProgress = false; + m_HGGetFileStatus = DND_FILE_TRANSFER_NOT_STARTED; m_GHDnDInProgress = false; m_effect = DROP_NONE; m_inHGDrag = false; m_dc = NULL; - m_fileTransferStarted = false; RemoveBlock(); } @@ -366,7 +364,7 @@ DnDUIX11::CommonDragStartCB(const CPClipboard *clip, std::string stagingDir) /* Tell Gtk that a drag should be started from this widget. */ m_detWnd->drag_begin(targets, actions, 1, (GdkEvent *)&event); m_blockAdded = false; - m_fileTransferStarted = false; + m_HGGetFileStatus = DND_FILE_TRANSFER_NOT_STARTED; SourceDragStartDone(); /* Initialize host hide feedback to DROP_NONE. */ m_effect = DROP_NONE; @@ -394,7 +392,7 @@ DnDUIX11::CommonSourceCancelCB(void) SendFakeXEvents(true, true, false, true, true, 0, 0); CommonUpdateDetWndCB(false, 0, 0); m_inHGDrag = false; - m_HGGetDataInProgress = false; + m_HGGetFileStatus = DND_FILE_TRANSFER_NOT_STARTED; m_effect = DROP_NONE; RemoveBlock(); } @@ -490,7 +488,7 @@ DnDUIX11::CommonSourceFileCopyDoneCB(bool success) * we are already reset. */ - m_HGGetDataInProgress = false; + m_HGGetFileStatus = DND_FILE_TRANSFER_FINISHED; if (!m_inHGDrag) { CommonResetCB(); @@ -685,7 +683,7 @@ DnDUIX11::GtkDestDragMotionCB(const Glib::RefPtr &dc, g_debug("%s: not ignored %ld %ld %ld\n", __FUNCTION__, curTime, m_destDropTime, curTime - m_destDropTime); - if (m_inHGDrag || m_HGGetDataInProgress) { + if (m_inHGDrag || (m_HGGetFileStatus != DND_FILE_TRANSFER_NOT_STARTED)) { g_debug("%s: ignored not in hg drag or not getting hg data\n", __FUNCTION__); return true; } @@ -931,9 +929,10 @@ DnDUIX11::GtkSourceDragDataGetCB(const Glib::RefPtr &dc, * Doing both of these addresses bug * http://bugzilla.eng.vmware.com/show_bug.cgi?id=391661. */ - if (!m_blockAdded && m_inHGDrag && !m_fileTransferStarted) { - m_HGGetDataInProgress = true; - m_fileTransferStarted = true; + if (!m_blockAdded && + m_inHGDrag && + (m_HGGetFileStatus == DND_FILE_TRANSFER_NOT_STARTED)) { + m_HGGetFileStatus == DND_FILE_TRANSFER_IN_PROGRESS; AddBlock(); } else { g_debug("%s: not calling AddBlock\n", __FUNCTION__); @@ -1004,7 +1003,7 @@ DnDUIX11::GtkSourceDragEndCB(const Glib::RefPtr &dc) * CommonResetCB() here, since we will do so in the fileCopyDoneChanged * callback. */ - if (!m_fileTransferStarted || !m_HGGetDataInProgress) { + if (DND_FILE_TRANSFER_IN_PROGRESS != m_HGGetFileStatus) { CommonResetCB(); } m_inHGDrag = false; @@ -1780,7 +1779,7 @@ void DnDUIX11::RemoveBlock() { g_debug("%s: enter\n", __FUNCTION__); - if (m_blockAdded && !m_HGGetDataInProgress) { + if (m_blockAdded && (DND_FILE_TRANSFER_IN_PROGRESS != m_HGGetFileStatus)) { g_debug("%s: removing block for %s\n", __FUNCTION__, m_HGStagingDir.c_str()); /* We need to make sure block subsystem has not been shut off. */ if (DnD_BlockIsReady(m_blockCtrl)) { @@ -1788,10 +1787,10 @@ DnDUIX11::RemoveBlock() } m_blockAdded = false; } else { - g_debug("%s: not removing block m_blockAdded %d m_HGGetDataInProgress %d\n", + g_debug("%s: not removing block m_blockAdded %d m_HGGetFileStatus %d\n", __FUNCTION__, m_blockAdded, - m_HGGetDataInProgress); + m_HGGetFileStatus); } } diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.h b/open-vm-tools/services/plugins/dndcp/dndUIX11.h index 859ad8941..3341ff4ea 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.h +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.h @@ -189,7 +189,7 @@ private: DragDetWnd *m_detWnd; CPClipboard m_clipboard; DnDBlockControl *m_blockCtrl; - bool m_HGGetDataInProgress; + DND_FILE_TRANSFER_STATUS m_HGGetFileStatus; int m_HGEffect; bool m_blockAdded; @@ -202,7 +202,6 @@ private: bool m_unityMode; bool m_inHGDrag; DND_DROPEFFECT m_effect; - bool m_fileTransferStarted; int32 m_mousePosX; int32 m_mousePosY; GdkDragContext *m_dc;