From: VMware, Inc <> Date: Wed, 26 Jan 2011 01:46:03 +0000 (-0800) Subject: Internal branch sync. Included in this change: X-Git-Tag: stable-8.8.0~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a91a80eb5fbda46eab09a1b8309566bd3958e694;p=thirdparty%2Fopen-vm-tools.git Internal branch sync. Included in this change: . dnd: implement SrcCancel/DestCancel for DnD V4 (fixes issue with copying files when not needed). . changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/vm_legal.h b/open-vm-tools/lib/include/vm_legal.h index a845f8cb2..6e6debf99 100644 --- a/open-vm-tools/lib/include/vm_legal.h +++ b/open-vm-tools/lib/include/vm_legal.h @@ -30,7 +30,7 @@ #include "vm_version.h" -#define COPYRIGHT_YEARS "1998-2010" +#define COPYRIGHT_YEARS "1998-2011" #define COPYRIGHT_STRING "Copyright \251 " COPYRIGHT_YEARS " " COMPANY_NAME #define UTF8_COPYRIGHT_STRING "Copyright \302\251 " COPYRIGHT_YEARS " " COMPANY_NAME #define GENERIC_COPYRIGHT_STRING "Copyright (C) " COPYRIGHT_YEARS " " COMPANY_NAME diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h b/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h index 6b3fe3c3b..bea29dcd0 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h @@ -94,7 +94,8 @@ typedef enum { DND_CMD_SEND_FILES_DONE, DND_CMD_QUERY_EXITING, DND_CMD_DRAG_NOT_PENDING, - DND_CMD_UPDATE_UNITY_DET_WND + DND_CMD_UPDATE_UNITY_DET_WND, + DND_CMD_DEST_CANCEL } DnDCmdV4; /* Copy/Paste commands. */ diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh b/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh index 0b7d5ceba..9747ddc58 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndRpc.hh @@ -70,6 +70,7 @@ public: virtual bool SrcPrivDragEnter(uint32 sessionId) = 0; virtual bool SrcPrivDragLeave(uint32 sessionId, int32 x, int32 y) = 0; virtual bool SrcPrivDrop(uint32 sessionId, int32 x, int32 y) = 0; + virtual bool SrcCancel(uint32 sessionId) = 0; /* DnD destination. */ virtual bool DestDragEnter(uint32 sessionId, @@ -78,6 +79,7 @@ public: const CPClipboard *clip) = 0; virtual bool DestDragLeave(uint32 sessionId, int32 x, int32 y) = 0; virtual bool DestDrop(uint32 sessionId, int32 x, int32 y) = 0; + virtual bool DestCancel(uint32 sessionId) = 0; /* Common. */ virtual void Init(void) = 0; diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndRpcV4.hh b/open-vm-tools/services/plugins/dndcp/dnd/dndRpcV4.hh index ac948cb7b..b5e559429 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndRpcV4.hh +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndRpcV4.hh @@ -53,6 +53,7 @@ public: virtual bool SrcPrivDragEnter(uint32 sessionId); virtual bool SrcPrivDragLeave(uint32 sessionId, int32 x, int32 y); virtual bool SrcPrivDrop(uint32 sessionId, int32 x, int32 y); + virtual bool SrcCancel(uint32 sessionId); /* DnD destination. */ virtual bool DestDragEnter(uint32 sessionId, @@ -65,6 +66,7 @@ public: virtual bool DestDrop(uint32 sessionId, int32 x, int32 y); + virtual bool DestCancel(uint32 sessionId); /* Common. */ virtual bool UpdateFeedback(uint32 sessionId, DND_DROPEFFECT feedback); diff --git a/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV3.hh b/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV3.hh index cade10610..3f76985e7 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV3.hh +++ b/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV3.hh @@ -54,6 +54,7 @@ public: virtual bool SrcPrivDragEnter(uint32 sessionId); virtual bool SrcPrivDragLeave(uint32 sessionId, int32 x, int32 y); virtual bool SrcPrivDrop(uint32 sessionId, int32 x, int32 y); + virtual bool SrcCancel(uint32 sessionId) { return true; }; /* DnD destination. */ virtual bool DestDragEnter(uint32 sessionId, @@ -66,6 +67,7 @@ public: virtual bool DestDrop(uint32 sessionId, int32 x, int32 y); + virtual bool DestCancel(uint32 sessionId) { return true; }; /* Common. */ virtual bool UpdateFeedback(uint32 sessionId, DND_DROPEFFECT feedback); diff --git a/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc b/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc index 58cc631d1..c8ecc93a6 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc +++ b/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc @@ -257,6 +257,28 @@ DnDRpcV4::SrcDropDone(uint32 sessionId, } +/** + * Send cmd DND_CMD_SRC_CANCEL to controller. + * + * @param[in] sessionId active session id the controller assigned earlier. + * + * @return true on success, false otherwise. + */ + +bool +DnDRpcV4::SrcCancel(uint32 sessionId) +{ + RpcParams params; + + memset(¶ms, 0, sizeof params); + params.addrId = DEFAULT_CONNECTION_ID; + params.cmd = DND_CMD_SRC_CANCEL; + params.sessionId = sessionId; + + return mUtil.SendMsg(¶ms); +} + + /** * Send cmd DND_CMD_DEST_DRAG_ENTER to controller. * @@ -389,6 +411,28 @@ DnDRpcV4::DestDrop(uint32 sessionId, } +/** + * Send cmd DND_CMD_DEST_CANCEL to controller. + * + * @param[in] sessionId active session id the controller assigned earlier. + * + * @return true on success, false otherwise. + */ + +bool +DnDRpcV4::DestCancel(uint32 sessionId) +{ + RpcParams params; + + memset(¶ms, 0, sizeof params); + params.addrId = DEFAULT_CONNECTION_ID; + params.cmd = DND_CMD_DEST_CANCEL; + params.sessionId = sessionId; + + return mUtil.SendMsg(¶ms); +} + + /** * Send cmd DND_CMD_QUERY_EXITING to controller. * @@ -626,6 +670,9 @@ DnDRpcV4::HandleMsg(RpcParams *params, params->optional.mouseInfo.x, params->optional.mouseInfo.y); break; + case DND_CMD_DEST_CANCEL: + destCancelChanged.emit(params->sessionId); + break; case DND_CMD_PRIV_DRAG_ENTER: destPrivDragEnterChanged.emit(params->sessionId); break; diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp index ce43ca516..de86b90ce 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp @@ -71,7 +71,7 @@ DnDUIX11::DnDUIX11(ToolsAppCtx *ctx) m_unityMode(false), m_inHGDrag(false), m_effect(DROP_NONE), - m_isFileDnD(false), + m_fileTransferStarted(false), m_mousePosX(0), m_mousePosY(0), m_dc(NULL), @@ -271,7 +271,7 @@ DnDUIX11::CommonResetCB(void) m_effect = DROP_NONE; m_inHGDrag = false; m_dc = NULL; - m_isFileDnD = false; + m_fileTransferStarted = false; RemoveBlock(); } @@ -364,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_isFileDnD = false; + m_fileTransferStarted = false; SourceDragStartDone(); /* Initialize host hide feedback to DROP_NONE. */ m_effect = DROP_NONE; @@ -487,12 +487,14 @@ DnDUIX11::CommonSourceFileCopyDoneCB(bool success) * call CommonResetCB(). Otherwise destination may miss the data because * we are already reset. */ + + m_HGGetDataInProgress = false; + if (!m_inHGDrag) { CommonResetCB(); } else { RemoveBlock(); } - m_HGGetDataInProgress = false; } @@ -924,9 +926,9 @@ 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) { + if (!m_blockAdded && m_inHGDrag && !m_fileTransferStarted) { m_HGGetDataInProgress = true; - m_isFileDnD = true; + m_fileTransferStarted = true; AddBlock(); } else { g_debug("%s: not calling AddBlock\n", __FUNCTION__); @@ -997,7 +999,7 @@ DnDUIX11::GtkSourceDragEndCB(const Glib::RefPtr &dc) * CommonResetCB() here, since we will do so in the fileCopyDoneChanged * callback. */ - if (!m_isFileDnD || !m_HGGetDataInProgress) { + if (!m_fileTransferStarted || !m_HGGetDataInProgress) { CommonResetCB(); } m_inHGDrag = false; diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.h b/open-vm-tools/services/plugins/dndcp/dndUIX11.h index 63092cf11..e532ef6e4 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.h +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.h @@ -200,7 +200,7 @@ private: bool m_unityMode; bool m_inHGDrag; DND_DROPEFFECT m_effect; - bool m_isFileDnD; + bool m_fileTransferStarted; int32 m_mousePosX; int32 m_mousePosY; GdkDragContext *m_dc;