1
/*********************************************************
2
* Copyright (C) 2010 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
*********************************************************/
22
* Entry points for DnD and CP plugin.
24
* No platform-specific code belongs here. See copyPasteDnDWrapper.[h|cpp]
25
* for abstraction API to platform implementations, and copyPasteDnDImpl.h
26
* for implementation class inteface. To add a new platform, derive from
32
#include "vmware/guestrpc/tclodefs.h"
33
#include "vmware/tools/plugin.h"
34
#include "vmware/tools/utils.h"
38
#include "copyPasteDnDWrapper.h"
43
* Cleanup internal data on shutdown.
45
* @param[in] src Unused.
46
* @param[in] ctx Unused.
47
* @param[in] data Unused.
51
DnDCPShutdown(gpointer src,
55
g_debug("%s: enter\n", __FUNCTION__);
56
CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
61
CopyPasteDnDWrapper::Destroy();
66
* Handle a reset signal.
68
* @param[in] src Unused.
69
* @param[in] ctx Unused.
70
* @param[in] data Unused.
74
DnDCPReset(gpointer src,
78
g_debug("%s: enter\n", __FUNCTION__);
79
CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
87
* Returns the list of the plugin's capabilities.
90
* @param[in] src Unused.
91
* @param[in] ctx Unused.
92
* @param[in] set Whether setting or unsetting the capability.
93
* @param[in] data Unused.
95
* @return A list of capabilities.
99
DnDCPCapabilities(gpointer src,
104
g_debug("%s: enter\n", __FUNCTION__);
105
CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
114
* Handles SetOption callback.
117
* @param[in] src Unused.
118
* @param[in] ctx Unused.
119
* @param[in] data Unused.
120
* @param[in] option The option being set.
121
* @param[in] value The value the option is being set to.
123
* @return TRUE on success, FALSE otherwise.
127
DnDCPSetOption(gpointer src,
133
gboolean ret = FALSE;
137
g_debug("%s: enter option %s value %s\n", __FUNCTION__, option, value);
138
CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
140
if (option == NULL || (strcmp(option, TOOLSOPTION_ENABLEDND) != 0 &&
141
strcmp(option, TOOLSOPTION_COPYPASTE) != 0)) {
145
if (value == NULL || (strcmp(value, "2") != 0 &&
146
strcmp(value, "1") != 0 &&
147
strcmp(value, "0") != 0)) {
153
ret = p->OnSetOption(option, value);
161
* Plugin entry point. Initializes internal plugin state.
163
* @param[in] ctx The app context.
165
* @return The registration data.
168
TOOLS_MODULE_EXPORT ToolsPluginData *
169
ToolsOnLoad(ToolsAppCtx *ctx)
171
static ToolsPluginData regData = {
177
if (ctx->rpc != NULL) {
178
ToolsPluginSignalCb sigs[] = {
179
{ TOOLS_CORE_SIG_CAPABILITIES, (void *) DnDCPCapabilities, NULL },
180
{ TOOLS_CORE_SIG_RESET, (void *) DnDCPReset, NULL },
181
{ TOOLS_CORE_SIG_SET_OPTION, (void *) DnDCPSetOption, NULL },
182
{ TOOLS_CORE_SIG_SHUTDOWN, (void *) DnDCPShutdown, NULL }
185
ToolsAppReg regs[] = {
186
{ TOOLS_APP_SIGNALS, VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
190
* DnD/CP Initialization here.
193
CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
199
regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs));