--- /dev/null
+/*********************************************************
+ * Copyright (C) 2013 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/*
+ * tracer.hh --
+ *
+ * A dumb object to trace function enter/exit. (Devel-only.)
+ */
+
+
+#ifndef TRACER_HH
+#define TRACER_HH
+
+
+extern "C" {
+#include "vm_basic_defs.h"
+#include "glib.h"
+}
+
+
+#ifdef VMX86_DEVEL
+# define TRACE_CALL() Tracer _fn_tracer (__FUNCTION__)
+class Tracer {
+public:
+ Tracer(const char* fnName)
+ : mFnName(fnName)
+ {
+ g_debug("> %s: enter\n", mFnName);
+ }
+
+ ~Tracer()
+ {
+ g_debug("< %s: exit\n", mFnName);
+ }
+
+private:
+ Tracer(); // = delete
+ Tracer(const Tracer&); // = delete
+
+ const char* mFnName;
+};
+#else
+# define TRACE_CALL()
+#endif
+
+#endif // ifndef TRACER_HH
#include "copyPasteDnDWrapper.h"
#include "copyPasteDnDX11.h"
#include "dndPluginIntX11.h"
+#include "tracer.hh"
Window gXRoot;
Display *gXDisplay;
BlockService *
BlockService::GetInstance()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (!m_instance) {
m_instance = new BlockService();
void
BlockService::Init(ToolsAppCtx *ctx)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (!m_initialized && ctx) {
m_blockCtrl.fd = ctx->blockFD;
gpointer data)
{
ToolsAppCtx *ctx = (ToolsAppCtx *)data;
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
GetInstance()->Shutdown();
void
BlockService::Shutdown()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (m_initialized) {
g_source_destroy(m_shutdownSrc);
gboolean
CopyPasteDnDX11::Init(ToolsAppCtx *ctx)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
ASSERT(ctx);
gboolean
CopyPasteDnDX11::RegisterCP()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
if (wrapper->IsCPRegistered()) {
gboolean
CopyPasteDnDX11::RegisterDnD()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
if (!wrapper->IsDnDEnabled()) {
void
CopyPasteDnDX11::UnregisterCP()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
if (wrapper->IsCPRegistered()) {
if (m_copyPasteUI) {
void
CopyPasteDnDX11::UnregisterDnD()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
if (wrapper->IsDnDRegistered()) {
if (m_dndUI) {
CopyPasteDnDX11::SetDnDAllowed(bool allowed)
{
ASSERT(m_dndUI);
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
m_dndUI->SetDnDAllowed(allowed);
}
CopyPasteDnDX11::SetCopyPasteAllowed(bool allowed)
{
ASSERT(m_copyPasteUI);
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
m_copyPasteUI->SetCopyPasteAllowed(allowed);
}
void
CopyPasteDnDX11::CopyPasteVersionChanged(int version)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
ToolsAppCtx *ctx = wrapper->GetToolsAppCtx();
g_debug("%s: calling VmxCopyPasteVersionChanged (version %d)\n",
void
CopyPasteDnDX11::DnDVersionChanged(int version)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
ToolsAppCtx *ctx = wrapper->GetToolsAppCtx();
g_debug("%s: calling VmxDnDVersionChanged (version %d)\n",
void
CopyPasteDnDX11::PointerInit()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
ASSERT(wrapper);
#include "copyPasteUIX11.h"
#include "dndFileList.hh"
#include "guestDnDCPMgr.hh"
+#include "tracer.hh"
extern "C" {
#include "vmblock.h"
bool
CopyPasteUIX11::Init()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (mInited) {
return true;
}
CopyPasteUIX11::~CopyPasteUIX11()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CPClipboard_Destroy(&mClipboard);
/* Any files from last unfinished file transfer should be deleted. */
if (DND_FILE_TRANSFER_IN_PROGRESS == mHGGetFileStatus &&
void *buf;
size_t sz;
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (!clip) {
g_debug("%s: No clipboard contents.", __FUNCTION__);
return;
void
CopyPasteUIX11::Reset(void)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
/* Cancel any pending file transfer. */
}
#include "copyPasteRpcV3.hh"
+#include "tracer.hh"
extern "C" {
#include "dndMsg.h"
void
CopyPasteRpcV3::Init(void)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
ASSERT(mTransport);
mTransport->RegisterRpc(this, mTransportInterface);
}
void
CopyPasteRpcV3::SendPing(uint32 caps)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
}
CopyPasteRpcV3::SrcRequestClip(uint32 sessionId,
bool isActive)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool isActive,
const CPClipboard* clip)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return mUtil.SendMsg(CP_GH_GET_CLIPBOARD_DONE, clip);
}
DnDMsg msg;
bool ret = false;
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
DnDMsg_Init(&msg);
/* Construct msg with both cmd CP_HG_START_FILE_COPY and stagingDirCP. */
DnDMsg_SetCmd(&msg, CP_HG_START_FILE_COPY);
if (!DnDMsg_AppendArg(&msg, (void *)stagingDirCP, sz)) {
- Debug("%s: DnDMsg_AppendData failed.\n", __FUNCTION__);
+ g_debug("%s: DnDMsg_AppendData failed.\n", __FUNCTION__);
goto exit;
}
const uint8 *stagingDirCP,
uint32 sz)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
CopyPasteRpcV3::GetFilesDone(uint32 sessionId,
bool success)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
const uint8 *packet,
size_t length)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return mTransport->SendPacket(destId,
mTransportInterface,
packet,
ret = DnDMsg_UnserializeHeader(&msg, (void *)binary, binarySize);
if (DNDMSG_SUCCESS != ret) {
- Debug("%s: DnDMsg_UnserializeHeader failed %d\n", __FUNCTION__, ret);
+ g_debug("%s: DnDMsg_UnserializeHeader failed %d\n", __FUNCTION__, ret);
goto exit;
}
(void *)(binary + DNDMSG_HEADERSIZE_V3),
binarySize - DNDMSG_HEADERSIZE_V3);
if (DNDMSG_SUCCESS != ret) {
- Debug("%s: DnDMsg_UnserializeArgs failed with %d\n", __FUNCTION__, ret);
+ g_debug("%s: DnDMsg_UnserializeArgs failed with %d\n", __FUNCTION__, ret);
goto exit;
}
- Debug("%s: Got %d, binary size %d.\n",
- __FUNCTION__, DnDMsg_GetCmd(&msg), binarySize);
+ g_debug("%s: Got %d, binary size %d.\n", __FUNCTION__, DnDMsg_GetCmd(&msg),
+ binarySize);
/*
* Translate command and emit signal. Session Id 1 is used because version
/* Unserialize clipboard data for the command. */
buf = DnDMsg_GetArg(&msg, 0);
if (!CPClipboard_Unserialize(&clip, DynBuf_Get(buf), DynBuf_GetSize(buf))) {
- Debug("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__);
+ g_debug("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__);
goto exit;
}
srcRecvClipChanged.emit(1, false, &clip);
break;
}
default:
- Debug("%s: got unsupported new command %d.\n",
- __FUNCTION__, DnDMsg_GetCmd(&msg));
+ g_debug("%s: got unsupported new command %d.\n", __FUNCTION__,
+ DnDMsg_GetCmd(&msg));
}
exit:
DnDMsg_Destroy(&msg);
const uint8 *packet,
size_t packetSize)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
mUtil.OnRecvPacket(srcId, packet, packetSize);
}
#endif
#include "dndRpcV3.hh"
+#include "tracer.hh"
extern "C" {
#include "debug.h"
void
DnDRpcV3::Init(void)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
ASSERT(mTransport);
mTransport->RegisterRpc(this, mTransportInterface);
}
DnDRpcV3::SrcDragEnterDone(int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return mUtil.SendMsg(DND_HG_DRAG_ENTER_DONE, x, y);
}
bool
DnDRpcV3::SrcDragBeginDone(uint32 sessionId)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return mUtil.SendMsg(DND_HG_DRAG_READY);
}
DnDMsg_SetCmd(&msg, DND_HG_UPDATE_FEEDBACK);
if (!DnDMsg_AppendArg(&msg, &feedback, sizeof feedback)) {
- Debug("%s: DnDMsg_AppendData failed.\n", __FUNCTION__);
+ g_debug("%s: DnDMsg_AppendData failed.\n", __FUNCTION__);
goto exit;
}
bool
DnDRpcV3::SrcPrivDragEnter(uint32 sessionId)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
DnDMsg msg;
bool ret = false;
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
DnDMsg_Init(&msg);
/* Construct msg with both cmd CP_HG_START_FILE_COPY and stagingDirCP. */
DnDMsg_SetCmd(&msg, DND_HG_DROP_DONE);
if (!DnDMsg_AppendArg(&msg, (void *)stagingDirCP, sz)) {
- Debug("%s: DnDMsg_AppendData failed.\n", __FUNCTION__);
+ g_debug("%s: DnDMsg_AppendData failed.\n", __FUNCTION__);
goto exit;
}
DnDRpcV3::DestDragEnter(uint32 sessionId,
const CPClipboard *clip)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return mUtil.SendMsg(DND_GH_DRAG_ENTER, clip);
}
DnDRpcV3::DestSendClip(uint32 sessionId,
const CPClipboard *clip)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool
DnDRpcV3::DragNotPending(uint32 sessionId)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return mUtil.SendMsg(DND_GH_NOT_PENDING);
}
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool show,
uint32 unityWndId)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool
DnDRpcV3::RequestFiles(uint32 sessionId)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
const uint8 *stagingDirCP,
uint32 sz)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
DnDRpcV3::GetFilesDone(uint32 sessionId,
bool success)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
const uint8 *packet,
size_t length)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
return mTransport->SendPacket(destId, mTransportInterface, packet, length);
}
ret = DnDMsg_UnserializeHeader(&msg, (void *)binary, binarySize);
if (DNDMSG_SUCCESS != ret) {
- Debug("%s: DnDMsg_UnserializeHeader failed %d\n", __FUNCTION__, ret);
+ g_debug("%s: DnDMsg_UnserializeHeader failed %d\n", __FUNCTION__, ret);
goto exit;
}
(void *)(binary + DNDMSG_HEADERSIZE_V3),
binarySize - DNDMSG_HEADERSIZE_V3);
if (DNDMSG_SUCCESS != ret) {
- Debug("%s: DnDMsg_UnserializeArgs failed with %d\n", __FUNCTION__, ret);
+ g_debug("%s: DnDMsg_UnserializeArgs failed with %d\n", __FUNCTION__, ret);
goto exit;
}
- Debug("%s: Got %d, binary size %d.\n",
- __FUNCTION__, DnDMsg_GetCmd(&msg), binarySize);
+ g_debug("%s: Got %d, binary size %d.\n", __FUNCTION__, DnDMsg_GetCmd(&msg),
+ binarySize);
/*
* Translate command and emit signal. Session Id 1 is used because version
/* Unserialize clipboard data for the command. */
buf = DnDMsg_GetArg(&msg, 0);
if (!CPClipboard_Unserialize(&mClipboard, DynBuf_Get(buf), DynBuf_GetSize(buf))) {
- Debug("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__);
+ g_debug("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__);
break;
}
SrcDragEnterDone(DRAG_DET_WINDOW_WIDTH / 2,
break;
}
default:
- Debug("%s: got unsupported new command %d.\n",
- __FUNCTION__, DnDMsg_GetCmd(&msg));
+ g_debug("%s: got unsupported new command %d.\n", __FUNCTION__,
+ DnDMsg_GetCmd(&msg));
}
exit:
DnDMsg_Destroy(&msg);
const uint8 *packet,
size_t packetSize)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
mUtil.OnRecvPacket(srcId, packet, packetSize);
}
sigc::signal<void, bool> getFilesDoneChanged;
GUEST_CP_STATE GetState(void) { return mCPState; }
- void SetState(GUEST_CP_STATE state) { mCPState = state; }
+ void SetState(GUEST_CP_STATE state);
CopyPasteRpc *GetRpc(void) { return mRpc; }
GuestCopyPasteSrc *GetCopyPasteSrc(void)
{ return mSrc; }
GuestCopyPasteDest *GetCopyPasteDest(void)
{ return mDest; }
void ResetCopyPaste(void);
+
uint32 GetSessionId(void) { return mSessionId; }
- void SetSessionId(uint32 id) { mSessionId = id; }
+ void SetSessionId(uint32 id);
void DestUISendClip(const CPClipboard *clip);
const std::string SrcUIRequestFiles(const std::string &dir = "");
#include "guestCopyPaste.hh"
extern "C" {
+ #include <glib.h>
+
#include "dndClipboard.h"
#include "debug.h"
}
{
ASSERT(clip);
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
if (mMgr->GetState() != GUEST_CP_READY) {
/* Reset DnD for any wrong state. */
- Debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
goto error;
}
if (!mMgr->GetRpc()->DestSendClip(mMgr->GetSessionId(), mIsActive, clip)) {
- Debug("%s: DestSendClip failed\n", __FUNCTION__);
+ g_debug("%s: DestSendClip failed\n", __FUNCTION__);
goto error;
}
GuestCopyPasteDest::OnRpcRequestClip(bool isActive)
{
mIsActive = isActive;
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
mMgr->destRequestClipChanged.emit();
}
* Implementation of common layer GuestCopyPasteMgr object for guest.
*/
+#include "tracer.hh"
#include "guestCopyPaste.hh"
#include "copyPasteRpcV3.hh"
#include "copyPasteRpcV4.hh"
void
GuestCopyPasteMgr::ResetCopyPaste(void)
{
- Debug("%s: state %d, session id %d before reset\n",
- __FUNCTION__, mCPState, mSessionId);
+ TRACE_CALL();
+
if (mSrc) {
delete mSrc;
mSrc = NULL;
}
SetState(GUEST_CP_READY);
SetSessionId(0);
- Debug("%s: change to state %d, session id %d\n",
- __FUNCTION__, mCPState, mSessionId);
+}
+
+
+/**
+ * Session ID change and bookkeeping.
+ *
+ * @param[in] id Next session ID.
+ */
+void
+GuestCopyPasteMgr::SetSessionId(uint32 id)
+{
+ DEVEL_ONLY(g_debug("%s: %u => %u\n", __FUNCTION__, mSessionId, id));
+ mSessionId = id;
+}
+
+
+/**
+ * State change and bookkeeping.
+ *
+ * @param[in] state Next state.
+ */
+
+void
+GuestCopyPasteMgr::SetState(GUEST_CP_STATE state)
+{
+#ifdef VMX86_DEVEL
+ static const char* states[] = {
+ "GUEST_CP_INVALID",
+ "GUEST_CP_READY",
+ "GUEST_CP_HG_FILE_COPYING",
+ };
+ g_debug("%s: %s => %s\n", __FUNCTION__, states[mCPState], states[state]);
+#endif
+
+ mCPState = state;
}
{
ASSERT(clip);
- Debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (!mCopyPasteAllowed) {
- Debug("%s: CopyPaste is not allowed.\n", __FUNCTION__);
+ g_debug("%s: CopyPaste is not allowed.\n", __FUNCTION__);
return;
}
if (GUEST_CP_READY != mCPState) {
- Debug("%s: Bad state: %d, reset\n", __FUNCTION__, mCPState);
+ g_debug("%s: Bad state: %d, reset\n", __FUNCTION__, mCPState);
/* XXX Should reset DnD here. */
return;
}
if (mSrc) {
- Debug("%s: mSrc is not NULL\n", __FUNCTION__);
+ g_debug("%s: mSrc is not NULL\n", __FUNCTION__);
delete mSrc;
mSrc = NULL;
}
- mSessionId = sessionId;
- Debug("%s: change sessionId to %d\n", __FUNCTION__, mSessionId);
+ SetSessionId(sessionId);
mSrc = new GuestCopyPasteSrc(this);
-
mSrc->OnRpcRecvClip(isActive, clip);
}
if (mSrc) {
return mSrc->UIRequestFiles(dir);
} else {
- Debug("%s: mSrc is NULL\n", __FUNCTION__);
+ g_debug("%s: mSrc is NULL\n", __FUNCTION__);
return std::string("");
}
}
GuestCopyPasteMgr::OnRpcDestRequestClip(uint32 sessionId,
bool isActive)
{
- Debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (!mCopyPasteAllowed) {
- Debug("%s: CopyPaste is not allowed.\n", __FUNCTION__);
+ g_debug("%s: CopyPaste is not allowed.\n", __FUNCTION__);
return;
}
if (GUEST_CP_READY != mCPState) {
- Debug("%s: Bad state: %d, reset\n", __FUNCTION__, mCPState);
+ g_debug("%s: Bad state: %d, reset\n", __FUNCTION__, mCPState);
/* XXX Should reset CP here. */
return;
}
if (mDest) {
- Debug("%s: mDest is not NULL\n", __FUNCTION__);
+ g_debug("%s: mDest is not NULL\n", __FUNCTION__);
delete mDest;
mDest = NULL;
}
- mSessionId = sessionId;
- Debug("%s: change sessionId to %d\n", __FUNCTION__, mSessionId);
+ SetSessionId(sessionId);
mDest = new GuestCopyPasteDest(this);
-
mDest->OnRpcRequestClip(isActive);
}
if (mDest) {
mDest->UISendClip(clip);
} else {
- Debug("%s: mDest is NULL\n", __FUNCTION__);
+ g_debug("%s: mDest is NULL\n", __FUNCTION__);
}
}
void
GuestCopyPasteMgr::VmxCopyPasteVersionChanged(uint32 version)
{
- Debug("GuestCopyPasteMgr::%s: enter version %d\n", __FUNCTION__, version);
+ g_debug("GuestCopyPasteMgr::%s: enter version %d\n", __FUNCTION__, version);
ASSERT(version >= 3);
ASSERT(mTransport);
break;
}
if (mRpc) {
- Debug("GuestCopyPasteMgr::%s: register ping reply changed %d\n",
- __FUNCTION__, version);
+ g_debug("GuestCopyPasteMgr::%s: register ping reply changed %d\n",
+ __FUNCTION__, version);
mRpc->pingReplyChanged.connect(
sigc::mem_fun(this, &GuestCopyPasteMgr::OnPingReply));
mRpc->srcRecvClipChanged.connect(
void
GuestCopyPasteMgr::OnPingReply(uint32 capabilities)
{
- Debug("%s: copypaste ping reply caps are %x\n", __FUNCTION__, capabilities);
+ g_debug("%s: copypaste ping reply caps are %x\n", __FUNCTION__, capabilities);
mResolvedCaps = capabilities;
}
#include "guestCopyPaste.hh"
extern "C" {
+ #include <glib.h>
+
#include "dndClipboard.h"
#include "debug.h"
#include "file.h"
ASSERT(mMgr);
ASSERT(clip);
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
CPClipboard_Clear(&mClipboard);
CPClipboard_Copy(&mClipboard, clip);
if (mMgr->GetState() != GUEST_CP_READY) {
/* Reset DnD for any wrong state. */
- Debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
goto error;
}
sizeof cpName,
cpName);
if (cpNameSize < 0) {
- Debug("%s: Error, could not convert to CPName.\n", __FUNCTION__);
+ g_debug("%s: Error, could not convert to CPName.\n", __FUNCTION__);
goto error;
}
mStagingDir = destDir;
mMgr->SetState(GUEST_CP_HG_FILE_COPYING);
- Debug("%s: state changed to GUEST_CP_HG_FILE_COPYING\n", __FUNCTION__);
+ g_debug("%s: state changed to GUEST_CP_HG_FILE_COPYING\n", __FUNCTION__);
return destDir;
/* UI should remove block with this signal. */
mMgr->getFilesDoneChanged.emit(success);
mMgr->SetState(GUEST_CP_READY);
- Debug("%s: state changed to READY\n", __FUNCTION__);
+ g_debug("%s: state changed to READY\n", __FUNCTION__);
}
mStagingDir += DIRSEPS;
}
free(newDir);
- Debug("%s: destdir: %s", __FUNCTION__, mStagingDir.c_str());
+ g_debug("%s: destdir: %s", __FUNCTION__, mStagingDir.c_str());
} else {
- Debug("%s: destdir not created", __FUNCTION__);
+ g_debug("%s: destdir not created", __FUNCTION__);
}
}
return mStagingDir;
#include "guestDnD.hh"
+#include "tracer.hh"
extern "C" {
#include "dndClipboard.h"
GuestDnDDest::UIDragEnter(const CPClipboard *clip)
{
if (!mMgr->IsDragEnterAllowed()) {
- Debug("%s: not allowed.\n", __FUNCTION__);
+ g_debug("%s: not allowed.\n", __FUNCTION__);
return;
}
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
if (GUEST_DND_DEST_DRAGGING == mMgr->GetState() ||
GUEST_DND_PRIV_DRAGGING == mMgr->GetState()) {
* VM and drag into the detection window again, and trigger the
* DragEnter. In this case, ignore the DragEnter.
*/
- Debug("%s: already in state %d for GH DnD, ignoring.\n",
- __FUNCTION__, mMgr->GetState());
+ g_debug("%s: already in state %d for GH DnD, ignoring.\n", __FUNCTION__,
+ mMgr->GetState());
return;
}
* In HG DnD case, if DnD already happened, user may also drag into the
* detection window again. The DragEnter should also be ignored.
*/
- Debug("%s: already in SRC_DRAGGING state, ignoring\n", __FUNCTION__);
+ g_debug("%s: already in SRC_DRAGGING state, ignoring\n", __FUNCTION__);
return;
}
*/
if (mMgr->GetState() != GUEST_DND_QUERY_EXITING &&
mMgr->GetState() != GUEST_DND_READY) {
- Debug("%s: Bad state: %d, reset\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: Bad state: %d, reset\n", __FUNCTION__, mMgr->GetState());
goto error;
}
CPClipboard_Copy(&mClipboard, clip);
if (!mMgr->GetRpc()->DestDragEnter(mMgr->GetSessionId(), clip)) {
- Debug("%s: DestDragEnter failed\n", __FUNCTION__);
+ g_debug("%s: DestDragEnter failed\n", __FUNCTION__);
goto error;
}
mMgr->SetState(GUEST_DND_DEST_DRAGGING);
- Debug("%s: state changed to DEST_DRAGGING\n", __FUNCTION__);
+ g_debug("%s: state changed to DEST_DRAGGING\n", __FUNCTION__);
return;
error:
void
GuestDnDDest::OnRpcPrivDragEnter(uint32 sessionId)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
if (GUEST_DND_DEST_DRAGGING != mMgr->GetState()) {
- Debug("%s: Bad state: %d, reset\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: Bad state: %d, reset\n", __FUNCTION__, mMgr->GetState());
goto error;
}
mMgr->SetState(GUEST_DND_PRIV_DRAGGING);
- Debug("%s: state changed to PRIV_DRAGGING\n", __FUNCTION__);
+ g_debug("%s: state changed to PRIV_DRAGGING\n", __FUNCTION__);
return;
error:
int32 x,
int32 y)
{
- Debug("%s: entering.\n", __FUNCTION__);
+ TRACE_CALL();
if (GUEST_DND_PRIV_DRAGGING != mMgr->GetState()) {
- Debug("%s: Bad state: %d, reset\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: Bad state: %d, reset\n", __FUNCTION__, mMgr->GetState());
goto error;
}
mMgr->SetState(GUEST_DND_DEST_DRAGGING);
mMgr->destMoveDetWndToMousePosChanged.emit();
- Debug("%s: state changed to DEST_DRAGGING\n", __FUNCTION__);
+ g_debug("%s: state changed to DEST_DRAGGING\n", __FUNCTION__);
return;
error:
mMgr->privDropChanged.emit(x, y);
mMgr->HideDetWnd();
mMgr->SetState(GUEST_DND_READY);
- Debug("%s: state changed to GUEST_DND_READY, session id changed to 0\n",
- __FUNCTION__);
+ // XXX Trace.
+ g_debug("%s: state changed to GUEST_DND_READY, session id changed to 0\n",
+ __FUNCTION__);
}
mMgr->RemoveUngrabTimeout();
mMgr->destCancelChanged.emit();
mMgr->SetState(GUEST_DND_READY);
- Debug("%s: state changed to GUEST_DND_READY, session id changed to 0\n",
- __FUNCTION__);
+ g_debug("%s: state changed to GUEST_DND_READY, session id changed to 0\n",
+ __FUNCTION__);
}
* Implementation of common layer GuestDnDMgr object for guest.
*/
+#include "tracer.hh"
#include "guestDnD.hh"
#include "dndRpcV4.hh"
#include "dndRpcV3.hh"
static gboolean
DnDUngrabTimeout(void *clientData)
{
+ TRACE_CALL();
+
ASSERT(clientData);
GuestDnDMgr *dnd = (GuestDnDMgr *)clientData;
/* Call actual callback. */
static gboolean
DnDHideDetWndTimer(void *clientData)
{
- Debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
+
ASSERT(clientData);
GuestDnDMgr *dnd = (GuestDnDMgr *)clientData;
dnd->SetHideDetWndTimer(NULL);
static gboolean
DnDUnityDetTimeout(void *clientData)
{
- Debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
+
ASSERT(clientData);
GuestDnDMgr *dnd = (GuestDnDMgr *)clientData;
dnd->UnityDnDDetTimeout();
void
GuestDnDMgr::ResetDnD(void)
{
- Debug("%s: state %d, session id %d before reset\n",
- __FUNCTION__, mDnDState, mSessionId);
+ TRACE_CALL();
+
if (mSrc) {
srcCancelChanged.emit();
DelayHideDetWnd();
delete mDest;
mDest = NULL;
}
+
SetState(GUEST_DND_READY);
- Debug("%s: change to state %d, session id %d\n",
- __FUNCTION__, mDnDState, mSessionId);
+
+ g_debug("%s: change to state %d, session id %d\n", __FUNCTION__, mDnDState,
+ mSessionId);
}
void
GuestDnDMgr::SrcUIDragBeginDone(void)
{
+ TRACE_CALL();
+
if (mSrc) {
mSrc->UIDragBeginDone();
} else {
- Debug("%s: mSrc is NULL\n", __FUNCTION__);
+ g_debug("%s: mSrc is NULL\n", __FUNCTION__);
}
}
void
GuestDnDMgr::SrcUIUpdateFeedback(DND_DROPEFFECT feedback)
{
+ TRACE_CALL();
+
if (mSrc) {
mSrc->UIUpdateFeedback(feedback);
} else {
- Debug("%s: mSrc is NULL\n", __FUNCTION__);
+ g_debug("%s: mSrc is NULL\n", __FUNCTION__);
}
}
void
GuestDnDMgr::DestUIDragEnter(const CPClipboard *clip)
{
- Debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
/* Remove untriggered ungrab timer. */
RemoveUngrabTimeout();
*/
if (mDnDState != GUEST_DND_QUERY_EXITING &&
mDnDState != GUEST_DND_READY) {
- Debug("%s: Bad state: %d, reset\n", __FUNCTION__, mDnDState);
+ g_debug("%s: Bad state: %d, reset\n", __FUNCTION__, mDnDState);
ResetDnD();
return;
}
}
if (mDest) {
- Debug("%s: mDest is not NULL\n", __FUNCTION__);
+ g_debug("%s: mDest is not NULL\n", __FUNCTION__);
delete mDest;
mDest = NULL;
}
GuestDnDMgr::OnRpcSrcDragBegin(uint32 sessionId,
const CPClipboard *clip)
{
- Debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (!mDnDAllowed) {
- Debug("%s: DnD is not allowed.\n", __FUNCTION__);
+ g_debug("%s: DnD is not allowed.\n", __FUNCTION__);
return;
}
if (GUEST_DND_READY != mDnDState) {
- Debug("%s: Bad state: %d, reset\n", __FUNCTION__, mDnDState);
+ g_debug("%s: Bad state: %d, reset\n", __FUNCTION__, mDnDState);
ResetDnD();
return;
}
if (mSrc) {
- Debug("%s: mSrc is not NULL\n", __FUNCTION__);
+ g_debug("%s: mSrc is not NULL\n", __FUNCTION__);
delete mSrc;
mSrc = NULL;
}
- mSessionId = sessionId;
- Debug("%s: change sessionId to %d\n", __FUNCTION__, mSessionId);
+ SetSessionId(sessionId);
ASSERT(clip);
mSrc = new GuestDnDSrc(this);
int32 x,
int32 y)
{
+ TRACE_CALL();
+
if (!mDnDAllowed) {
- Debug("%s: DnD is not allowed.\n", __FUNCTION__);
+ g_debug("%s: DnD is not allowed.\n", __FUNCTION__);
return;
}
if (GUEST_DND_READY != mDnDState) {
/* Reset DnD for any wrong state. */
- Debug("%s: Bad state: %d\n", __FUNCTION__, mDnDState);
+ g_debug("%s: Bad state: %d\n", __FUNCTION__, mDnDState);
ResetDnD();
return;
}
/* Show detection window to detect pending GH DnD. */
ShowDetWnd(x, y);
- mSessionId = sessionId;
+ SetSessionId(sessionId);
SetState(GUEST_DND_QUERY_EXITING);
- Debug("%s: state changed to QUERY_EXITING, session id changed to %d\n",
- __FUNCTION__, mSessionId);
/*
* Add event to fire and hide our window if a DnD is not pending. Note that
* for some reason.
*/
if (NULL == mUngrabTimeout) {
- Debug("%s: adding UngrabTimeout\n", __FUNCTION__);
+ g_debug("%s: adding UngrabTimeout\n", __FUNCTION__);
mUngrabTimeout = g_timeout_source_new(UNGRAB_TIMEOUT);
VMTOOLSAPP_ATTACH_SOURCE(mToolsAppCtx, mUngrabTimeout, DnDUngrabTimeout, this, NULL);
g_source_unref(mUngrabTimeout);
void
GuestDnDMgr::UngrabTimeout(void)
{
+ TRACE_CALL();
+
mUngrabTimeout = NULL;
if (mDnDState != GUEST_DND_QUERY_EXITING) {
/* Reset DnD for any wrong state. */
- Debug("%s: Bad state: %d\n", __FUNCTION__, mDnDState);
+ g_debug("%s: Bad state: %d\n", __FUNCTION__, mDnDState);
ResetDnD();
return;
}
HideDetWnd();
SetState(GUEST_DND_READY);
- Debug("%s: state changed to GUEST_DND_READY, session id changed to %d\n",
- __FUNCTION__, mSessionId);
}
bool show,
uint32 unityWndId)
{
+ TRACE_CALL();
+
if (show && mDnDState != GUEST_DND_READY) {
/*
* Reset DnD for any wrong state. Only do this when host asked to
* show the window.
*/
- Debug("%s: Bad state: %d\n", __FUNCTION__, mDnDState);
+ g_debug("%s: Bad state: %d\n", __FUNCTION__, mDnDState);
ResetDnD();
return;
}
this,
NULL);
g_source_unref(mUnityDnDDetTimeout);
- mSessionId = sessionId;
- Debug("%s: change sessionId to %d\n", __FUNCTION__, mSessionId);
+ SetSessionId(sessionId);
} else {
/*
* If there is active DnD, the regular detection window will be hidden
/* Show/hide the full screen detection window. */
updateUnityDetWndChanged.emit(show, unityWndId, false);
- Debug("%s: updating Unity detection window, show %d, id %u\n",
- __FUNCTION__, show, unityWndId);
+ g_debug("%s: updating Unity detection window, show %d, id %u\n",
+ __FUNCTION__, show, unityWndId);
}
void
GuestDnDMgr::UnityDnDDetTimeout(void)
{
+ TRACE_CALL();
+
mUnityDnDDetTimeout = NULL;
updateUnityDetWndChanged.emit(true, 0, true);
}
int32 x,
int32 y)
{
+ TRACE_CALL();
+
if (GUEST_DND_SRC_DRAGGING != mDnDState &&
GUEST_DND_PRIV_DRAGGING != mDnDState) {
- Debug("%s: not in valid state %d, ignoring\n", __FUNCTION__, mDnDState);
+ g_debug("%s: not in valid state %d, ignoring\n", __FUNCTION__, mDnDState);
return;
}
- Debug("%s: move to %d, %d\n", __FUNCTION__, x, y);
+ g_debug("%s: move to %d, %d\n", __FUNCTION__, x, y);
moveMouseChanged.emit(x, y);
}
int32 x,
int32 y)
{
+ TRACE_CALL();
+
if (mHideDetWndTimer) {
g_source_destroy(mHideDetWndTimer);
mHideDetWndTimer = NULL;
}
- Debug("%s: %s window at %d, %d\n",
- __FUNCTION__, show ? "show" : "hide", x, y);
+ g_debug("%s: %s window at %d, %d\n", __FUNCTION__, show ? "show" : "hide",
+ x, y);
updateDetWndChanged.emit(show, x, y);
}
void
GuestDnDMgr::DelayHideDetWnd(void)
{
+ TRACE_CALL();
+
if (NULL == mHideDetWndTimer) {
- Debug("%s: add timer to hide detection window.\n", __FUNCTION__);
+ g_debug("%s: add timer to hide detection window.\n", __FUNCTION__);
mHideDetWndTimer = g_timeout_source_new(HIDE_DET_WND_TIMER);
VMTOOLSAPP_ATTACH_SOURCE(mToolsAppCtx, mHideDetWndTimer,
DnDHideDetWndTimer, this, NULL);
g_source_unref(mHideDetWndTimer);
} else {
- Debug("%s: mHideDetWndTimer is not NULL, quit.\n", __FUNCTION__);
+ g_debug("%s: mHideDetWndTimer is not NULL, quit.\n", __FUNCTION__);
}
}
void
GuestDnDMgr::RemoveUngrabTimeout(void)
{
+ TRACE_CALL();
+
if (mUngrabTimeout) {
g_source_destroy(mUngrabTimeout);
mUngrabTimeout = NULL;
void
GuestDnDMgr::SetState(GUEST_DND_STATE state)
{
+#ifdef VMX86_DEVEL
+ static const char* states[] = {
+ "GUEST_DND_INVALID",
+ "GUEST_DND_READY",
+ /* As destination. */
+ "GUEST_DND_QUERY_EXITING",
+ "GUEST_DND_DEST_DRAGGING",
+ /* In private dragging mode. */
+ "GUEST_DND_PRIV_DRAGGING",
+ /* As source. */
+ "GUEST_DND_SRC_DRAGBEGIN_PENDING",
+ "GUEST_DND_SRC_CANCEL_PENDING",
+ "GUEST_DND_SRC_DRAGGING",
+ };
+ g_debug("%s: %s => %s\n", __FUNCTION__, states[mDnDState], states[state]);
+#endif
+
mDnDState = state;
stateChanged.emit(state);
if (GUEST_DND_READY == state) {
void
GuestDnDMgr::VmxDnDVersionChanged(uint32 version)
{
+ TRACE_CALL();
+
g_debug("GuestDnDMgr::%s: enter version %d\n", __FUNCTION__, version);
ASSERT(version >= 3);
void
GuestDnDMgr::OnPingReply(uint32 capabilities)
{
- Debug("%s: dnd ping reply caps are %x\n", __FUNCTION__, capabilities);
+ TRACE_CALL();
+
+ g_debug("%s: dnd ping reply caps are %x\n", __FUNCTION__, capabilities);
mCapabilities = capabilities;
}
ASSERT(mMgr);
ASSERT(clip);
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
/* Setup staging directory. */
mStagingDir = SetupDestDir("");
if (mStagingDir.empty()) {
- Debug("%s: SetupDestDir failed.\n", __FUNCTION__);
+ g_debug("%s: SetupDestDir failed.\n", __FUNCTION__);
return;
}
CPClipboard_Copy(&mClipboard, clip);
mMgr->SetState(GUEST_DND_SRC_DRAGBEGIN_PENDING);
- Debug("%s: state changed to DRAGBEGIN_PENDING\n", __FUNCTION__);
+ g_debug("%s: state changed to DRAGBEGIN_PENDING\n", __FUNCTION__);
mMgr->srcDragBeginChanged.emit(&mClipboard, mStagingDir);
}
{
ASSERT(mMgr);
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
if (mMgr->GetState() != GUEST_DND_SRC_DRAGBEGIN_PENDING) {
/* Reset DnD for any wrong state. */
- Debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
goto error;
}
if (!mMgr->GetRpc()->SrcDragBeginDone(mMgr->GetSessionId())) {
- Debug("%s: SrcDragBeginDone failed\n", __FUNCTION__);
+ g_debug("%s: SrcDragBeginDone failed\n", __FUNCTION__);
goto error;
}
mMgr->SetState(GUEST_DND_SRC_DRAGGING);
- Debug("%s: state changed to DRAGGING\n", __FUNCTION__);
+ g_debug("%s: state changed to DRAGGING\n", __FUNCTION__);
return;
error:
{
ASSERT(mMgr);
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
/* This operation needs a valid session id from controller. */
if (0 == mMgr->GetSessionId()) {
- Debug("%s: can not get a valid session id from controller.\n",
- __FUNCTION__);
+ g_debug("%s: can not get a valid session id from controller.\n",
+ __FUNCTION__);
return;
}
if (!mMgr->GetRpc()->UpdateFeedback(mMgr->GetSessionId(), feedback)) {
- Debug("%s: UpdateFeedback failed\n", __FUNCTION__);
+ g_debug("%s: UpdateFeedback failed\n", __FUNCTION__);
mMgr->ResetDnD();
}
}
ASSERT(mMgr);
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
if (mMgr->GetState() != GUEST_DND_SRC_DRAGGING) {
/* Reset DnD for any wrong state. */
- Debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
goto error;
}
mMgr->srcDropChanged.emit();
sizeof cpName,
cpName);
if (cpNameSize < 0) {
- Debug("%s: Error, could not convert to CPName.\n", __FUNCTION__);
+ g_debug("%s: Error, could not convert to CPName.\n", __FUNCTION__);
goto error;
}
if (!mMgr->GetRpc()->SrcDropDone(sessionId,
(const uint8 *)cpName,
cpNameSize)) {
- Debug("%s: SrcDropDone failed\n", __FUNCTION__);
+ g_debug("%s: SrcDropDone failed\n", __FUNCTION__);
goto error;
}
} else {
/* For non-file formats, the DnD is done. Hide detection window. */
mMgr->HideDetWnd();
mMgr->SetState(GUEST_DND_READY);
- Debug("%s: state changed to READY\n", __FUNCTION__);
+ g_debug("%s: state changed to READY\n", __FUNCTION__);
}
return;
{
ASSERT(mMgr);
- Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
+ g_debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
mMgr->srcCancelChanged.emit();
mMgr->DelayHideDetWnd();
mMgr->SetState(GUEST_DND_READY);
- Debug("%s: state changed to READY\n", __FUNCTION__);
+ g_debug("%s: state changed to READY\n", __FUNCTION__);
}
mMgr->getFilesDoneChanged.emit(success);
mMgr->HideDetWnd();
mMgr->SetState(GUEST_DND_READY);
- Debug("%s: state changed to READY\n", __FUNCTION__);
+ g_debug("%s: state changed to READY\n", __FUNCTION__);
}
mStagingDir += DIRSEPS;
}
free(newDir);
- Debug("%s: destdir: %s", __FUNCTION__, mStagingDir.c_str());
+ g_debug("%s: destdir: %s", __FUNCTION__, mStagingDir.c_str());
return mStagingDir;
} else {
- Debug("%s: destdir not created", __FUNCTION__);
+ g_debug("%s: destdir not created", __FUNCTION__);
return mStagingDir;
}
}
/*********************************************************
- * Copyright (C) 2009 VMware, Inc. All rights reserved.
+ * Copyright (C) 2009-2013 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
#include "dndUIX11.h"
#include "guestDnDCPMgr.hh"
+#include "tracer.hh"
extern "C" {
#include "vmblock.h"
m_destDropTime(0),
mTotalFileSize(0)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
}
DnDUIX11::~DnDUIX11()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (m_detWnd) {
delete m_detWnd;
}
bool
DnDUIX11::Init()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
bool ret = true;
CPClipboard_Init(&m_clipboard);
}
#if defined(DETWNDDEBUG)
-
/*
* This code can only be called when DragDetWnd is derived from
* Gtk::Window. The normal case is that DragDetWnd is an instance of
* Gtk::Invisible, which doesn't implement the methods that SetAttributes
* relies upon.
*/
-
m_detWnd->SetAttributes();
#endif
SetTargetsAndCallbacks();
+#define CONNECT_SIGNAL(_obj, _sig, _cb) \
+ _obj->_sig.connect(sigc::mem_fun(this, &DnDUIX11::_cb))
+
/* Set common layer callbacks. */
- m_DnD->srcDragBeginChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonDragStartCB));
- m_DnD->srcDropChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonSourceDropCB));
- m_DnD->srcCancelChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonSourceCancelCB));
- m_DnD->getFilesDoneChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonSourceFileCopyDoneCB));
-
- m_DnD->destCancelChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonDestCancelCB));
- m_DnD->privDropChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonDestPrivateDropCB));
-
- m_DnD->updateDetWndChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonUpdateDetWndCB));
- m_DnD->moveMouseChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonUpdateMouseCB));
-
- m_DnD->updateUnityDetWndChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonUpdateUnityDetWndCB));
- m_DnD->destMoveDetWndToMousePosChanged.connect(
- sigc::mem_fun(this, &DnDUIX11::CommonMoveDetWndToMousePos));
+ CONNECT_SIGNAL(m_DnD, srcDragBeginChanged, CommonDragStartCB);
+ CONNECT_SIGNAL(m_DnD, srcDropChanged, CommonSourceDropCB);
+ CONNECT_SIGNAL(m_DnD, srcCancelChanged, CommonSourceCancelCB);
+ CONNECT_SIGNAL(m_DnD, destCancelChanged, CommonDestCancelCB);
+ CONNECT_SIGNAL(m_DnD, destMoveDetWndToMousePosChanged, CommonMoveDetWndToMousePos);
+ CONNECT_SIGNAL(m_DnD, getFilesDoneChanged, CommonSourceFileCopyDoneCB);
+ CONNECT_SIGNAL(m_DnD, moveMouseChanged, CommonUpdateMouseCB);
+ CONNECT_SIGNAL(m_DnD, privDropChanged, CommonDestPrivateDropCB);
+ CONNECT_SIGNAL(m_DnD, updateDetWndChanged, CommonUpdateDetWndCB);
+ CONNECT_SIGNAL(m_DnD, updateUnityDetWndChanged, CommonUpdateUnityDetWndCB);
+
/* Set Gtk+ callbacks for source. */
- m_detWnd->signal_drag_begin().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkSourceDragBeginCB));
- m_detWnd->signal_drag_data_get().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkSourceDragDataGetCB));
- m_detWnd->signal_drag_end().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkSourceDragEndCB));
-
- m_detWnd->signal_enter_notify_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkEnterEventCB));
- m_detWnd->signal_leave_notify_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkLeaveEventCB));
- m_detWnd->signal_map_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkMapEventCB));
- m_detWnd->signal_unmap_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkUnmapEventCB));
- m_detWnd->signal_realize().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkRealizeEventCB));
- m_detWnd->signal_unrealize().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkUnrealizeEventCB));
- m_detWnd->signal_motion_notify_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkMotionNotifyEventCB));
- m_detWnd->signal_configure_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkConfigureEventCB));
- m_detWnd->signal_button_press_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkButtonPressEventCB));
- m_detWnd->signal_button_release_event().connect(
- sigc::mem_fun(this, &DnDUIX11::GtkButtonReleaseEventCB));
+ CONNECT_SIGNAL(m_detWnd, signal_drag_begin(), GtkSourceDragBeginCB);
+ CONNECT_SIGNAL(m_detWnd, signal_drag_data_get(), GtkSourceDragDataGetCB);
+ CONNECT_SIGNAL(m_detWnd, signal_drag_end(), GtkSourceDragEndCB);
+ CONNECT_SIGNAL(m_detWnd, signal_enter_notify_event(), GtkEnterEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_leave_notify_event(), GtkLeaveEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_map_event(), GtkMapEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_unmap_event(), GtkUnmapEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_realize(), GtkRealizeEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_unrealize(), GtkUnrealizeEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_motion_notify_event(), GtkMotionNotifyEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_configure_event(), GtkConfigureEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_button_press_event(), GtkButtonPressEventCB);
+ CONNECT_SIGNAL(m_detWnd, signal_button_release_event(), GtkButtonReleaseEventCB);
+
+#undef CONNECT_SIGNAL
CommonUpdateDetWndCB(false, 0, 0);
CommonUpdateUnityDetWndCB(false, 0, false);
void
DnDUIX11::SetTargetsAndCallbacks()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
/* Construct supported target list for HG DnD. */
std::list<Gtk::TargetEntry> targets;
void
DnDUIX11::CommonResetCB(void)
{
- g_debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
m_GHDnDDataReceived = false;
m_HGGetFileStatus = DND_FILE_TRANSFER_NOT_STARTED;
m_GHDnDInProgress = false;
CPClipboard_Clear(&m_clipboard);
CPClipboard_Copy(&m_clipboard, clip);
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
/*
* Before the DnD, we should make sure that the mouse is released
void
DnDUIX11::CommonSourceCancelCB(void)
{
- g_debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
/*
* Force the window to show, position the mouse over it, and release.
DnDUIX11::CommonDestPrivateDropCB(int32 x,
int32 y)
{
- g_debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
/* Unity manager in host side may already send the drop into guest. */
if (m_GHDnDInProgress) {
void
DnDUIX11::CommonDestCancelCB(void)
{
- g_debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
/* Unity manager in host side may already send the drop into guest. */
if (m_GHDnDInProgress) {
CommonUpdateDetWndCB(true, 0, 0);
void
DnDUIX11::CommonSourceDropCB(void)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
CommonUpdateDetWndCB(true, 0, 0);
/*
int winYReturn;
unsigned int maskReturn;
+ TRACE_CALL();
+
x = xCoord;
y = yCoord;
void
DnDUIX11::AddBlock()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
if (m_blockAdded) {
g_debug("%s: block already added\n", __FUNCTION__);
return;
void
DnDUIX11::RemoveBlock()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
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. */
void
DnDUIX11::SourceDragStartDone(void)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
m_inHGDrag = true;
m_DnD->SrcUIDragBeginDone();
}
void
DnDUIX11::SourceUpdateFeedback(DND_DROPEFFECT effect)
{
- g_debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
m_DnD->SrcUIUpdateFeedback(effect);
}
void
DnDUIX11::TargetDragEnter(void)
{
- g_debug("%s: entering\n", __FUNCTION__);
+ TRACE_CALL();
/* Check if there is valid data with current detection window. */
if (!CPClipboard_IsEmpty(&m_clipboard)) {
bool
DnDUIX11::GtkEnterEventCB(GdkEventCrossing *ignored)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool
DnDUIX11::GtkLeaveEventCB(GdkEventCrossing *ignored)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool
DnDUIX11::GtkMapEventCB(GdkEventAny *event)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool
DnDUIX11::GtkUnmapEventCB(GdkEventAny *event)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
void
DnDUIX11::GtkRealizeEventCB()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
}
void
DnDUIX11::GtkUnrealizeEventCB()
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
}
/**
bool
DnDUIX11::GtkButtonPressEventCB(GdkEventButton *event)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}
bool
DnDUIX11::GtkButtonReleaseEventCB(GdkEventButton *event)
{
- g_debug("%s: enter\n", __FUNCTION__);
+ TRACE_CALL();
return true;
}