~ubuntu-branches/ubuntu/precise/open-vm-tools/precise

« back to all changes in this revision

Viewing changes to services/plugins/dndcp/dndGuest/guestDnD.hh

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-03-31 14:20:05 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110331142005-3n9red91p7ogkweo
Tags: 2011.03.28-387002-0ubuntu1
* Merge latest upstream git tag.  This has the unlocked_ioctl change
  needed to fix dkms build failures (LP: #727342)
* Changes in debian/rules:
  - work around a bug in toolbox/Makefile, where install-exec-hook is
    not happening.  This needs to get fixed the right way.
  - don't install 'vmware-user' which seems to no longer exist
  - move /etc/xdg into open-vm-toolbox (which should be done using .install)
* debian/open-vm-tools.init: add 'modprobe [-r] vmblock'. (LP: #332323)
* debian/rules and debian/open-vm-toolbox.lintian-overrides:
  - Make vmware-user-suid-wrapper suid-root (LP: #332323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************
 
2
 * Copyright (C) 2010 VMware, Inc. All rights reserved.
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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.
 
16
 *
 
17
 *********************************************************/
 
18
 
 
19
/**
 
20
 * @guestDnD.hh --
 
21
 *
 
22
 * DnD common layer classes for guest.
 
23
 */
 
24
 
 
25
#ifndef GUEST_DND_HH
 
26
#define GUEST_DND_HH
 
27
 
 
28
#include <sigc++/trackable.h>
 
29
#include "dndRpcV4.hh"
 
30
#include "guestFileTransfer.hh"
 
31
 
 
32
#include "capsProvider.h"
 
33
 
 
34
#include <string>
 
35
 
 
36
extern "C" {
 
37
   #include "dnd.h"
 
38
   #include "vmware/tools/plugin.h"
 
39
}
 
40
 
 
41
enum GUEST_DND_STATE {
 
42
   GUEST_DND_INVALID = 0,
 
43
   GUEST_DND_READY,
 
44
   /* As destination. */
 
45
   GUEST_DND_QUERY_EXITING,
 
46
   GUEST_DND_DEST_DRAGGING,
 
47
   /* In private dragging mode. */
 
48
   GUEST_DND_PRIV_DRAGGING,
 
49
   /* As source. */
 
50
   GUEST_DND_SRC_DRAGBEGIN_PENDING,
 
51
   GUEST_DND_SRC_CANCEL_PENDING,
 
52
   GUEST_DND_SRC_DRAGGING,
 
53
};
 
54
 
 
55
class GuestDnDSrc;
 
56
class GuestDnDDest;
 
57
 
 
58
class GuestDnDMgr
 
59
   : public sigc::trackable, public CapsProvider
 
60
{
 
61
public:
 
62
   GuestDnDMgr(DnDCPTransport *transport,
 
63
               ToolsAppCtx *ctx);
 
64
   ~GuestDnDMgr(void);
 
65
 
 
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;
 
70
 
 
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;
 
75
 
 
76
   sigc::signal<void> destCancelChanged;
 
77
   sigc::signal<void, int32, int32> privDropChanged;
 
78
   sigc::signal<void> destMoveDetWndToMousePosChanged;
 
79
 
 
80
   GuestDnDSrc *GetDnDSrc(void) { return mSrc; }
 
81
   GuestDnDDest *GetDnDDest(void) { return mDest; }
 
82
 
 
83
   /* Common DnD layer API exposed to UI (all platforms) for DnD source. */
 
84
   void SrcUIDragBeginDone(void);
 
85
   void SrcUIUpdateFeedback(DND_DROPEFFECT feedback);
 
86
 
 
87
   void DestUIDragEnter(const CPClipboard *clip);
 
88
   DnDRpc *GetRpc(void) { return mRpc; }
 
89
 
 
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; }
 
98
   void ResetDnD(void);
 
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);
 
109
private:
 
110
   void OnRpcSrcDragBegin(uint32 sessionId,
 
111
                          const CPClipboard *clip);
 
112
   void OnRpcQueryExiting(uint32 sessionId, int32 x, int32 y);
 
113
   void OnRpcUpdateUnityDetWnd(uint32 sessionId,
 
114
                               bool show,
 
115
                               uint32 unityWndId);
 
116
   void OnRpcMoveMouse(uint32 sessionId,
 
117
                       int32 x,
 
118
                       int32 y);
 
119
   void OnPingReply(uint32 capabilities);
 
120
 
 
121
   GuestDnDSrc *mSrc;
 
122
   GuestDnDDest *mDest;
 
123
   DnDRpc *mRpc;
 
124
   GuestFileTransfer *mFileTransfer;
 
125
   GUEST_DND_STATE mDnDState;
 
126
   uint32 mSessionId;
 
127
   GSource *mHideDetWndTimer;
 
128
   GSource *mUnityDnDDetTimeout;
 
129
   GSource *mUngrabTimeout;
 
130
   ToolsAppCtx *mToolsAppCtx;
 
131
   bool mDnDAllowed;
 
132
   uint32 mVmxDnDVersion;
 
133
   DnDCPTransport *mDnDTransport;
 
134
   uint32 mCapabilities;
 
135
};
 
136
 
 
137
 
 
138
class GuestDnDSrc
 
139
   : public sigc::trackable
 
140
{
 
141
public:
 
142
   GuestDnDSrc(GuestDnDMgr *mgr);
 
143
   ~GuestDnDSrc(void);
 
144
 
 
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);
 
149
 
 
150
private:
 
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,
 
156
                          bool success,
 
157
                          const uint8 *stagingDirCP,
 
158
                          uint32 sz);
 
159
   const std::string& SetupDestDir(const std::string &destDir);
 
160
 
 
161
   GuestDnDMgr *mMgr;
 
162
   DnDRpc *mRpc;
 
163
   std::string mStagingDir;
 
164
   CPClipboard mClipboard;
 
165
};
 
166
 
 
167
class GuestDnDDest
 
168
   : public sigc::trackable
 
169
{
 
170
public:
 
171
   GuestDnDDest(GuestDnDMgr *mgr);
 
172
   ~GuestDnDDest(void);
 
173
 
 
174
   /* Common DnD layer API exposed to UI (all platforms) for DnD destination. */
 
175
   void UIDragEnter(const CPClipboard *clip);
 
176
 
 
177
private:
 
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);
 
184
 
 
185
   GuestDnDMgr *mMgr;
 
186
   DnDRpc *mRpc;
 
187
   CPClipboard mClipboard;
 
188
};
 
189
 
 
190
#endif // GUEST_DND_HH
 
191