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

« back to all changes in this revision

Viewing changes to services/plugins/unity/unityPluginPosix.cpp

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-01-23 16:09:45 UTC
  • mfrom: (1.4.6) (2.4.26 sid)
  • Revision ID: package-import@ubuntu.com-20120123160945-b6s0r1vkcovucpf3
Tags: 2011.12.20-562307-0ubuntu1
* Merge latest upstream git tag. Fixes building on Precise
  (LP: #898289, LP: #905612)

* Items merged from Debian unstable:
  - debian/control:
    + open-vm-tools recommends open-vm-dkms. (LP: #598933)
    + open-vm-tools now suggests open-vm-toolbox. (LP: #604998)
  (From 2011.08.21-471295-1 release)
  - Updating maintainer and uploaders fields.
  - Removing vcs fields.
  - Removing references to Daniel's old email address.
  - Updating years in copyright file.
  - Updating to standards version 3.9.2.
  - Updating to debhelper version 8.
  - Switching to source format 3.0 (quilt).
  - Removing manual chrpath setting.
  - Removing exclusion from plugins from debhelper shlibs.
  - Rediffing kvers.patch.
  (From 2011.09.23-491607-1 release)
  - Marking binary architecture-dependend packages as linux and kfreebsd
  only.
  - Removing liburiparser-dev from build-depends as upstream dropped
  unity support.
  - Building with libproc-dev on amd64 again.
  - Dropping disabling of dnet support.
  (From 2011.09.23-491607-2 release)
  - Adding doxygen to build-depends for api documentation.
  - Adding libcunit1-dev to build-depends for test suites.
  - Minimizing rules file.
  - Adding open-vm-tools-dev package, containing only the api
    documentation for now.
  (From 2011.09.23-491607-3 release)
  - Sorting overrides in rules alphabetically.
  - Compacting copyright file.
  - Adding udev rule to set timeout for vmware scsi devices
  (From 2011.12.20-562307-1 release)
  - Adding patch to correct typo in upstreams dkms configuration

* Remaining Changes:
  - Remove Stable part of version numbering.
  - debian folder:
    + Re-added open-vm-dkms.postinst & open-vm-dkms.prerm.
      * Allows dkms modules to compile upon installation.
  - debian/control:
    + Re-add open-vm-source and make into a transitional package
      for open-vm-toolbox.
    + Return dependancies that were moved to open-vm-tools back to
      open-vm-toolbox.
  - debian/rules and debian/open-vm-toolbox.lintian-overrides:
    + Make vmware-user-suid-wrapper suid-root
  - debian/rules:
    + Added CFLAGS field with -Wno-deprecated-declarations
      * Will suppress issues with glib 2.31 or later.
    + Add line to copy vmware-xdg-detect-de into place.
    + Install vmware-user.desktop through toolbox package.
  - debian/open-vm-tools.init:
    + Re-add 'modprobe [-r] vmblock'.
    + Add 'modprobe [-r] vmxnet'.
      * Incase it's not loaded during boot.
    + Remove and re-add pcnet32 module
      * Will be done before (remove) and after (readd) vmxnet module
        is added.
      * If vmxnet doesn't exist (aka modules fail to build), pcnet32 can be
        still used for network connectivity.
      * Workaround until a better fix can be done.
  - Re-add gnome-session to debian/local/xautostart.conf
  - Manpages removed (from debian/manpages):
    + vmmemctl.9
    + vmxnet3.9
    + Remove references to manpages that have been removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*********************************************************
2
 
 * Copyright (C) 2011 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
 
 * unityPluginPosix.cpp --
21
 
 *
22
 
 *    POSIX subclass of UnityPlugin interface.
23
 
 */
24
 
 
25
 
 
26
 
#include "unityPluginPosix.h"
27
 
 
28
 
 
29
 
extern "C" {
30
 
#include <glib-object.h>
31
 
 
32
 
#include "vmware/tools/desktopevents.h"
33
 
#if defined(OPEN_VM_TOOLS)
34
 
   #include "unitylib/unity.h"
35
 
#else
36
 
   #include "unity.h"
37
 
#endif // OPEN_VM_TOOLS
38
 
}
39
 
 
40
 
 
41
 
namespace vmware {
42
 
namespace tools {
43
 
 
44
 
 
45
 
/*
46
 
 *-----------------------------------------------------------------------------
47
 
 *
48
 
 * UnityPluginPosix::UnityPluginPosix --
49
 
 *
50
 
 *      Constructor.
51
 
 *
52
 
 * Results:
53
 
 *      None.
54
 
 *
55
 
 * Side effects:
56
 
 *      None.
57
 
 *
58
 
 *-----------------------------------------------------------------------------
59
 
 */
60
 
 
61
 
UnityPluginPosix::UnityPluginPosix(const ToolsAppCtx* ctx) // IN: The app context.
62
 
   : UnityPlugin(ctx)
63
 
{
64
 
}
65
 
 
66
 
 
67
 
/*
68
 
 *-----------------------------------------------------------------------------
69
 
 *
70
 
 * UnityPluginPosix::~UnityPluginPosix --
71
 
 *
72
 
 *      Destructor.
73
 
 *
74
 
 * Results:
75
 
 *      None.
76
 
 *
77
 
 * Side effects:
78
 
 *      None.
79
 
 *
80
 
 *-----------------------------------------------------------------------------
81
 
 */
82
 
 
83
 
UnityPluginPosix::~UnityPluginPosix()
84
 
{
85
 
}
86
 
 
87
 
 
88
 
/*
89
 
 *-----------------------------------------------------------------------------
90
 
 *
91
 
 * UnityPluginPosix::GetCapabilities --
92
 
 *
93
 
 *      Called by the service core when the host requests the capabilities
94
 
 *      supported by the guest tools.
95
 
 *
96
 
 * Results:
97
 
 *      A list of capabilities to be sent to the host.
98
 
 *
99
 
 * Side effects:
100
 
 *      None.
101
 
 *
102
 
 *-----------------------------------------------------------------------------
103
 
 */
104
 
 
105
 
std::vector<ToolsAppCapability>
106
 
UnityPluginPosix::GetCapabilities(gboolean set) // IN
107
 
{
108
 
   std::vector<ToolsAppCapability> caps = UnityPlugin::GetCapabilities(set);
109
 
#define ADDCAP(capName) caps.push_back(ToolsAppCapabilityNewEntry(capName, set))
110
 
   ADDCAP(UNITY_CAP_WORK_AREA);
111
 
   ADDCAP(UNITY_CAP_START_MENU);
112
 
   ADDCAP(UNITY_CAP_MULTI_MON);
113
 
   ADDCAP(UNITY_CAP_VIRTUAL_DESK);
114
 
   ADDCAP(UNITY_CAP_STICKY_WINDOWS);
115
 
#undef ADDCAP
116
 
   return caps;
117
 
}
118
 
 
119
 
 
120
 
/*
121
 
 *-----------------------------------------------------------------------------
122
 
 *
123
 
 * UnityPluginPosix::GetSignalRegistrations --
124
 
 *
125
 
 *      Returns a vector containing signal registration info (signal name,
126
 
 *      callback, callback context).  Signals will be connected by container
127
 
 *      after all plugins have successfully registered.
128
 
 *
129
 
 * Results:
130
 
 *      Vector of signal registration info.
131
 
 *
132
 
 * Side effects:
133
 
 *      None.
134
 
 *
135
 
 *-----------------------------------------------------------------------------
136
 
 */
137
 
 
138
 
std::vector<ToolsPluginSignalCb>
139
 
UnityPluginPosix::GetSignalRegistrations(ToolsPluginData* pdata) // IN
140
 
   const
141
 
{
142
 
   std::vector<ToolsPluginSignalCb> signals =
143
 
      UnityPlugin::GetSignalRegistrations(pdata);
144
 
   signals.push_back(
145
 
      ToolsPlugin::SignalCtx(TOOLS_CORE_SIG_XIOERROR, (void*)XIOErrorCb,
146
 
                             static_cast<gpointer>(const_cast<UnityPluginPosix*>(this))));
147
 
   signals.push_back(
148
 
      ToolsPlugin::SignalCtx(TOOLS_CORE_SIG_XSM_DIE, (void*)XSMDieCb,
149
 
                             static_cast<gpointer>(const_cast<UnityPluginPosix*>(this))));
150
 
   return signals;
151
 
}
152
 
 
153
 
 
154
 
/*
155
 
 *-----------------------------------------------------------------------------
156
 
 *
157
 
 * UnityPluginPosix::OnXSMDie --
158
 
 *
159
 
 *      X Session Management event handler.  Exits Unity upon notice of session
160
 
 *      termination.
161
 
 *
162
 
 * Results:
163
 
 *      None.
164
 
 *
165
 
 * Side effects:
166
 
 *      May trigger Unity exit.
167
 
 *
168
 
 *-----------------------------------------------------------------------------
169
 
 */
170
 
 
171
 
void
172
 
UnityPluginPosix::OnXSMDie()
173
 
{
174
 
   if (Unity_IsActive()) {
175
 
      Unity_Exit();
176
 
   }
177
 
}
178
 
 
179
 
 
180
 
/*
181
 
 *-----------------------------------------------------------------------------
182
 
 *
183
 
 * UnityPluginPosix::OnXIOError --
184
 
 *
185
 
 *      In response to an X I/O error, signals host UI that vmusr is no longer
186
 
 *      Unity-capable.
187
 
 *
188
 
 *      This is done because we can't perform a full, correct clean-up after
189
 
 *      receiving an X I/O error.  See xioError.c for details.
190
 
 *
191
 
 * Results:
192
 
 *      None.
193
 
 *
194
 
 * Side effects:
195
 
 *      Invokes a G->H RPC.
196
 
 *
197
 
 *-----------------------------------------------------------------------------
198
 
 */
199
 
 
200
 
void
201
 
UnityPluginPosix::OnXIOError()
202
 
{
203
 
   char *result;
204
 
   size_t resultLen;
205
 
   char tmp[] = "tools.capability.unity 0";
206
 
   RpcChannel_Send(mCtx->rpc, tmp, sizeof tmp, &result, &resultLen);
207
 
   vm_free(result);
208
 
}
209
 
 
210
 
 
211
 
/*
212
 
 ******************************************************************************
213
 
 * BEGIN Static member functions
214
 
 */
215
 
 
216
 
 
217
 
/*
218
 
 *-----------------------------------------------------------------------------
219
 
 *
220
 
 * UnityPluginPosix::XSMDieCb --
221
 
 *
222
 
 *      Thunk between XSM "die" and OnXSMDie.
223
 
 *
224
 
 * Results:
225
 
 *      None.
226
 
 *
227
 
 * Side effects:
228
 
 *      See OnXSMDie.
229
 
 *
230
 
 *-----------------------------------------------------------------------------
231
 
 */
232
 
 
233
 
void
234
 
UnityPluginPosix::XSMDieCb(GObject* obj,        // UNUSED
235
 
                           ToolsAppCtx* ctx,    // UNUSED
236
 
                           gpointer cbData)     // IN: UnityPluginPosix*
237
 
{
238
 
   UnityPluginPosix* unityPlugin = static_cast<UnityPluginPosix*>(cbData);
239
 
   unityPlugin->OnXSMDie();
240
 
}
241
 
 
242
 
 
243
 
/*
244
 
 *-----------------------------------------------------------------------------
245
 
 *
246
 
 * UnityPluginPosix::XIOErrorCb --
247
 
 *
248
 
 *      Thunk between XIOErrorHandler and OnXIOError.
249
 
 *
250
 
 * Results:
251
 
 *      None.
252
 
 *
253
 
 * Side effects:
254
 
 *      See OnXIOError.
255
 
 *
256
 
 *-----------------------------------------------------------------------------
257
 
 */
258
 
 
259
 
void
260
 
UnityPluginPosix::XIOErrorCb(GObject* obj,        // UNUSED
261
 
                             ToolsAppCtx* ctx,    // UNUSED
262
 
                             gpointer cbData)     // IN: UnityPluginPosix*
263
 
{
264
 
   UnityPluginPosix* unityPlugin = static_cast<UnityPluginPosix*>(cbData);
265
 
   unityPlugin->OnXIOError();
266
 
}
267
 
 
268
 
 
269
 
/*
270
 
 * END Static member functions
271
 
 ******************************************************************************
272
 
 */
273
 
 
274
 
 
275
 
} // namespace tools
276
 
} // namespace vmware