~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to services/plugins/dndcp/dndGuest/guestCopyPasteDest.cc

  • 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
 * @guestCopyPasteDest.cc --
 
21
 *
 
22
 * Implementation of common layer GuestCopyPasteDest object for guest.
 
23
 */
 
24
 
 
25
#include "guestCopyPaste.hh"
 
26
 
 
27
extern "C" {
 
28
   #include "dndClipboard.h"
 
29
   #include "debug.h"
 
30
}
 
31
 
 
32
 
 
33
/**
 
34
 * Constructor.
 
35
 *
 
36
 * @param[in] mgr guest CP manager
 
37
 */
 
38
 
 
39
GuestCopyPasteDest::GuestCopyPasteDest(GuestCopyPasteMgr *mgr)
 
40
 : mMgr(mgr)
 
41
{
 
42
   ASSERT(mMgr);
 
43
}
 
44
 
 
45
 
 
46
/**
 
47
 * Got valid clipboard data from UI. Send sendClip cmd to controller.
 
48
 *
 
49
 * @param[in] clip cross-platform clipboard data.
 
50
 */
 
51
 
 
52
void
 
53
GuestCopyPasteDest::UISendClip(const CPClipboard *clip)
 
54
{
 
55
   ASSERT(clip);
 
56
 
 
57
   Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
 
58
   if (mMgr->GetState() != GUEST_CP_READY) {
 
59
      /* Reset DnD for any wrong state. */
 
60
      Debug("%s: Bad state: %d\n", __FUNCTION__, mMgr->GetState());
 
61
      goto error;
 
62
   }
 
63
 
 
64
   if (!mMgr->GetRpc()->DestSendClip(mMgr->GetSessionId(), mIsActive, clip)) {
 
65
      Debug("%s: DestSendClip failed\n", __FUNCTION__);
 
66
      goto error;
 
67
   }
 
68
 
 
69
   return;
 
70
 
 
71
error:
 
72
   mMgr->ResetCopyPaste();
 
73
}
 
74
 
 
75
 
 
76
/**
 
77
 * Host is asking for clipboard data. Emit destRequestClipChanged signal.
 
78
 *
 
79
 * @param[in] isActive active or passive CopyPaste.
 
80
 */
 
81
 
 
82
void
 
83
GuestCopyPasteDest::OnRpcRequestClip(bool isActive)
 
84
{
 
85
   mIsActive = isActive;
 
86
   Debug("%s: state is %d\n", __FUNCTION__, mMgr->GetState());
 
87
   mMgr->destRequestClipChanged.emit();
 
88
}
 
89