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

« back to all changes in this revision

Viewing changes to services/plugins/dndcp/dndUIX11.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) 2009 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
 * @file dndUIX11.h
 
21
 *
 
22
 *    Implement the methods that allow DnD between host and guest for
 
23
 *    protocols V3 or greater.
 
24
 *
 
25
 */
 
26
 
 
27
#ifndef __DND_UI_X11_H__
 
28
#define __DND_UI_X11_H__
 
29
 
 
30
#include "stringxx/string.hh"
 
31
 
 
32
extern "C" {
 
33
#include "debug.h"
 
34
#include "dnd.h"
 
35
#include "str.h"
 
36
#include "util.h"
 
37
#include "vmblock.h"
 
38
#include "dndClipboard.h"
 
39
#include "dynbuf.h"
 
40
#include "../dnd/dndFileContentsUtil.h"
 
41
#include "dynxdr.h"
 
42
#include "cpNameUtil.h"
 
43
#include "posix.h"
 
44
#include "vmware/tools/guestrpc.h"
 
45
#include "vmware/tools/plugin.h"
 
46
}
 
47
 
 
48
#include "guestDnD.hh"
 
49
#include "dndFileList.hh"
 
50
#include "dragDetWndX11.h"
 
51
 
 
52
struct DblLnkLst_Links;
 
53
 
 
54
/**
 
55
 * The DnDUI class implements the UI portion of DnD V3 and greater
 
56
 * versions of the protocol.
 
57
 */
 
58
class DnDUIX11
 
59
   : public sigc::trackable
 
60
{
 
61
public:
 
62
   DnDUIX11(ToolsAppCtx *ctx);
 
63
   ~DnDUIX11();
 
64
   bool Init();
 
65
   void VmxDnDVersionChanged(RpcChannel *chan, uint32 version);
 
66
   void SetDnDAllowed(bool isDnDAllowed)
 
67
      {ASSERT(m_DnD); m_DnD->SetDnDAllowed(isDnDAllowed);}
 
68
   void SetBlockControl(DnDBlockControl *blockCtrl);
 
69
   void SetUnityMode(Bool mode)
 
70
      {m_unityMode = mode;};
 
71
 
 
72
   DragDetWnd *GetFullDetWnd() {return m_detWnd;}
 
73
   GtkWidget *GetDetWndAsWidget();
 
74
 
 
75
private:
 
76
 
 
77
   /**
 
78
    * Blocking FS Helper Functions.
 
79
    */
 
80
   void AddBlock();
 
81
   void RemoveBlock();
 
82
 
 
83
   bool TryXTestFakeDeviceButtonEvent(void);
 
84
 
 
85
   /**
 
86
    * Callbacks from Common DnD layer.
 
87
    */
 
88
   void CommonResetCB();
 
89
   void CommonUpdateMouseCB(int32 x, int32 y);
 
90
 
 
91
   /**
 
92
    * Source functions for HG DnD.
 
93
    */
 
94
   void CommonDragStartCB(const CPClipboard *clip, std::string stagingDir);
 
95
   void CommonSourceDropCB(void);
 
96
 
 
97
   /**
 
98
    * Called when HG Dnd is completed.
 
99
    */
 
100
   void CommonSourceCancelCB(void);
 
101
 
 
102
   /**
 
103
    * Called when GH DnD is completed.
 
104
    */
 
105
   void CommonDestPrivateDropCB(int32 x, int32 y);
 
106
   void CommonDestCancelCB(void);
 
107
 
 
108
   /**
 
109
    * Source functions for file transfer.
 
110
    */
 
111
   void CommonSourceFileCopyDoneCB(bool success);
 
112
 
 
113
   /**
 
114
    * Callbacks for showing/hiding detection window.
 
115
    */
 
116
   void CommonUpdateDetWndCB(bool bShow, int32 x, int32 y);
 
117
   void CommonUpdateUnityDetWndCB(bool bShow, uint32 unityWndId, bool bottom);
 
118
   void CommonMoveDetWndToMousePos(void);
 
119
 
 
120
   /**
 
121
    * Gtk+ Callbacks: Drag Destination.
 
122
    */
 
123
   void GtkDestDragDataReceivedCB(const Glib::RefPtr<Gdk::DragContext> &dc,
 
124
                                  int x, int y, const Gtk::SelectionData &sd,
 
125
                                  guint info, guint time);
 
126
   bool GtkDestDragDropCB(const Glib::RefPtr<Gdk::DragContext> &dc,
 
127
                          int x, int y, guint time);
 
128
   void GtkDestDragLeaveCB(const Glib::RefPtr<Gdk::DragContext> &dc,
 
129
                           guint time);
 
130
   bool GtkDestDragMotionCB(const Glib::RefPtr<Gdk::DragContext> &dc, int x,
 
131
                            int y, guint time);
 
132
 
 
133
   /**
 
134
    * Gtk+ Callbacks: Drag Source.
 
135
    */
 
136
   void GtkSourceDragBeginCB(const Glib::RefPtr<Gdk::DragContext>& context);
 
137
   void GtkSourceDragDataGetCB(const Glib::RefPtr<Gdk::DragContext>& context,
 
138
                               Gtk::SelectionData& selection_data, guint info,
 
139
                               guint time);
 
140
   void GtkSourceDragEndCB(const Glib::RefPtr<Gdk::DragContext>& context);
 
141
   /**
 
142
    * Source functions for HG DnD. Makes calls to common layer.
 
143
    */
 
144
   void SourceDragStartDone(void);
 
145
   void SourceUpdateFeedback(DND_DROPEFFECT effect);
 
146
 
 
147
   /**
 
148
    * Target function for GH DnD. Makes call to common layer.
 
149
    */
 
150
   void TargetDragEnter(void);
 
151
 
 
152
   /*
 
153
    * Other signal handlers for tracing.
 
154
    */
 
155
 
 
156
   bool GtkEnterEventCB(GdkEventCrossing *event);
 
157
   bool GtkLeaveEventCB(GdkEventCrossing *event);
 
158
   bool GtkMapEventCB(GdkEventAny *event);
 
159
   bool GtkUnmapEventCB(GdkEventAny *event);
 
160
   void GtkRealizeEventCB();
 
161
   void GtkUnrealizeEventCB();
 
162
   bool GtkMotionNotifyEventCB(GdkEventMotion *event);
 
163
   bool GtkConfigureEventCB(GdkEventConfigure *event);
 
164
   bool GtkButtonPressEventCB(GdkEventButton *event);
 
165
   bool GtkButtonReleaseEventCB(GdkEventButton *event);
 
166
 
 
167
   /**
 
168
    * Misc methods.
 
169
    */
 
170
   bool SetCPClipboardFromGtk(const Gtk::SelectionData& sd);
 
171
   bool RequestData(const Glib::RefPtr<Gdk::DragContext> &dc,
 
172
                    guint timeValue);
 
173
   std::string GetLastDirName(const std::string &str);
 
174
   utf::utf8string GetNextPath(utf::utf8string &str, size_t& index);
 
175
   DND_DROPEFFECT ToDropEffect(Gdk::DragAction action);
 
176
   void SetTargetsAndCallbacks();
 
177
   bool SendFakeXEvents(const bool showWidget, const bool buttonEvent,
 
178
                        const bool buttonPress, const bool moveWindow,
 
179
                        const bool coordsProvided,
 
180
                        const int xCoord, const int yCoord);
 
181
   bool SendFakeMouseMove(const int x, const int y);
 
182
   bool WriteFileContentsToStagingDir();
 
183
   unsigned long GetTimeInMillis();
 
184
 
 
185
   ToolsAppCtx *m_ctx;
 
186
   GuestDnDMgr *m_DnD;
 
187
   std::string m_HGStagingDir;
 
188
   utf::string m_HGFileContentsUriList;
 
189
   DragDetWnd *m_detWnd;
 
190
   CPClipboard m_clipboard;
 
191
   DnDBlockControl *m_blockCtrl;
 
192
   bool m_HGGetDataInProgress;
 
193
   int m_HGEffect;
 
194
   bool m_blockAdded;
 
195
 
 
196
   /* State to determine if drag motion is a drag enter. */
 
197
   bool m_GHDnDInProgress;
 
198
   /* Icon updates from the guest. */
 
199
   /* Only update mouse when we have clipboard contents from the host. */
 
200
   bool m_GHDnDDataReceived;
 
201
   bool m_GHDnDDropOccurred;
 
202
   bool m_unityMode;
 
203
   bool m_inHGDrag;
 
204
   DND_DROPEFFECT m_effect;
 
205
   bool m_fileTransferStarted;
 
206
   int32 m_mousePosX;
 
207
   int32 m_mousePosY;
 
208
   GdkDragContext *m_dc;
 
209
   int m_numPendingRequest;
 
210
   unsigned long m_destDropTime;
 
211
};
 
212
 
 
213
#endif // __DND_UI_X11_H__