*/
#define TOOLS_CORE_SIG_RESET "tcs_reset"
+/**
+ * Signal sent when RpcChannel is going to be destroyed.
+ *
+ * @param[in] src The source object.
+ * @param[in] ctx ToolsAppCtx *: The application context.
+ * @param[in] data Client data.
+ */
+#define TOOLS_CORE_SIG_NO_RPC "tcs_no_rpc"
+
/**
* Signal sent when a "set option" RPC message arrives.
*
/*********************************************************
- * Copyright (C) 2005-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2005-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* selection text.
*/
+#define G_LOG_DOMAIN "dndcp"
+
#include "dndPluginIntX11.h"
#include <stdlib.h>
#include <string.h>
}
+/**
+ *
+ * Handle no_rpc.
+ *
+ * Remove any actions that would need RPC channel.
+ */
+
+void
+CopyPasteDnDWrapper::OnNoRpc()
+{
+ g_debug("%s: enter.\n", __FUNCTION__);
+ RemoveDnDPluginResetTimer();
+}
+
+
/**
*
* Handle cap reg. This is cross-platform so handle here instead of the
void SetCPIsEnabled(gboolean isEnabled);
gboolean IsCPEnabled();
void OnReset();
+ void OnNoRpc();
virtual void OnResetInternal();
virtual void OnCapReg(gboolean set);
virtual gboolean OnSetOption(const char *option, const char *value);
void PointerInit(void);
virtual ToolsAppCtx *GetToolsAppCtx() {return NULL;};
uint32 GetCaps();
+ virtual void RemoveDnDPluginResetTimer(void) { }
protected:
/*
/*********************************************************
- * Copyright (C) 2010-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
#include "vmware.h"
+#define G_LOG_DOMAIN "dndcp"
+
extern "C" {
#include "vmware/guestrpc/tclodefs.h"
#include "vmware/tools/plugin.h"
}
+/**
+ * Handle a no_rpc signal.
+ *
+ * @param[in] src Unused.
+ * @param[in] ctx Unused.
+ * @param[in] data Unused.
+ */
+
+static void
+DnDCPNoRpc(gpointer src,
+ ToolsAppCtx *ctx,
+ gpointer data)
+{
+ g_debug("%s: enter\n", __FUNCTION__);
+ CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
+ if (p) {
+ p->OnNoRpc();
+ }
+}
+
+
/**
* Returns the list of the plugin's capabilities.
*
ToolsPluginSignalCb sigs[] = {
{ TOOLS_CORE_SIG_CAPABILITIES, (void *) DnDCPCapabilities, NULL },
{ TOOLS_CORE_SIG_RESET, (void *) DnDCPReset, NULL },
+ { TOOLS_CORE_SIG_NO_RPC, (void *) DnDCPNoRpc, NULL },
{ TOOLS_CORE_SIG_SET_OPTION, (void *) DnDCPSetOption, NULL },
{ TOOLS_CORE_SIG_SHUTDOWN, (void *) DnDCPShutdown, NULL }
};
* The inherited implementation of common class CopyPasteDnDWrapper in VM side.
*/
+#define G_LOG_DOMAIN "dndcp"
+
#include "guestDnDCPMgr.hh"
#include "vmCopyPasteDnDWrapper.h"
#include "vmware.h"
* Timer callback for reset. Handle it by calling the member function
* that handles reset.
*
- * @param[in] clientData pointer to the CopyPasteDnDWrapper instance that
+ * @param[in] clientData pointer to the VMCopyPasteDnDWrapper instance that
* issued the timer.
*
* @return FALSE always.
static gboolean
DnDPluginResetSent(void *clientData)
{
- CopyPasteDnDWrapper *p = reinterpret_cast<CopyPasteDnDWrapper *>(clientData);
+ VMCopyPasteDnDWrapper *p = reinterpret_cast<VMCopyPasteDnDWrapper *>(clientData);
+ g_debug("%s: enter\n", __FUNCTION__);
ASSERT(p);
p->OnResetInternal();
+ p->RemoveDnDPluginResetTimer();
return FALSE;
}
void
VMCopyPasteDnDWrapper::AddDnDPluginResetTimer(void)
{
- GSource *src;
+ g_debug("%s: enter\n", __FUNCTION__);
+
+ ASSERT(m_resetTimer == NULL);
+
+ m_resetTimer = VMTools_CreateTimer(RPC_POLL_TIME * 30);
+ if (m_resetTimer) {
+ VMTOOLSAPP_ATTACH_SOURCE(m_ctx, m_resetTimer,
+ DnDPluginResetSent, this, NULL);
+ }
+}
+
+/**
+ *
+ * Remove the DnD plugin reset timer.
+ */
+
+void
+VMCopyPasteDnDWrapper::RemoveDnDPluginResetTimer(void)
+{
g_debug("%s: enter\n", __FUNCTION__);
- src = VMTools_CreateTimer(RPC_POLL_TIME * 30);
- if (src) {
- VMTOOLSAPP_ATTACH_SOURCE(m_ctx, src, DnDPluginResetSent, this, NULL);
- g_source_unref(src);
+ if (m_resetTimer) {
+ g_source_destroy(m_resetTimer);
+ g_source_unref(m_resetTimer);
+ m_resetTimer = NULL;
}
}
virtual int GetDnDVersion();
virtual void OnResetInternal();
virtual gboolean OnSetOption(const char *option, const char *value);
+ void RemoveDnDPluginResetTimer(void);
protected:
void AddDnDPluginResetTimer(void);
private:
- VMCopyPasteDnDWrapper() : m_ctx(NULL) { }
+ VMCopyPasteDnDWrapper() : m_ctx(NULL), m_resetTimer(NULL) { }
VMCopyPasteDnDWrapper(const VMCopyPasteDnDWrapper &wrapper);
VMCopyPasteDnDWrapper& operator=(const VMCopyPasteDnDWrapper &wrapper);
private:
ToolsAppCtx *m_ctx;
+ GSource *m_resetTimer;
};
#endif // __VM_COPYPASTEDNDWRAPPER_H__
if (TOOLS_IS_USER_SERVICE(&gState.ctx)) {
g_info("Shutting down guestrpc on signal USR1 ...\n");
+ g_signal_emit_by_name(gState.ctx.serviceObj,
+ TOOLS_CORE_SIG_NO_RPC,
+ &gState.ctx);
RpcChannel_Destroy(gState.ctx.rpc);
gState.ctx.rpc = NULL;
}
/*********************************************************
- * Copyright (C) 2008-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
G_TYPE_NONE,
1,
G_TYPE_POINTER);
+ g_signal_new(TOOLS_CORE_SIG_NO_RPC,
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_POINTER);
g_signal_new(TOOLS_CORE_SIG_SET_OPTION,
G_OBJECT_CLASS_TYPE(klass),
G_SIGNAL_RUN_LAST,