From: VMware, Inc <> Date: Tue, 29 Mar 2011 20:02:07 +0000 (-0700) Subject: [unity win32] Turn off unity capability on session lock/disconnect. X-Git-Tag: 2011.03.28-387002~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f58ca43785025959362a75e2e8228b2558882ee7;p=thirdparty%2Fopen-vm-tools.git [unity win32] Turn off unity capability on session lock/disconnect. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/services/plugins/unity/unityPlugin.cpp b/open-vm-tools/services/plugins/unity/unityPlugin.cpp index ddd58d286..af47d36ae 100644 --- a/open-vm-tools/services/plugins/unity/unityPlugin.cpp +++ b/open-vm-tools/services/plugins/unity/unityPlugin.cpp @@ -213,24 +213,19 @@ UnityPlugin::~UnityPlugin() */ std::vector -UnityPlugin::GetCapabilities(gboolean set) // IN: Whether capabilities are being - // set or unset. - // XXX UNUSED Fix this or mark as such. +UnityPlugin::GetCapabilities(gboolean set) // IN { - std::vector capsVector; - /* - * We can't use UNITY_RPC_UNITY_CAP here because that define includes the - * tools.capability prefix which CoreServices will automatically prepend to the - * supplied name. + * Note that we can't use UNITY_RPC_UNITY_CAP here because it includes the + * "tools.capability" prefix which vmtoolsd will automatically prepend to the + * supplied capability name. */ - capsVector.push_back(ToolsAppCapabilityOldEntry(UNITY_CAP_NAME, Unity_IsSupported() ? 1 : 0)); - capsVector.push_back(ToolsAppCapabilityOldEntry("unity.taskbar", - Unity_IsSupported() ? 1 : 0)); - - capsVector.push_back(ToolsAppCapabilityNewEntry(UNITY_CAP_STATUS_UNITY_ACTIVE, TRUE)); - - return capsVector; + Bool b = set ? Unity_IsSupported() : FALSE; + std::vector caps; + caps.push_back(ToolsAppCapabilityOldEntry(UNITY_CAP_NAME, b)); + caps.push_back(ToolsAppCapabilityOldEntry("unity.taskbar", b)); + caps.push_back(ToolsAppCapabilityNewEntry(UNITY_CAP_STATUS_UNITY_ACTIVE, b)); + return caps; } diff --git a/open-vm-tools/services/plugins/unity/unityPlugin.h b/open-vm-tools/services/plugins/unity/unityPlugin.h index f90ceb9d4..7254d38b6 100644 --- a/open-vm-tools/services/plugins/unity/unityPlugin.h +++ b/open-vm-tools/services/plugins/unity/unityPlugin.h @@ -141,6 +141,17 @@ public: virtual gboolean SetOption(gpointer src, const std::string &option, const std::string &value) = 0; + +#ifdef WIN32 + // Handler for the TOOLS_CORE_SIG_SERVICE_CONTROL signal. + virtual DWORD OnServiceControl(gpointer src, + ToolsAppCtx *ctx, + SERVICE_STATUS_HANDLE handle, + guint control, + guint evtType, + gpointer evtData) = 0; +#endif + virtual std::vector GetCapabilities(gboolean set) = 0; virtual std::vector GetRpcCallbackList() = 0; @@ -167,6 +178,7 @@ public: { return FALSE; } + virtual std::vector GetCapabilities(gboolean set); virtual std::vector GetRpcCallbackList(); @@ -187,6 +199,13 @@ public: virtual std::vector GetCapabilities(gboolean set); virtual void SessionChange(gpointer src, DWORD code, DWORD id) {}; + virtual DWORD OnServiceControl(gpointer src, + ToolsAppCtx *ctx, + SERVICE_STATUS_HANDLE handle, + guint control, + guint evtType, + gpointer evtData); + protected: boost::shared_ptr mUnityPBRPCServer; }; diff --git a/open-vm-tools/services/plugins/unity/unityPluginEntry.cpp b/open-vm-tools/services/plugins/unity/unityPluginEntry.cpp index c6d019e13..abeb44a1a 100644 --- a/open-vm-tools/services/plugins/unity/unityPluginEntry.cpp +++ b/open-vm-tools/services/plugins/unity/unityPluginEntry.cpp @@ -41,7 +41,6 @@ extern "C" { using namespace vmware::tools; - /* *----------------------------------------------------------------------------- * @@ -170,11 +169,42 @@ UnityPluginSetOption(gpointer src, // IN: Event source. return pluginInstance->SetOption(src, std::string(option), std::string(value)); } +#ifdef WIN32 +/* + *----------------------------------------------------------------------------- + * + * UnityPluginServiceControl -- + * + * C thunk for TOOLS_CORE_SIG_SERVICE_CONTROL messages. + * + * Results: + * Returns the result of calling OnServiceControl on the plugin object. + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +DWORD +UnityPluginServiceControl(gpointer src, // IN + ToolsAppCtx *ctx, // IN + SERVICE_STATUS_HANDLE handle, // IN + guint control, // IN + guint evtType, // IN + gpointer evtData, // IN + ToolsPluginData *data) // IN +{ + ToolsPlugin *p = reinterpret_cast(data->_private); + ASSERT(p); + return p->OnServiceControl(src, ctx, handle, control, evtType, evtData); +} +#endif /* *----------------------------------------------------------------------------- * - * ToolsOnLoad` -- + * ToolsOnLoad -- * * Plugin entry point. Returns the registration data. * @@ -202,6 +232,9 @@ ToolsOnLoad(ToolsAppCtx *ctx) // IN: The app context. { TOOLS_CORE_SIG_SHUTDOWN, (void *) UnityPluginShutdown, ®Data }, { TOOLS_CORE_SIG_CAPABILITIES, (void *) UnityPluginCapabilities, ®Data }, { TOOLS_CORE_SIG_SET_OPTION, (void *) UnityPluginSetOption, ®Data }, +#ifdef WIN32 + { TOOLS_CORE_SIG_SERVICE_CONTROL, (void *) UnityPluginServiceControl, ®Data }, +#endif }; ToolsPlugin *pluginInstance = NULL;