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

« back to all changes in this revision

Viewing changes to lib/include/dndBase.h

  • 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) 2007 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
 
 * dndBase.h --
21
 
 *
22
 
 *     Base object for DnD. This is the common interface between UI and 
23
 
 *     cui DnD protocol layer. Both host side and guest side, and also
24
 
 *     different platforms, share this same interface.
25
 
 */
26
 
 
27
 
#ifndef DND_BASE_H
28
 
#define DND_BASE_H
29
 
 
30
 
#include <sigc++/connection.h>
31
 
#include <vector>
32
 
 
33
 
#ifdef VMX86_TOOLS
34
 
   /*
35
 
    * LIB_EXPORT definition is not needed on guest. 
36
 
    */
37
 
#   define LIB_EXPORT
38
 
#else
39
 
   /*
40
 
    * The interface class on host side for Windows is in dll which needs
41
 
    * LIB_EXPORT definition. 
42
 
    */
43
 
#   include "libExport.hh"
44
 
#endif
45
 
 
46
 
extern "C" {
47
 
#include "dnd.h"
48
 
#include "unityCommon.h"
49
 
}
50
 
 
51
 
class LIB_EXPORT DnDBase
52
 
{
53
 
   public:
54
 
      virtual ~DnDBase(void) {};
55
 
 
56
 
      /* sigc signals for local UI callbacks. */
57
 
      /* Local UI as DnD source. */
58
 
      sigc::signal<void, const CPClipboard*> dragExitChanged;
59
 
      sigc::signal<void> dndUngrabChanged; /* X11's notion of ungrab. */
60
 
      sigc::signal<void, bool, std::vector<uint8> > fileCopyDoneChanged;
61
 
      sigc::signal<void> sourceDropChanged;
62
 
      sigc::signal<void> sourceCancelChanged;
63
 
      sigc::signal<void, const CPClipboard*, std::string> dragStartChanged;
64
 
 
65
 
      /* Local UI as DnD target. */
66
 
      sigc::signal<void, DND_DROPEFFECT> updateFeedbackChanged;
67
 
      sigc::signal<void, bool, int, int> updateDetWndChanged;
68
 
      sigc::signal<void, bool, uint32, bool> updateUnityDetWndChanged;
69
 
      sigc::signal<void, int32, int32> targetPrivateDropChanged;
70
 
 
71
 
      sigc::signal<void> reset;
72
 
      sigc::signal<void> disable;
73
 
      sigc::signal<void> enable;
74
 
      sigc::signal<void, int, int> updateMouseChanged;
75
 
      sigc::signal<void> moveDetWndToMousePos;
76
 
 
77
 
      /* Guest cancel signals. */
78
 
      sigc::signal<void> ghCancel;
79
 
 
80
 
      /* cui DnD protocol layer API exposed to UI (all platforms). */
81
 
 
82
 
      /* Local UI as DnD source. */
83
 
      virtual void UpdateUnityDetWnd(bool bShow, uint32 unityWndId) {};
84
 
      virtual void DragLeave(int32 x, int32 y) = 0;
85
 
      virtual void SourceCancel(void) = 0;
86
 
      virtual void SourceDrop(DND_DROPEFFECT feedback) = 0;
87
 
 
88
 
      /* Local UI as DnD target. */
89
 
      virtual void DragEnter(const CPClipboard* clip) = 0;
90
 
      /* Host only. */
91
 
      virtual void SetMouse(int32 x, int32 y, bool down = true) = 0;
92
 
      /* Guest only. */
93
 
      virtual void SetFeedback(DND_DROPEFFECT feedback) = 0;
94
 
      virtual void TargetCancel(void) = 0;
95
 
      virtual void TargetDrop(const CPClipboard *clip,
96
 
                              int32 x,
97
 
                              int32 y) = 0;
98
 
 
99
 
      const CPClipboard* GetClipboard(void) { return &mClipboard; }
100
 
 
101
 
      virtual bool IsDnDAllowed(void) = 0;
102
 
 
103
 
   protected:
104
 
      /*
105
 
       * For details about state machine definition, please refer to
106
 
       * https://wiki.eng.vmware.com/ToolsDnDV3FlowChart
107
 
       */
108
 
      enum DND_STATE {
109
 
         DNDSTATE_INVALID = 0,
110
 
         DNDSTATE_READY,
111
 
         /* H->G */
112
 
         DNDSTATE_ENTERING,
113
 
         DNDSTATE_STARTING,
114
 
         DNDSTATE_DRAGGING_INSIDE,
115
 
         /* G->H */
116
 
         DNDSTATE_QUERY_EXITING,
117
 
         DNDSTATE_UNGRABING, // ask mks to ungrab, v2 only
118
 
         DNDSTATE_DRAGGING_OUTSIDE,
119
 
         DNDSTATE_DRAGGING_PRIVATE,
120
 
      };
121
 
 
122
 
      DND_STATE mState;
123
 
      DND_DROPEFFECT mFeedback;
124
 
      CPClipboard mClipboard;
125
 
};
126
 
 
127
 
#endif // DND_BASE_H
128