1
/*********************************************************
2
* Copyright (C) 2010 VMware, Inc. All rights reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License as published
6
* by the Free Software Foundation version 2.1 and no later version.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
* or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
11
* License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*********************************************************/
22
* DnD common layer classes for guest.
28
#include <sigc++/trackable.h>
29
#include "dndRpcV4.hh"
30
#include "guestFileTransfer.hh"
32
#include "capsProvider.h"
38
#include "vmware/tools/plugin.h"
41
enum GUEST_DND_STATE {
42
GUEST_DND_INVALID = 0,
45
GUEST_DND_QUERY_EXITING,
46
GUEST_DND_DEST_DRAGGING,
47
/* In private dragging mode. */
48
GUEST_DND_PRIV_DRAGGING,
50
GUEST_DND_SRC_DRAGBEGIN_PENDING,
51
GUEST_DND_SRC_CANCEL_PENDING,
52
GUEST_DND_SRC_DRAGGING,
59
: public sigc::trackable, public CapsProvider
62
GuestDnDMgr(DnDCPTransport *transport,
66
sigc::signal<void, int, int> moveMouseChanged;
67
sigc::signal<void, bool, int, int> updateDetWndChanged;
68
sigc::signal<void, bool, uint32, bool> updateUnityDetWndChanged;
69
sigc::signal<void, GUEST_DND_STATE> stateChanged;
71
sigc::signal<void, const CPClipboard*, std::string> srcDragBeginChanged;
72
sigc::signal<void> srcDropChanged;
73
sigc::signal<void> srcCancelChanged;
74
sigc::signal<void, bool> getFilesDoneChanged;
76
sigc::signal<void> destCancelChanged;
77
sigc::signal<void, int32, int32> privDropChanged;
78
sigc::signal<void> destMoveDetWndToMousePosChanged;
80
GuestDnDSrc *GetDnDSrc(void) { return mSrc; }
81
GuestDnDDest *GetDnDDest(void) { return mDest; }
83
/* Common DnD layer API exposed to UI (all platforms) for DnD source. */
84
void SrcUIDragBeginDone(void);
85
void SrcUIUpdateFeedback(DND_DROPEFFECT feedback);
87
void DestUIDragEnter(const CPClipboard *clip);
88
DnDRpc *GetRpc(void) { return mRpc; }
90
GUEST_DND_STATE GetState(void) { return mDnDState; }
91
void SetState(GUEST_DND_STATE state);
92
void UpdateDetWnd(bool show, int32 x, int32 y);
93
void HideDetWnd(void) { UpdateDetWnd(false, 0, 0); }
94
void ShowDetWnd(int32 x, int32 y) { UpdateDetWnd(true, x, y); }
95
void UnityDnDDetTimeout(void);
96
uint32 GetSessionId(void) { return mSessionId; }
97
void SetSessionId(uint32 id) { mSessionId = id; }
99
void DelayHideDetWnd(void);
100
void SetHideDetWndTimer(GSource *gs) { mHideDetWndTimer = gs; }
101
void UngrabTimeout(void);
102
void RemoveUngrabTimeout(void);
103
bool IsDnDAllowed (void) { return mDnDAllowed; }
104
void SetDnDAllowed(bool isDnDAllowed)
105
{ mDnDAllowed = isDnDAllowed;}
106
void VmxDnDVersionChanged(uint32 version);
107
bool IsDragEnterAllowed(void);
108
Bool CheckCapability(uint32 capsRequest);
110
void OnRpcSrcDragBegin(uint32 sessionId,
111
const CPClipboard *clip);
112
void OnRpcQueryExiting(uint32 sessionId, int32 x, int32 y);
113
void OnRpcUpdateUnityDetWnd(uint32 sessionId,
116
void OnRpcMoveMouse(uint32 sessionId,
119
void OnPingReply(uint32 capabilities);
124
GuestFileTransfer *mFileTransfer;
125
GUEST_DND_STATE mDnDState;
127
GSource *mHideDetWndTimer;
128
GSource *mUnityDnDDetTimeout;
129
GSource *mUngrabTimeout;
130
ToolsAppCtx *mToolsAppCtx;
132
uint32 mVmxDnDVersion;
133
DnDCPTransport *mDnDTransport;
134
uint32 mCapabilities;
139
: public sigc::trackable
142
GuestDnDSrc(GuestDnDMgr *mgr);
145
/* Common DnD layer API exposed to UI (all platforms) for DnD source. */
146
void UIDragBeginDone(void);
147
void UIUpdateFeedback(DND_DROPEFFECT feedback);
148
void OnRpcDragBegin(const CPClipboard *clip);
151
/* Callbacks from rpc for DnD source. */
152
void OnRpcUpdateMouse(uint32 sessionId, int32 x, int32 y);
153
void OnRpcDrop(uint32 sessionId, int32 x, int32 y);
154
void OnRpcCancel(uint32 sessionId);
155
void OnRpcGetFilesDone(uint32 sessionId,
157
const uint8 *stagingDirCP,
159
const std::string& SetupDestDir(const std::string &destDir);
163
std::string mStagingDir;
164
CPClipboard mClipboard;
168
: public sigc::trackable
171
GuestDnDDest(GuestDnDMgr *mgr);
174
/* Common DnD layer API exposed to UI (all platforms) for DnD destination. */
175
void UIDragEnter(const CPClipboard *clip);
178
/* Callbacks from rpc for DnD destination. */
179
void OnRpcPrivDragEnter(uint32 sessionId);
180
void OnRpcPrivDragLeave(uint32 sessionId, int32 x, int32 y);
181
void OnRpcPrivDrop(uint32 sessionId, int32 x, int32 y);
182
void OnRpcDrop(uint32 sessionId, int32 x, int32 y);
183
void OnRpcCancel(uint32 sessionId);
187
CPClipboard mClipboard;
190
#endif // GUEST_DND_HH