From: VMware, Inc <> Date: Tue, 24 Aug 2010 18:22:55 +0000 (-0700) Subject: Internal branch sync. Included in this change: X-Git-Tag: 2010.08.24-292196~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6efd5b7500ea215da653e3597f03815e84364481;p=thirdparty%2Fopen-vm-tools.git Internal branch sync. Included in this change: . ghi: use the base glib types for main loop and service objects rather than passing the ToolsAppCtx pointer around. . changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/loglevel_user.h b/open-vm-tools/lib/include/loglevel_user.h index c4af9bc11..362feb7d3 100644 --- a/open-vm-tools/lib/include/loglevel_user.h +++ b/open-vm-tools/lib/include/loglevel_user.h @@ -235,6 +235,7 @@ LOGLEVEL_VAR(syncWaitQ), \ LOGLEVEL_VAR(sg), /* lib/sg */ \ LOGLEVEL_VAR(wrapLib), \ + LOGLEVEL_VAR(bluetooth), \ LOGLEVEL_VAR(digestlib) \ LOGLEVEL_EXTENSION_DECLARE(LOGLEVEL_USER); diff --git a/open-vm-tools/services/plugins/dndcp/stringxx/string.cc b/open-vm-tools/services/plugins/dndcp/stringxx/string.cc index d218cf19a..db6bf9e71 100644 --- a/open-vm-tools/services/plugins/dndcp/stringxx/string.cc +++ b/open-vm-tools/services/plugins/dndcp/stringxx/string.cc @@ -1095,6 +1095,17 @@ string::append(const string &s, // IN } +string& +string::append(const char *s, // IN + size_type n) // IN +{ + InvalidateCache(); + mUstr.append(s, n); + + return *this; +} + + /* *----------------------------------------------------------------------------- * diff --git a/open-vm-tools/services/plugins/dndcp/stringxx/string.hh b/open-vm-tools/services/plugins/dndcp/stringxx/string.hh index 6e1f8c552..03146c70f 100644 --- a/open-vm-tools/services/plugins/dndcp/stringxx/string.hh +++ b/open-vm-tools/services/plugins/dndcp/stringxx/string.hh @@ -149,6 +149,7 @@ public: // String-level member methods. string& append(const string &s); string& append(const string &s, size_type i, size_type n); + string& append(const char *s, size_type n); string& assign(const string &s); void push_back(value_type uc); void clear(); diff --git a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.c b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.c index 42a99dd11..844ce83fc 100644 --- a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.c +++ b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.c @@ -143,12 +143,13 @@ GHI_UnregisterCaps(void) */ void -GHI_Init(void *ctx) // IN +GHI_Init(GMainLoop *mainLoop, // IN + const char **envp) // IN { Debug("%s: Enter.\n", __FUNCTION__); // Call the platform-specific initialization function. - ghiPlatformData = GHIPlatformInit((ToolsAppCtx*) ctx); + ghiPlatformData = GHIPlatformInit(mainLoop, envp); if (!ghiPlatformData) { // TODO: We should report this failure to the caller. Debug("%s: GHIPlatformInit returned NULL pointer!\n", __FUNCTION__); diff --git a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.h b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.h index 62e3472ee..19345fc75 100644 --- a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.h +++ b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.h @@ -29,10 +29,12 @@ extern "C" { #endif +#include + #include "vmware.h" Bool GHI_IsSupported(void); -void GHI_Init(void *ctx); +void GHI_Init(GMainLoop *mainLoop, const char **envp); void GHI_Cleanup(void); void GHI_RegisterCaps(void); void GHI_UnregisterCaps(void); diff --git a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationInt.h b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationInt.h index 17983b69f..bf3d9ab92 100644 --- a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationInt.h +++ b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationInt.h @@ -107,7 +107,7 @@ RpcInRet GHITcloGetExecInfoHash(RpcInData *data); */ Bool GHIPlatformIsSupported(void); -GHIPlatform *GHIPlatformInit(ToolsAppCtx *ctx); +GHIPlatform *GHIPlatformInit(GMainLoop *mainLoop, const char **envp); void GHIPlatformCleanup(GHIPlatform *ghip); Bool GHIPlatformGetBinaryInfo(GHIPlatform *ghip, const char *pathURIUtf8, diff --git a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationX11.c b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationX11.c index 433a3d9d0..75ed2e234 100644 --- a/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationX11.c +++ b/open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationX11.c @@ -344,13 +344,14 @@ GHIPlatformIsSupported(void) */ GHIPlatform * -GHIPlatformInit(ToolsAppCtx *ctx) // IN +GHIPlatformInit(GMainLoop *mainLoop, // IN + const char **envp) // IN { GHIPlatform *ghip; ghip = Util_SafeCalloc(1, sizeof *ghip); ghip->directoriesTracked = g_array_new(FALSE, FALSE, sizeof(GHIDirectoryWatch)); - ghip->nativeEnviron = ctx->envp; + ghip->nativeEnviron = envp; ghip->appsByWindowExecutable = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); AppUtil_Init(); diff --git a/open-vm-tools/services/plugins/unity/unityPlugin.cpp b/open-vm-tools/services/plugins/unity/unityPlugin.cpp index 5dc48b257..9770209cd 100644 --- a/open-vm-tools/services/plugins/unity/unityPlugin.cpp +++ b/open-vm-tools/services/plugins/unity/unityPlugin.cpp @@ -49,9 +49,13 @@ UnityPlugin::UnityPlugin(ToolsAppCtx *ctx) { ASSERT(ctx); - Unity_Init(NULL, NULL, ctx); + Unity_Init(NULL, NULL, ctx->serviceObj); - GHI_Init(ctx); +#if defined(G_PLATFORM_WIN32) + GHI_Init(ctx->mainLoop, NULL); +#else + GHI_Init(ctx->mainLoop, ctx->envp); +#endif // G_PLATFORM_WIN32 if (g_key_file_get_boolean(ctx->config, CONFGROUPNAME_UNITY, CONFNAME_UNITY_ENABLEDEBUG, NULL)) { diff --git a/open-vm-tools/services/plugins/unity/unitylib/unity.c b/open-vm-tools/services/plugins/unity/unitylib/unity.c index bd3efb802..a9c552547 100644 --- a/open-vm-tools/services/plugins/unity/unitylib/unity.c +++ b/open-vm-tools/services/plugins/unity/unitylib/unity.c @@ -81,7 +81,7 @@ static void UnityUpdateCallbackFn(void *param, UnityUpdate *update); static void UnitySetAddHiddenWindows(Bool enabled); static void UnitySetInterlockMinimizeOperation(Bool enabled); static void UnitySetSendWindowContents(Bool enabled); -static void FireEnterUnitySignal(ToolsAppCtx *ctx, gboolean entered); +static void FireEnterUnitySignal(gpointer serviceObj, gboolean entered); static void UnitySetDisableCompositing(Bool disabled); /* @@ -250,7 +250,7 @@ Unity_IsActive(void) void Unity_Init(GuestApp_Dict *conf, // IN int *blockedWnd, // IN - ToolsAppCtx *ctx) // IN + gpointer serviceObj) // IN { Debug("Unity_Init\n"); @@ -285,8 +285,12 @@ Unity_Init(GuestApp_Dict *conf, // IN unity.virtDesktopArray.desktopCount = 0; + /* + * Cache the service object and use it to create the enter/exit Unity signal. + */ + unity.serviceObj = serviceObj; g_signal_new(UNITY_SIG_ENTER_LEAVE_UNITY, - G_OBJECT_TYPE(ctx->serviceObj), + G_OBJECT_TYPE(serviceObj), (GSignalFlags) 0, 0, NULL, @@ -315,7 +319,7 @@ Unity_Init(GuestApp_Dict *conf, // IN */ void -Unity_Cleanup(ToolsAppCtx *ctx) // IN +Unity_Cleanup() { UnityPlatform *up; @@ -325,7 +329,9 @@ Unity_Cleanup(ToolsAppCtx *ctx) // IN /* * Exit Unity. */ - Unity_Exit(ctx); + Unity_Exit(); + + unity.serviceObj = NULL; /* * Do one-time final platform-specific cleanup. @@ -399,7 +405,7 @@ Unity_SetActiveDnDDetWnd(UnityDnD *state) */ void -Unity_Exit(ToolsAppCtx *ctx) // IN +Unity_Exit() { int featureIndex = 0; @@ -426,7 +432,7 @@ Unity_Exit(ToolsAppCtx *ctx) // IN UnityPlatformRestoreSystemSettings(unity.up); unity.isEnabled = FALSE; - FireEnterUnitySignal(ctx, FALSE); + FireEnterUnitySignal(unity.serviceObj, FALSE); } } @@ -573,7 +579,7 @@ UnityTcloEnter(RpcInData *data) // IN/OUT * catched for Unity DnD. */ UnityPlatformUpdateDnDDetWnd(unity.up, TRUE); - FireEnterUnitySignal(data->appCtx, TRUE); + FireEnterUnitySignal(unity.serviceObj, TRUE); unity.isEnabled = TRUE; } @@ -610,7 +616,7 @@ UnityTcloExit(RpcInData *data) // IN/OUT Debug("UnityTcloExit.\n"); - Unity_Exit(data->appCtx); + Unity_Exit(); UnityUpdateState(); return RPCIN_SETRETVALS(data, "", TRUE); @@ -2948,11 +2954,11 @@ exit: */ static void -FireEnterUnitySignal(ToolsAppCtx *ctx, +FireEnterUnitySignal(gpointer serviceObj, gboolean enter) { Debug("%s: enter. enter argument is set to %s\n", __FUNCTION__, enter ? "true" : "false"); - g_signal_emit_by_name(ctx->serviceObj, + g_signal_emit_by_name(serviceObj, UNITY_SIG_ENTER_LEAVE_UNITY, enter); } diff --git a/open-vm-tools/services/plugins/unity/unitylib/unity.h b/open-vm-tools/services/plugins/unity/unitylib/unity.h index 5ff70d436..3494ade5f 100644 --- a/open-vm-tools/services/plugins/unity/unitylib/unity.h +++ b/open-vm-tools/services/plugins/unity/unitylib/unity.h @@ -25,12 +25,12 @@ #ifndef _UNITY_H_ #define _UNITY_H_ +#include #include #include "dndGuest.h" #include "dbllnklst.h" #include "guestApp.h" #include "dynbuf.h" -#include "vmware/tools/plugin.h" #include "str.h" #ifdef _WIN32 #include "libExport.hh" @@ -89,12 +89,12 @@ extern "C" { void Unity_Init(GuestApp_Dict *conf, int *blockedWnd, - ToolsAppCtx *ctx); + gpointer serviceObj); Bool Unity_IsActive(void); Bool Unity_IsSupported(void); void Unity_SetActiveDnDDetWnd(UnityDnD *state); -void Unity_Exit(ToolsAppCtx *ctx); -void Unity_Cleanup(ToolsAppCtx *ctx); +void Unity_Exit(void); +void Unity_Cleanup(void); void Unity_RegisterCaps(void); void Unity_UnregisterCaps(void); void Unity_UnityToLocalPoint(UnityPoint *localPt, UnityPoint *unityPt); diff --git a/open-vm-tools/services/plugins/unity/unitylib/unityInt.h b/open-vm-tools/services/plugins/unity/unitylib/unityInt.h index 4e9e96fa1..a4a25cee8 100644 --- a/open-vm-tools/services/plugins/unity/unitylib/unityInt.h +++ b/open-vm-tools/services/plugins/unity/unitylib/unityInt.h @@ -50,6 +50,7 @@ typedef struct UnityState { UnityVirtualDesktopArray virtDesktopArray; // Virtual desktop configuration UnityUpdateChannel updateChannel; // Unity update transmission channel. UnityPlatform *up; // Platform-specific state + gpointer serviceObj; // 'Plugin' Host service object - used for signaling Unity state } UnityState; extern UnityState unity;