1
/*********************************************************
2
* Copyright (C) 2011 VMware, Inc. All rights reserved.
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.
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.
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.
17
*********************************************************/
20
* unityPluginPosix.cpp --
22
* POSIX subclass of UnityPlugin interface.
26
#include "unityPluginPosix.h"
30
#include <glib-object.h>
32
#include "vmware/tools/desktopevents.h"
33
#if defined(OPEN_VM_TOOLS)
34
#include "unitylib/unity.h"
37
#endif // OPEN_VM_TOOLS
46
*-----------------------------------------------------------------------------
48
* UnityPluginPosix::UnityPluginPosix --
58
*-----------------------------------------------------------------------------
61
UnityPluginPosix::UnityPluginPosix(const ToolsAppCtx* ctx) // IN: The app context.
68
*-----------------------------------------------------------------------------
70
* UnityPluginPosix::~UnityPluginPosix --
80
*-----------------------------------------------------------------------------
83
UnityPluginPosix::~UnityPluginPosix()
89
*-----------------------------------------------------------------------------
91
* UnityPluginPosix::GetCapabilities --
93
* Called by the service core when the host requests the capabilities
94
* supported by the guest tools.
97
* A list of capabilities to be sent to the host.
102
*-----------------------------------------------------------------------------
105
std::vector<ToolsAppCapability>
106
UnityPluginPosix::GetCapabilities(gboolean set) // IN
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);
121
*-----------------------------------------------------------------------------
123
* UnityPluginPosix::GetSignalRegistrations --
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.
130
* Vector of signal registration info.
135
*-----------------------------------------------------------------------------
138
std::vector<ToolsPluginSignalCb>
139
UnityPluginPosix::GetSignalRegistrations(ToolsPluginData* pdata) // IN
142
std::vector<ToolsPluginSignalCb> signals =
143
UnityPlugin::GetSignalRegistrations(pdata);
145
ToolsPlugin::SignalCtx(TOOLS_CORE_SIG_XIOERROR, (void*)XIOErrorCb,
146
static_cast<gpointer>(const_cast<UnityPluginPosix*>(this))));
148
ToolsPlugin::SignalCtx(TOOLS_CORE_SIG_XSM_DIE, (void*)XSMDieCb,
149
static_cast<gpointer>(const_cast<UnityPluginPosix*>(this))));
155
*-----------------------------------------------------------------------------
157
* UnityPluginPosix::OnXSMDie --
159
* X Session Management event handler. Exits Unity upon notice of session
166
* May trigger Unity exit.
168
*-----------------------------------------------------------------------------
172
UnityPluginPosix::OnXSMDie()
174
if (Unity_IsActive()) {
181
*-----------------------------------------------------------------------------
183
* UnityPluginPosix::OnXIOError --
185
* In response to an X I/O error, signals host UI that vmusr is no longer
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.
195
* Invokes a G->H RPC.
197
*-----------------------------------------------------------------------------
201
UnityPluginPosix::OnXIOError()
205
char tmp[] = "tools.capability.unity 0";
206
RpcChannel_Send(mCtx->rpc, tmp, sizeof tmp, &result, &resultLen);
212
******************************************************************************
213
* BEGIN Static member functions
218
*-----------------------------------------------------------------------------
220
* UnityPluginPosix::XSMDieCb --
222
* Thunk between XSM "die" and OnXSMDie.
230
*-----------------------------------------------------------------------------
234
UnityPluginPosix::XSMDieCb(GObject* obj, // UNUSED
235
ToolsAppCtx* ctx, // UNUSED
236
gpointer cbData) // IN: UnityPluginPosix*
238
UnityPluginPosix* unityPlugin = static_cast<UnityPluginPosix*>(cbData);
239
unityPlugin->OnXSMDie();
244
*-----------------------------------------------------------------------------
246
* UnityPluginPosix::XIOErrorCb --
248
* Thunk between XIOErrorHandler and OnXIOError.
256
*-----------------------------------------------------------------------------
260
UnityPluginPosix::XIOErrorCb(GObject* obj, // UNUSED
261
ToolsAppCtx* ctx, // UNUSED
262
gpointer cbData) // IN: UnityPluginPosix*
264
UnityPluginPosix* unityPlugin = static_cast<UnityPluginPosix*>(cbData);
265
unityPlugin->OnXIOError();
270
* END Static member functions
271
******************************************************************************
276
} // namespace vmware