]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Add the unity plugin to open-vm-tools.
authorVMware, Inc <>
Mon, 26 Jul 2010 19:21:25 +0000 (12:21 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 26 Jul 2010 19:21:25 +0000 (12:21 -0700)
. stage the new sources.
. move unity-specific libraries to the new plugin directory.
. move unity/ghi XDR definitions to the new plugin directory.
. re-enable build of a few libraries used by the unity code.
. explicitly include str.h to avoid a compiler warning.
. move dndGuest.h back into the lib/include directory since unity
uses it.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
39 files changed:
open-vm-tools/configure.ac
open-vm-tools/lib/Makefile.am
open-vm-tools/lib/ghIntegration/Makefile.am [deleted file]
open-vm-tools/lib/guestRpc/Makefile.am
open-vm-tools/lib/include/dndGuest.h [moved from open-vm-tools/services/plugins/dndcp/dndGuest/dndGuest.h with 100% similarity]
open-vm-tools/lib/include/vmware/tools/unityevents.h [new file with mode: 0644]
open-vm-tools/lib/unity/Makefile.am [deleted file]
open-vm-tools/lib/unityWindowTracker/Makefile.am [deleted file]
open-vm-tools/services/plugins/Makefile.am
open-vm-tools/services/plugins/unity/Makefile.am [new file with mode: 0644]
open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.c [moved from open-vm-tools/lib/ghIntegration/ghIntegration.c with 100% similarity]
open-vm-tools/services/plugins/unity/ghIntegration/ghIntegration.h [moved from open-vm-tools/lib/include/ghIntegration.h with 100% similarity]
open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationInt.h [moved from open-vm-tools/lib/ghIntegration/ghIntegrationInt.h with 100% similarity]
open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationX11.c [moved from open-vm-tools/lib/ghIntegration/ghIntegrationX11.c with 99% similarity]
open-vm-tools/services/plugins/unity/ghiCommonDefines.h [moved from open-vm-tools/lib/guestRpc/ghiCommonDefines.h with 100% similarity]
open-vm-tools/services/plugins/unity/ghiGetBinaryHandlers.x [moved from open-vm-tools/lib/guestRpc/ghiGetBinaryHandlers.x with 100% similarity]
open-vm-tools/services/plugins/unity/ghiGetExecInfoHash.x [moved from open-vm-tools/lib/guestRpc/ghiGetExecInfoHash.x with 100% similarity]
open-vm-tools/services/plugins/unity/ghiProtocolHandler.x [moved from open-vm-tools/lib/guestRpc/ghiProtocolHandler.x with 100% similarity]
open-vm-tools/services/plugins/unity/ghiShellAction.x [moved from open-vm-tools/lib/guestRpc/ghiShellAction.x with 100% similarity]
open-vm-tools/services/plugins/unity/ghiStartMenu.x [moved from open-vm-tools/lib/guestRpc/ghiStartMenu.x with 100% similarity]
open-vm-tools/services/plugins/unity/ghiTrayIcon.x [moved from open-vm-tools/lib/guestRpc/ghiTrayIcon.x with 100% similarity]
open-vm-tools/services/plugins/unity/unity.x [moved from open-vm-tools/lib/guestRpc/unity.x with 99% similarity]
open-vm-tools/services/plugins/unity/unityActive.x [moved from open-vm-tools/lib/guestRpc/unityActive.x with 100% similarity]
open-vm-tools/services/plugins/unity/unityPlugin.cpp [new file with mode: 0644]
open-vm-tools/services/plugins/unity/unityPlugin.h [new file with mode: 0644]
open-vm-tools/services/plugins/unity/unityPluginEntry.cpp [new file with mode: 0644]
open-vm-tools/services/plugins/unity/unityWindowTracker/unityWindowTracker.c [moved from open-vm-tools/lib/unityWindowTracker/unityWindowTracker.c with 100% similarity]
open-vm-tools/services/plugins/unity/unityWindowTracker/unityWindowTracker.h [moved from open-vm-tools/lib/include/unityWindowTracker.h with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unity.c [moved from open-vm-tools/lib/unity/unity.c with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unity.h [moved from open-vm-tools/lib/include/unity.h with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unityDebug.h [moved from open-vm-tools/lib/unity/unityDebug.h with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unityInt.h [new file with mode: 0644]
open-vm-tools/services/plugins/unity/unitylib/unityPlatform.h [moved from open-vm-tools/lib/unity/unityPlatform.h with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unityPlatformX11.c [moved from open-vm-tools/lib/unity/unityPlatformX11.c with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unityPlatformX11Settings.c [moved from open-vm-tools/lib/unity/unityPlatformX11Settings.c with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unityPlatformX11Window.c [moved from open-vm-tools/lib/unity/unityPlatformX11Window.c with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/unityX11.h [moved from open-vm-tools/lib/unity/unityX11.h with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/x11Event.c [moved from open-vm-tools/lib/unity/x11Event.c with 100% similarity]
open-vm-tools/services/plugins/unity/unitylib/x11Util.c [moved from open-vm-tools/lib/unity/x11Util.c with 100% similarity]

index 990f6716f7dfc51fe16290fa9660d0c05974a2ea..97a23191a4866ef174e024bd81513980285d9699 100644 (file)
@@ -1099,6 +1099,7 @@ AM_CONDITIONAL(THIRTY_TWO_BIT_USERSPACE, test "$userSpaceBitness" = "32")
 AM_CONDITIONAL(HAVE_X11, test "$have_x" = "yes")
 AM_CONDITIONAL(HAVE_ICU, test "$with_icu" = "yes")
 AM_CONDITIONAL(WITH_KERNEL_MODULES, test "$with_kernel_modules" = "yes")
+AM_CONDITIONAL(ENABLE_UNITY, test "$enable_unity" = "yes")
 AM_CONDITIONAL(ENABLE_TESTS, test "$have_cunit" = "yes")
 AM_CONDITIONAL(WITH_ROOT_PRIVILEGES, test "$with_root_privileges" = "yes")
 AM_CONDITIONAL(HAVE_DOXYGEN, test "$have_doxygen" = "yes")
@@ -1225,7 +1226,6 @@ AC_CONFIG_FILES([                      \
    lib/eventManager/Makefile           \
    lib/file/Makefile                   \
    lib/foundryMsg/Makefile             \
-   lib/ghIntegration/Makefile          \
    lib/guestApp/Makefile               \
    lib/guestRpc/Makefile               \
    lib/hgfs/Makefile                   \
@@ -1258,8 +1258,6 @@ AC_CONFIG_FILES([                      \
    lib/syncDriver/Makefile             \
    lib/system/Makefile                 \
    lib/unicode/Makefile                \
-   lib/unity/Makefile                  \
-   lib/unityWindowTracker/Makefile     \
    lib/user/Makefile                   \
    lib/vmCheck/Makefile                \
    lib/vmSignal/Makefile               \
@@ -1275,6 +1273,7 @@ AC_CONFIG_FILES([                      \
    services/plugins/powerOps/Makefile  \
    services/plugins/resolutionSet/Makefile \
    services/plugins/timeSync/Makefile  \
+   services/plugins/unity/Makefile     \
    services/plugins/vix/Makefile       \
    services/plugins/vixUser/Makefile   \
    services/plugins/vmbackup/Makefile  \
index 28a3d41a7686016395607cb81a3e88d413215a33..bc8df112fe8a5d8344bab41930446193b66d0d32 100644 (file)
@@ -17,6 +17,9 @@
 
 SUBDIRS =
 SUBDIRS += guestRpc
+if HAVE_X11
+   SUBDIRS += appUtil
+endif
 SUBDIRS += auth
 SUBDIRS += backdoor
 SUBDIRS += conf
@@ -33,6 +36,9 @@ SUBDIRS += hgfsHelper
 SUBDIRS += hgfsServer
 SUBDIRS += hgfsServerManagerGuest
 SUBDIRS += hgfsServerPolicyGuest
+if ENABLE_UNITY
+   SUBDIRS += image
+endif
 SUBDIRS += impersonate
 SUBDIRS += lock
 SUBDIRS += message
@@ -42,6 +48,10 @@ SUBDIRS += panic
 SUBDIRS += panicDefault
 SUBDIRS += printer
 SUBDIRS += procMgr
+if ENABLE_UNITY
+   SUBDIRS += raster
+   SUBDIRS += region
+endif
 if HAVE_X11
    SUBDIRS += resolution
 endif
diff --git a/open-vm-tools/lib/ghIntegration/Makefile.am b/open-vm-tools/lib/ghIntegration/Makefile.am
deleted file mode 100644 (file)
index ceb4455..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-################################################################################
-### Copyright 2008 VMware, Inc.  All rights reserved.
-###
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of version 2 of the GNU General Public License as
-### published by the Free Software Foundation.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-################################################################################
-
-noinst_LTLIBRARIES = libGhIntegration.la
-
-libGhIntegration_la_SOURCES =
-libGhIntegration_la_SOURCES += ghIntegration.c
-libGhIntegration_la_SOURCES += ghIntegrationX11.c
-
-AM_CFLAGS = @GTK_CPPFLAGS@
-AM_CFLAGS += @URIPARSER_CPPFLAGS@
-
index 8a4f5ee83e4749ea15ea0aef12e4a9f13975e5ac..55be510efaab4c68768756d3d6eb6b106c86795b 100644 (file)
@@ -19,16 +19,8 @@ noinst_LTLIBRARIES = libGuestRpc.la
 
 libGuestRpc_la_SOURCES =
 libGuestRpc_la_SOURCES += cpFileContents_xdr.c
-libGuestRpc_la_SOURCES += ghiGetBinaryHandlers_xdr.c
-libGuestRpc_la_SOURCES += ghiGetExecInfoHash_xdr.c
-libGuestRpc_la_SOURCES += ghiProtocolHandler_xdr.c
-libGuestRpc_la_SOURCES += ghiStartMenu_xdr.c
-libGuestRpc_la_SOURCES += ghiShellAction_xdr.c
-libGuestRpc_la_SOURCES += ghiTrayIcon_xdr.c
 libGuestRpc_la_SOURCES += guestlibV3_xdr.c
 libGuestRpc_la_SOURCES += nicinfo_xdr.c
-libGuestRpc_la_SOURCES += unityActive_xdr.c
-libGuestRpc_la_SOURCES += unity_xdr.c
 
 # XXX: Autoreconf complains about this and recommends using AM_CFLAGS instead.
 # Problem is, $(CFLAGS) is appended to the compiler command line after AM_CFLAGS
@@ -38,148 +30,47 @@ CFLAGS += -Wno-unused
 CLEANFILES =
 CLEANFILES += cpFileContents.h
 CLEANFILES += cpFileContents_xdr.c
-CLEANFILES += ghiGetBinaryHandlers.h
-CLEANFILES += ghiGetBinaryHandlers_xdr.c
-CLEANFILES += ghiGetExecInfoHash.h
-CLEANFILES += ghiGetExecInfoHash_xdr.c
-CLEANFILES += ghiProtocolHandler.h
-CLEANFILES += ghiProtocolHandler_xdr.c
-CLEANFILES += ghiStartMenu.h
-CLEANFILES += ghiStartMenu_xdr.c
-CLEANFILES += ghiShellAction.h
-CLEANFILES += ghiShellAction_xdr.c
-CLEANFILES += ghiTrayIcon.h
-CLEANFILES += ghiTrayIcon_xdr.c
 CLEANFILES += guestlibV3.h
 CLEANFILES += guestlibV3_xdr.c
 CLEANFILES += nicinfo.h
 CLEANFILES += nicinfo_xdr.c
-CLEANFILES += unityActive.h
-CLEANFILES += unityActive_xdr.c
-CLEANFILES += unity.h
-CLEANFILES += unity_xdr.c
 
 EXTRA_DIST =
 EXTRA_DIST += cpFileContents.x
-EXTRA_DIST += ghiGetBinaryHandlers.x
-EXTRA_DIST += ghiGetExecInfoHash.x
-EXTRA_DIST += ghiProtocolHandler.x
-EXTRA_DIST += ghiStartMenu.x
-EXTRA_DIST += ghiShellAction.x
-EXTRA_DIST += ghiTrayIcon.x
 EXTRA_DIST += guestlibV3.x
 EXTRA_DIST += nicinfo.x
-EXTRA_DIST += unityActive.x
-EXTRA_DIST += unity.x
 
-## `make clean` should also remove the copied headers.
-clean-local:
-       rm -rf $(top_builddir)/lib/include/guestrpc
-       if [ $(top_builddir) != $(top_srcdir) ]; then   \
-          rm -f *.x;                                   \
-          rm -f ghiCommonDefines.h;                    \
-       fi
 
 # Rules to invoke rpcgen. rpcgen will generate funny paths in the generated
 # files if not invoked in the same directory as the source file, so we need
 # to copy the sources to the build dir before compiling them.
 
-cpFileContents.h: cpFileContents.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                           \
-          cp -f $(top_srcdir)/lib/guestRpc/cpFileContents.x $(builddir); \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/cpFileContents.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
-
-cpFileContents_xdr.c: cpFileContents.x cpFileContents.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/cpFileContents.x
-
-ghiGetBinaryHandlers.h: ghiGetBinaryHandlers.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                           \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiCommonDefines.h $(builddir);     \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiGetBinaryHandlers.x $(builddir); \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiGetBinaryHandlers.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
-
-ghiGetBinaryHandlers_xdr.c: ghiGetBinaryHandlers.x ghiGetBinaryHandlers.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiGetBinaryHandlers.x
-
-ghiGetExecInfoHash.h: ghiGetExecInfoHash.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                           \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiCommonDefines.h $(builddir);     \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiGetExecInfoHash.x $(builddir);   \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiGetExecInfoHash.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
-
-ghiGetExecInfoHash_xdr.c: ghiGetExecInfoHash.x ghiGetExecInfoHash.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiGetExecInfoHash.x
-
-ghiProtocolHandler.h: ghiProtocolHandler.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                           \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiCommonDefines.h $(builddir);     \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiProtocolHandler.x $(builddir);   \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiProtocolHandler.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
-
-ghiProtocolHandler_xdr.c: ghiProtocolHandler.x ghiProtocolHandler.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiProtocolHandler.x
-
-ghiStartMenu.h: ghiStartMenu.x
+guestlibV3.h: guestlibV3.x
        if [ $(top_builddir) != $(top_srcdir) ]; then                           \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiCommonDefines.h $(builddir);     \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiStartMenu.x $(builddir);         \
+          cp -f $(top_srcdir)/lib/guestRpc/guestlibV3.x $(builddir);           \
        fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiStartMenu.x
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/guestlibV3.x
        $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
        mv $@.tmp $@
        $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
        cp $@ $(top_builddir)/lib/include/guestrpc
 
-ghiStartMenu_xdr.c: ghiStartMenu.x ghiStartMenu.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiStartMenu.x
-
-ghiShellAction.h: ghiShellAction.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                           \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiCommonDefines.h $(builddir);     \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiShellAction.x $(builddir);         \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiShellAction.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
+guestlibV3_xdr.c: guestlibV3.x guestlibV3.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/guestlibV3.x
 
-ghiShellAction_xdr.c: ghiShellAction.x ghiShellAction.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiShellAction.x
 
-ghiTrayIcon.h: ghiTrayIcon.x
+cpFileContents.h: cpFileContents.x
        if [ $(top_builddir) != $(top_srcdir) ]; then                           \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiCommonDefines.h $(builddir);     \
-          cp -f $(top_srcdir)/lib/guestRpc/ghiTrayIcon.x $(builddir);         \
+          cp -f $(top_srcdir)/lib/guestRpc/cpFileContents.x $(builddir); \
        fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiTrayIcon.x
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/cpFileContents.x
        $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
        mv $@.tmp $@
        $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
        cp $@ $(top_builddir)/lib/include/guestrpc
 
-ghiTrayIcon_xdr.c: ghiTrayIcon.x ghiTrayIcon.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiTrayIcon.x
+cpFileContents_xdr.c: cpFileContents.x cpFileContents.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/cpFileContents.x
 
 nicinfo.h: nicinfo.x
        if [ $(top_builddir) != $(top_srcdir) ]; then               \
@@ -194,42 +85,3 @@ nicinfo.h: nicinfo.x
 nicinfo_xdr.c: nicinfo.x nicinfo.h
        $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/nicinfo.x
 
-guestlibV3.h: guestlibV3.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                  \
-          cp -f $(top_srcdir)/lib/guestRpc/guestlibV3.x $(builddir);  \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/guestlibV3.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
-
-guestlibV3_xdr.c: guestlibV3.x guestlibV3.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/guestlibV3.x
-
-unityActive.h: unityActive.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                  \
-          cp -f $(top_srcdir)/lib/guestRpc/unityActive.x $(builddir); \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/unityActive.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
-
-unityActive_xdr.c: unityActive.x unityActive.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/unityActive.x
-
-unity.h: unity.x
-       if [ $(top_builddir) != $(top_srcdir) ]; then                  \
-          cp -f $(top_srcdir)/lib/guestRpc/unity.x $(builddir); \
-       fi
-       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/unity.x
-       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
-       mv $@.tmp $@
-       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
-       cp $@ $(top_builddir)/lib/include/guestrpc
-
-unity_xdr.c: unity.x unity.h
-       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/unity.x
-
diff --git a/open-vm-tools/lib/include/vmware/tools/unityevents.h b/open-vm-tools/lib/include/vmware/tools/unityevents.h
new file mode 100644 (file)
index 0000000..a601a34
--- /dev/null
@@ -0,0 +1,44 @@
+/*********************************************************
+ * Copyright (C) 2010 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *********************************************************/
+
+#ifndef _UNITYEVENTS_H_
+#define _UNITYEVENTS_H_
+
+/**
+ * @file unityevents.h
+ *
+ * Public interface for the "unity" plugin. This plugin (via libunity) exposes
+ * an event published when unity is entered and exited.
+ *
+ * @addtogroup vmtools_plugins
+ * @{
+ */
+
+/**
+ * Signal sent when unity is entered or exited.
+ *
+ * @param[in]  src      The source object.
+ * @param[in]  enter    If TRUE, unity has been entered. If FALSE, it
+ *                      has been exited.
+ */
+#define UNITY_SIG_ENTER_LEAVE_UNITY "unity_enter_leave_unity"
+
+/** @} */
+
+#endif /* _UNITYEVENTS_H_ */
+
diff --git a/open-vm-tools/lib/unity/Makefile.am b/open-vm-tools/lib/unity/Makefile.am
deleted file mode 100644 (file)
index 7d54f96..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-################################################################################
-### Copyright 2008 VMware, Inc.  All rights reserved.
-###
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of version 2 of the GNU General Public License as
-### published by the Free Software Foundation.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-################################################################################
-
-noinst_LTLIBRARIES = libUnity.la
-
-libUnity_la_SOURCES =
-libUnity_la_SOURCES += unity.c
-libUnity_la_SOURCES += unityPlatformX11.c
-libUnity_la_SOURCES += unityPlatformX11Settings.c
-libUnity_la_SOURCES += unityPlatformX11Window.c
-libUnity_la_SOURCES += x11Event.c
-libUnity_la_SOURCES += x11Util.c
-
-AM_CFLAGS = @GTK_CPPFLAGS@
-AM_CFLAGS += @URIPARSER_CPPFLAGS@
diff --git a/open-vm-tools/lib/unityWindowTracker/Makefile.am b/open-vm-tools/lib/unityWindowTracker/Makefile.am
deleted file mode 100644 (file)
index f7f872b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-################################################################################
-### Copyright 2008 VMware, Inc.  All rights reserved.
-###
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of version 2 of the GNU General Public License as
-### published by the Free Software Foundation.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-################################################################################
-
-noinst_LTLIBRARIES = libUnityWindowTracker.la
-
-libUnityWindowTracker_la_SOURCES =
-libUnityWindowTracker_la_SOURCES += unityWindowTracker.c
index b9eeb02e83b9d8ecffd04b4570c5e16387388ca4..bb7a7b814e50debc1c61bbe59213d0735aed90ab 100644 (file)
@@ -29,6 +29,9 @@ if HAVE_X11
    SUBDIRS += resolutionSet
 endif
 SUBDIRS += timeSync
+if ENABLE_UNITY
+   SUBDIRS += unity
+endif
 SUBDIRS += vix
 if HAVE_X11
    SUBDIRS += vixUser
diff --git a/open-vm-tools/services/plugins/unity/Makefile.am b/open-vm-tools/services/plugins/unity/Makefile.am
new file mode 100644 (file)
index 0000000..8f3bef4
--- /dev/null
@@ -0,0 +1,212 @@
+################################################################################
+### Copyright 2010 VMware, Inc.  All rights reserved.
+###
+### This program is free software; you can redistribute it and/or modify
+### it under the terms of version 2 of the GNU General Public License as
+### published by the Free Software Foundation.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program; if not, write to the Free Software
+### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+################################################################################
+
+plugindir = @VMUSR_PLUGIN_INSTALLDIR@
+plugin_LTLIBRARIES = libunity.la
+
+CFLAGS += -Wno-unused
+
+libunity_la_CPPFLAGS =
+libunity_la_CPPFLAGS += @GTK_CPPFLAGS@
+libunity_la_CPPFLAGS += @LIBPNG_CPPFLAGS@
+libunity_la_CPPFLAGS += @URIPARSER_CPPFLAGS@
+libunity_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
+libunity_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/unity/ghIntegration
+libunity_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/unity/unitylib
+libunity_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/unity/unityWindowTracker
+libunity_la_CPPFLAGS += -I$(top_builddir)/include
+
+libunity_la_LDFLAGS =
+libunity_la_LDFLAGS += @PLUGIN_LDFLAGS@
+
+libunity_la_LIBADD =
+libunity_la_LIBADD += @COMMON_XLIBS@
+libunity_la_LIBADD += @GTK_LIBS@
+libunity_la_LIBADD += @LIBPNG_LIBS@
+libunity_la_LIBADD += @URIPARSER_LIBS@
+libunity_la_LIBADD += @VMTOOLS_LIBS@
+libunity_la_LIBADD += $(top_builddir)/lib/appUtil/libAppUtil.la
+libunity_la_LIBADD += $(top_builddir)/lib/image/libImage.la
+libunity_la_LIBADD += $(top_builddir)/lib/raster/libRaster.la
+libunity_la_LIBADD += $(top_builddir)/lib/region/libRegion.la
+
+libunity_la_SOURCES =
+
+libunity_la_SOURCES += unityPlugin.cpp
+libunity_la_SOURCES += unityPluginEntry.cpp
+libunity_la_SOURCES += unityPlugin.h
+
+libunity_la_SOURCES += ghIntegration/ghIntegration.c
+libunity_la_SOURCES += ghIntegration/ghIntegrationInt.h
+libunity_la_SOURCES += ghIntegration/ghIntegrationX11.c
+
+libunity_la_SOURCES += unitylib/unity.c
+libunity_la_SOURCES += unitylib/unityDebug.h
+libunity_la_SOURCES += unitylib/unityPlatform.h
+libunity_la_SOURCES += unitylib/unityPlatformX11.c
+libunity_la_SOURCES += unitylib/unityPlatformX11Settings.c
+libunity_la_SOURCES += unitylib/unityPlatformX11Window.c
+libunity_la_SOURCES += unitylib/unityX11.h
+libunity_la_SOURCES += unitylib/x11Event.c
+libunity_la_SOURCES += unitylib/x11Util.c
+
+libunity_la_SOURCES += unityWindowTracker/unityWindowTracker.c
+
+RPCGEN_SRCS =
+RPCGEN_SRCS += ghiGetBinaryHandlers_xdr.c
+RPCGEN_SRCS += ghiGetExecInfoHash_xdr.c
+RPCGEN_SRCS += ghiProtocolHandler_xdr.c
+RPCGEN_SRCS += ghiStartMenu_xdr.c
+RPCGEN_SRCS += ghiShellAction_xdr.c
+RPCGEN_SRCS += ghiTrayIcon_xdr.c
+RPCGEN_SRCS += unityActive_xdr.c
+RPCGEN_SRCS += unity_xdr.c
+
+RPCGEN_HDRS =
+RPCGEN_HDRS += ghiGetBinaryHandlers.h
+RPCGEN_HDRS += ghiGetExecInfoHash.h
+RPCGEN_HDRS += ghiProtocolHandler.h
+RPCGEN_HDRS += ghiStartMenu.h
+RPCGEN_HDRS += ghiShellAction.h
+RPCGEN_HDRS += ghiTrayIcon.h
+RPCGEN_HDRS += unityActive.h
+RPCGEN_HDRS += unity.h
+
+BUILT_SOURCES =
+BUILT_SOURCES += $(RPCGEN_HDRS)
+BUILT_SOURCES += $(RPCGEN_SRCS)
+
+libunity_la_SOURCES += $(RPCGEN_SRCS)
+
+## `make clean` should also remove the copied headers.
+clean-local:
+       rm -rf $(top_builddir)/lib/include/guestrpc
+       if [ $(top_builddir) != $(top_srcdir) ]; then   \
+          rm -f *.x;                                   \
+          rm -f ghiCommonDefines.h;                    \
+       fi
+
+ghiGetBinaryHandlers.h: ghiGetBinaryHandlers.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiCommonDefines.h $(builddir);    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiGetBinaryHandlers.x $(builddir);\
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiGetBinaryHandlers.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+ghiGetBinaryHandlers_xdr.c: ghiGetBinaryHandlers.x ghiGetBinaryHandlers.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiGetBinaryHandlers.x
+
+ghiGetExecInfoHash.h: ghiGetExecInfoHash.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiCommonDefines.h $(builddir);    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiGetExecInfoHash.x $(builddir);  \
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiGetExecInfoHash.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+ghiGetExecInfoHash_xdr.c: ghiGetExecInfoHash.x ghiGetExecInfoHash.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiGetExecInfoHash.x
+
+ghiProtocolHandler.h: ghiProtocolHandler.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiCommonDefines.h $(builddir);    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiProtocolHandler.x $(builddir);  \
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiProtocolHandler.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+ghiProtocolHandler_xdr.c: ghiProtocolHandler.x ghiProtocolHandler.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiProtocolHandler.x
+
+ghiStartMenu.h: ghiStartMenu.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiCommonDefines.h $(builddir);    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiStartMenu.x $(builddir);        \
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiStartMenu.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+ghiStartMenu_xdr.c: ghiStartMenu.x ghiStartMenu.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiStartMenu.x
+
+ghiShellAction.h: ghiShellAction.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiCommonDefines.h $(builddir);    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiShellAction.x $(builddir);      \
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiShellAction.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+ghiShellAction_xdr.c: ghiShellAction.x ghiShellAction.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiShellAction.x
+
+ghiTrayIcon.h: ghiTrayIcon.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiCommonDefines.h $(builddir);    \
+          cp -f $(top_srcdir)/services/plugins/unity/ghiTrayIcon.x $(builddir);         \
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/ghiTrayIcon.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+ghiTrayIcon_xdr.c: ghiTrayIcon.x ghiTrayIcon.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/ghiTrayIcon.x
+
+unityActive.h: unityActive.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/unityActive.x $(builddir);         \
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/unityActive.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+unityActive_xdr.c: unityActive.x unityActive.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/unityActive.x
+
+unity.h: unity.x
+       if [ $(top_builddir) != $(top_srcdir) ]; then                                    \
+          cp -f $(top_srcdir)/services/plugins/unity/unity.x $(builddir);               \
+       fi
+       $(RPCGEN) $(RPCGENFLAGS) -h -o $@ $(builddir)/unity.x
+       $(SED) 's,rpc/rpc\.h,vmxrpc.h,' $@ > $@.tmp
+       mv $@.tmp $@
+       $(MKDIR_P) $(top_builddir)/lib/include/guestrpc
+       cp $@ $(top_builddir)/lib/include/guestrpc
+
+unity_xdr.c: unity.x unity.h
+       $(RPCGEN) $(RPCGENFLAGS) -c -o $@ $(builddir)/unity.x
+
similarity index 99%
rename from open-vm-tools/lib/ghIntegration/ghIntegrationX11.c
rename to open-vm-tools/services/plugins/unity/ghIntegration/ghIntegrationX11.c
index 9c2d0dc77f3dadf47f37f6726c7be5baa81f369f..52de510374eb98eb455d7f86c59d171e71fa001b 100644 (file)
@@ -62,6 +62,7 @@
 #include "system.h"
 #include "codeset.h"
 #include "imageUtil.h"
+#include "str.h"
 #include "strutil.h"
 #include <paths.h>
 #include "vm_atomic.h"
similarity index 99%
rename from open-vm-tools/lib/guestRpc/unity.x
rename to open-vm-tools/services/plugins/unity/unity.x
index fd205b8ace9eca014776bd3de726986c24d0ba27..ff9bd9fbd7b13ea93c3ad881c53ba5dc2ed75b99 100644 (file)
@@ -237,4 +237,4 @@ struct UnityMouseWheelV1
 union UnityMouseWheel switch (UnityMouseWheelVersion ver) {
 case UNITY_MOUSE_WHEEL_V1:
    struct UnityMouseWheelV1 *mouseWheelV1;
-};--- lib/unityWindowTracker/unityWindowTracker.c 
+}
diff --git a/open-vm-tools/services/plugins/unity/unityPlugin.cpp b/open-vm-tools/services/plugins/unity/unityPlugin.cpp
new file mode 100644 (file)
index 0000000..222f6fd
--- /dev/null
@@ -0,0 +1,161 @@
+/*********************************************************
+ * Copyright (C) 2010 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *********************************************************/
+
+/**
+ * @file unityPlugin.cpp
+ *
+ *    Implements an object that provides the entry points for tools unity plugin.
+ */
+
+extern "C" {
+   #include "vmware.h"
+   #include "conf.h"
+   #include "ghIntegration.h"
+   #include "unity.h"
+   #include "unityDebug.h"
+};
+
+#include "unityPlugin.h"
+#include "unityInt.h"
+#include "ghIntegrationInt.h"
+
+#define UNITY_CAP_NAME "unity"
+
+namespace vmware { namespace tools {
+
+/**
+ * Constructor for the Unity plugin, initialized Unity, and common options values
+ *
+ * @param[in]  ctx      Host application context.
+ *
+ */
+
+UnityPlugin::UnityPlugin(ToolsAppCtx *ctx)
+{
+   ASSERT(ctx);
+
+   Unity_Init(NULL, NULL, NULL, ctx);
+
+   GHI_Init(ctx);
+
+   if (g_key_file_get_boolean(ctx->config, CONFGROUPNAME_UNITY,
+                              CONFNAME_UNITY_ENABLEDEBUG, NULL)) {
+         UnityDebug_Init(&unity.tracker);
+   }
+   unity.forceEnable = g_key_file_get_boolean(ctx->config, CONFGROUPNAME_UNITY,
+                                              CONFNAME_UNITY_FORCEENABLE, NULL);
+
+   /*
+    * If no preferred color is in the config file then use a light gray tone,
+    * the value is stored as xBGR.
+    */
+   int desktopColor = 0;
+   GError *e = NULL;
+   desktopColor = g_key_file_get_integer(ctx->config, CONFGROUPNAME_UNITY,
+                                         CONFNAME_UNITY_BACKGROUNDCOLOR, &e);
+   if (e != NULL) {
+      desktopColor = /* red */ 0xdc |
+                     /* green */ 0xdc << 8 |
+                     /* blue */ 0xdc << 16;
+   }
+   UnityPlatformSetConfigDesktopColor(unity.up, desktopColor);
+}
+
+
+/**
+ * Called by the service core when the host requests the capabilities supported
+ * by the guest tools.
+ *
+ * @param[in]  set      Whether capabilities are being set or unset.
+ *
+ * @return A list of capabilities to be sent to the host.
+ */
+
+std::vector<ToolsAppCapability>
+UnityPlugin::GetCapabilities(gboolean set)
+{
+   std::vector<ToolsAppCapability> 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.
+    */
+   capsVector.push_back(ToolsAppCapabilityOldEntry(UNITY_CAP_NAME, Unity_IsSupported() ? 1 : 0));
+
+   capsVector.push_back(ToolsAppCapabilityNewEntry(UNITY_CAP_STATUS_UNITY_ACTIVE, TRUE));
+
+   return capsVector;
+}
+
+
+/**
+ * Called by the service core when the host requests the RPCs supported
+ * by the guest tools.
+ *
+ * @return A list of RPC Callbacks to be sent to the host.
+ */
+
+std::vector<RpcChannelCallback>
+UnityPlugin::GetRpcCallbackList()
+{
+   std::vector<RpcChannelCallback> rpcList;
+
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_ENTER, UnityTcloEnter));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_UPDATE_FULL, UnityTcloGetUpdate));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_UPDATE_INCREMENTAL, UnityTcloGetUpdate));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_WINDOW_PATH, UnityTcloGetWindowPath));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_WINDOW_SETTOP, UnityTcloSetTopWindowGroup));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_WINDOW_CONTENTS, UnityTcloGetWindowContents));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_ICON_DATA, UnityTcloGetIconData));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_DESKTOP_WORK_AREA_SET, UnityTcloSetDesktopWorkArea));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_SHOW_TASKBAR, UnityTcloShowTaskbar));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_EXIT, UnityTcloExit));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_WINDOW_MOVE_RESIZE, UnityTcloMoveResizeWindow));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_DESKTOP_CONFIG_SET, UnityTcloSetDesktopConfig));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_DESKTOP_ACTIVE_SET, UnityTcloSetDesktopActive));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_WINDOW_DESKTOP_SET, UnityTcloSetWindowDesktop));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_CONFIRM_OPERATION, UnityTcloConfirmOperation));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_SET_OPTIONS, UnityTcloSetUnityOptions));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_WINDOW_CONTENTS_REQUEST, UnityTcloRequestWindowContents));
+   rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_SEND_MOUSE_WHEEL, UnityTcloSendMouseWheel));
+
+   if (GHI_IsSupported()) {
+      rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_BINARY_INFO, GHITcloGetBinaryInfo));
+      rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_OPEN_LAUNCHMENU, GHITcloOpenStartMenu));
+      rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_LAUNCHMENU_ITEM, GHITcloGetStartMenuItem));
+      rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_CLOSE_LAUNCHMENU, GHITcloCloseStartMenu));
+      rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_SHELL_OPEN, GHITcloShellOpen));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_GUEST_SHELL_ACTION, GHITcloShellAction));
+      rpcList.push_back(RpcChannelCallbackEntry(UNITY_RPC_GET_BINARY_HANDLERS, GHITcloGetBinaryHandlers));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_SET_GUEST_HANDLER, GHITcloSetGuestHandler));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_RESTORE_DEFAULT_GUEST_HANDLER, GHITcloRestoreDefaultGuestHandler));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_OUTLOOK_SET_TEMP_FOLDER, GHITcloSetOutlookTempFolder));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_OUTLOOK_RESTORE_TEMP_FOLDER, GHITcloRestoreOutlookTempFolder));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_TRASH_FOLDER_ACTION, GHITcloTrashFolderAction));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_TRASH_FOLDER_GET_ICON, GHITcloTrashFolderGetIcon));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_TRAY_ICON_SEND_EVENT, GHITcloTrayIconSendEvent));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_TRAY_ICON_START_UPDATES, GHITcloTrayIconStartUpdates));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_TRAY_ICON_STOP_UPDATES, GHITcloTrayIconStopUpdates));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_SET_FOCUSED_WINDOW, GHITcloSetFocusedWindow));
+      rpcList.push_back(RpcChannelCallbackEntry(GHI_RPC_GET_EXEC_INFO_HASH, GHITcloGetExecInfoHash));
+   }
+
+   return rpcList;
+}
+
+} /* namespace tools */ } /* namespace vmware */
diff --git a/open-vm-tools/services/plugins/unity/unityPlugin.h b/open-vm-tools/services/plugins/unity/unityPlugin.h
new file mode 100644 (file)
index 0000000..750c2ec
--- /dev/null
@@ -0,0 +1,213 @@
+/*********************************************************
+ * Copyright (C) 2010 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *********************************************************/
+
+#ifndef _UNITY_PLUGIN_H_
+#define _UNITY_PLUGIN_H_
+
+/**
+ * @file unityPlugin.h
+ *
+ *    Defines the object that implements the tools core service plugin form of Unity.
+ *
+ * @addtogroup vmtools_plugins
+ * @{
+ */
+
+#include <string>
+#include <vector>
+
+#include "vmware/tools/plugin.h"
+
+namespace vmware { namespace tools {
+
+/**
+ * Helper struct to build an RPCChannelCallback structure from a name and a
+ * simple function pointer that takes an RPCInData pointer.
+ *
+ * @param[in]  RpcName   RPC Name.
+ * @param[in]  func      RPC Callback Function Pointer.
+ *
+ */
+
+struct RpcChannelCallbackEntry  : public RpcChannelCallback {
+   RpcChannelCallbackEntry(const char *RpcName, RpcIn_Callback func)
+   {
+      name = RpcName;
+      callback = func;
+      clientData = NULL;
+      xdrIn = NULL;
+      xdrOut = NULL;
+      xdrInSize = 0;
+   }
+};
+
+
+/**
+ * Helper struct to build an ToolsAppCapability structure from an old style
+ * capability name and flag to indicate whether the capability is enabled.
+ *
+ * @param[in]  capName   Old style capabilty name.
+ * @param[in]  enabled   True if the capability is enabled.
+ *
+ */
+
+struct ToolsAppCapabilityOldEntry : public ToolsAppCapability {
+   ToolsAppCapabilityOldEntry(const char *capName, gboolean enabled)
+   {
+      type = TOOLS_CAP_OLD;
+      /* The capability name field is not-const (though it seems to be treated that way)
+       * so we'll need to cast away the const here 8-(
+       */
+      name = const_cast<gchar*>(capName);
+      value = enabled;
+   }
+};
+
+
+/**
+ * Helper struct to build an ToolsAppCapability structure from a new style
+ * capability index and flag to indicate whether the capability is enabled.
+ *
+ * @param[in]  cap       GuestCapabilities index.
+ * @param[in]  enabled   True if the capability is enabled.
+ *
+ */
+
+struct ToolsAppCapabilityNewEntry : public ToolsAppCapability {
+   ToolsAppCapabilityNewEntry(GuestCapabilities cap, gboolean enabled)
+   {
+      type = TOOLS_CAP_NEW;
+      name = NULL;
+      index = cap;
+      value = enabled;
+   }
+};
+
+
+/**
+ * Defines a pure virtual interface for plugins to implement. These methods
+ * are called by per-plugin static C functions in the the plugin entry module.
+ */
+
+class ToolsPlugin {
+public:
+   virtual ~ToolsPlugin() {};
+
+   /**
+    * Handles a reset signal. This callback is called when the service receives a
+    * "reset" message from the VMX, meaning the VMX may be restarting the RPC
+    * channel (due, for example, to restoring a snapshot, resuming a VM or a VMotion),
+    * and should be used to reset any plugin state that depends on the VMX.
+    *
+    * @param[in]  src      Event source.
+    *
+    * @return TRUE on success.
+    */
+
+   virtual gboolean Reset(gpointer src) = 0;
+
+   /**
+    * Handles a shutdown callback; This is called before the service is shut down,
+    * and should be used to clean up any resources that were initialized by the plugin.
+    *
+    * @param[in]  src      The source object.
+    */
+
+   virtual void Shutdown(gpointer src) = 0;
+
+   /**
+    * Handles a "Set_Option" callback. This callback is called when the VMX sends
+    * a "Set_Option" command to tools, to configure different options whose values
+    * are kept outside of the virtual machine.
+    *
+    * @param[in]  src      Event source.
+    * @param[in]  option   Option being set.
+    * @param[in]  value    Option value.
+    *
+    * @return TRUE on success.
+    */
+
+   virtual gboolean SetOption(gpointer src,
+                              const std::string &option,
+                              const std::string &value) = 0;
+
+   /**
+    * Called by the service core when the host requests the capabilities supported
+    * by the guest tools.
+    *
+    * @param[in]  set      Whether capabilities are being set or unset.
+    *
+    * @return A list of capabilities to be sent to the host.
+    */
+
+   virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set) = 0;
+
+   /**
+    * Called by the service core when the host requests the RPCs supported
+    * by the guest tools.
+    *
+    * @return A list of RPC Callbacks to be sent to the host.
+    */
+
+   virtual std::vector<RpcChannelCallback> GetRpcCallbackList() = 0;
+
+#if defined(G_PLATFORM_WIN32)
+   /**
+    * Handles a session state change callback; this is only called on Windows,
+    * from both the "vmsvc" instance (handled by SCM notifications) and from
+    * "vmusr" with the "fast user switch" plugin.
+    *
+    * @param[in]  src         The source object.
+    * @param[in]  stateCode   Session state change code.
+    * @param[in]  sessionID   Session ID.
+    */
+
+   virtual void SessionChange(gpointer src, DWORD stateCode, DWORD sessionID) = 0;
+#endif // G_PLATFORM_WIN32
+};
+
+
+class UnityPlugin  : public ToolsPlugin {
+public:
+   UnityPlugin(ToolsAppCtx *ctx);
+   virtual ~UnityPlugin() {};
+
+   virtual gboolean Reset(gpointer src) { return TRUE; }
+   virtual void Shutdown(gpointer src) {};
+   virtual gboolean SetOption(gpointer src, const std::string &option, const std::string &value)
+   {
+      return FALSE;
+   }
+   virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set);
+   virtual std::vector<RpcChannelCallback> GetRpcCallbackList();
+};
+
+#ifdef _WIN32
+class UnityPluginWin32 : public UnityPlugin {
+public:
+   UnityPluginWin32(ToolsAppCtx *ctx) : UnityPlugin(ctx) {};
+   virtual ~UnityPluginWin32() {};
+
+   virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set);
+   virtual void SessionChange(gpointer src, DWORD code, DWORD id) {};
+};
+#endif // _WIN32
+
+} /* namespace tools */ } /* namespace vmware */
+
+#endif // _UNITY_PLUGIN_H_
diff --git a/open-vm-tools/services/plugins/unity/unityPluginEntry.cpp b/open-vm-tools/services/plugins/unity/unityPluginEntry.cpp
new file mode 100644 (file)
index 0000000..0c7d3cd
--- /dev/null
@@ -0,0 +1,210 @@
+/*********************************************************
+ * Copyright (C) 2009 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *********************************************************/
+
+/**
+ * @file unityPlugin.c
+ *
+ *    Implements the unity plugin for the tools services. Registers for the Unity
+ *    RPC's and sets the Unity capabilities.
+ */
+
+#define G_LOG_DOMAIN "unity"
+
+#include "unityPlugin.h"
+
+extern "C" {
+   #include "util.h"
+   // guestrpc.h defines the RPCIn_Callback which is needed in rpcin.h which is in turn
+   // included by unity.h - so guestrpc.h must precede unity.h
+   #include "vmware/tools/guestrpc.h"
+   #include "unity.h"
+   #include "vmware/tools/plugin.h"
+   #include "vmware/tools/utils.h"
+};
+
+extern "C" {
+   TOOLS_MODULE_EXPORT ToolsPluginData *ToolsOnLoad(ToolsAppCtx *ctx);
+};
+
+using namespace vmware::tools;
+
+/**
+ * Called by the service core when the host requests the capabilities supported
+ * by the guest tools.
+ *
+ * @param[in]  src      Unused.
+ * @param[in]  ctx      The app context.
+ * @param[in]  set      Whether capabilities are being set or unset (unused).
+ * @param[in]  plugin   Plugin registration data.
+ *
+ * @return A list of capabilities to be sent to the host.
+ */
+
+static GArray *
+UnityPluginCapabilities(gpointer src,
+                        ToolsAppCtx *ctx,
+                        gboolean set,
+                        ToolsPluginData *plugin)
+{
+   ToolsPlugin *pluginInstance = reinterpret_cast<ToolsPlugin*>(plugin->_private);
+   ASSERT(pluginInstance);
+
+   std::vector<ToolsAppCapability> capabilities = pluginInstance->GetCapabilities(set);
+
+   g_debug("%s: got capability signal, setting = %d.\n", __FUNCTION__, set);
+   return VMTools_WrapArray(&capabilities[0], sizeof capabilities[0], capabilities.size());
+}
+
+
+/**
+ * Handles a reset signal; just logs debug information. This callback is
+ * called when the service receives a "reset" message from the VMX, meaning
+ * the VMX may be restarting the RPC channel (due, for example, to restoring
+ * a snapshot, resuming a VM or a VMotion), and should be used to reset any
+ * application state that depends on the VMX.
+ *
+ * @param[in]  src      Event source.
+ * @param[in]  ctx      The app context.
+ * @param[in]  plugin   Plugin registration data.
+ *
+ * @return TRUE on success.
+ */
+
+static gboolean
+UnityPluginReset(gpointer src,
+                 ToolsAppCtx *ctx,
+                 ToolsPluginData *plugin)
+{
+   ASSERT(ctx != NULL);
+   g_debug("%s: reset signal for app %s\n", __FUNCTION__, ctx->name);
+
+   ToolsPlugin *pluginInstance = reinterpret_cast<ToolsPlugin*>(plugin->_private);
+   ASSERT(pluginInstance);
+
+   return pluginInstance->Reset(src);
+}
+
+
+
+/**
+ * Handles a shutdown callback; just logs debug information. This is called
+ * before the service is shut down, and should be used to clean up any resources
+ * that were initialized by the application.
+ *
+ * @param[in]  src      The source object.
+ * @param[in]  ctx      The app context.
+ * @param[in]  plugin   Plugin registration data.
+ */
+
+static void
+UnityPluginShutdown(gpointer src,
+                    ToolsAppCtx *ctx,
+                    ToolsPluginData *plugin)
+{
+   g_debug("%s: shutdown signal.\n", __FUNCTION__);
+
+   ToolsPlugin *pluginInstance = reinterpret_cast<ToolsPlugin*>(plugin->_private);
+   ASSERT(pluginInstance);
+
+   pluginInstance->Shutdown(src);
+
+   delete pluginInstance;
+   plugin->_private = NULL;
+}
+
+
+/**
+ * Handles a "Set_Option" callback. Just logs debug information. This callback
+ * is called when the VMX sends a "Set_Option" command to tools, to configure
+ * different options whose values are kept outside of the virtual machine.
+ *
+ * @param[in]  src      Event source.
+ * @param[in]  ctx      The app context.
+ * @param[in]  plugin   Plugin registration data.
+ * @param[in]  option   Option being set.
+ * @param[in]  value    Option value.
+ *
+ * @return TRUE on success.
+ */
+
+static gboolean
+UnityPluginSetOption(gpointer src,
+                     ToolsAppCtx *ctx,
+                     const gchar *option,
+                     const gchar *value,
+                     ToolsPluginData *plugin)
+{
+   g_debug("%s: set '%s' to '%s'\n", __FUNCTION__, option, value);
+   ToolsPlugin *pluginInstance = reinterpret_cast<ToolsPlugin*>(plugin->_private);
+   ASSERT(pluginInstance);
+
+   return pluginInstance->SetOption(src, std::string(option), std::string(value));
+}
+
+
+/**
+ * Plugin entry point. Returns the registration data. This is called once when
+ * the plugin is loaded into the service process.
+ *
+ * @param[in]  ctx   The app context.
+ *
+ * @return The registration data.
+ */
+
+TOOLS_MODULE_EXPORT ToolsPluginData *
+ToolsOnLoad(ToolsAppCtx *ctx)
+{
+   static ToolsPluginData regData = {
+      "unity",
+      NULL,
+      NULL
+   };
+
+   ToolsPluginSignalCb sigs[] = {
+      { TOOLS_CORE_SIG_RESET, (void *) UnityPluginReset, &regData },
+      { TOOLS_CORE_SIG_SHUTDOWN, (void *) UnityPluginShutdown, &regData },
+      { TOOLS_CORE_SIG_CAPABILITIES, (void *) UnityPluginCapabilities, &regData },
+      { TOOLS_CORE_SIG_SET_OPTION, (void *) UnityPluginSetOption, &regData },
+   };
+
+   ToolsPlugin *pluginInstance = NULL;
+
+#if WIN32
+   pluginInstance = new UnityPluginWin32(ctx);
+#else // Linux
+   pluginInstance = new UnityPlugin(ctx);
+#endif
+
+   if (!pluginInstance) {
+      // There's nothing we can do if we can't construct the plugin instance
+      return NULL;
+   }
+   regData._private = pluginInstance;
+
+   std::vector<RpcChannelCallback> rpcs = pluginInstance->GetRpcCallbackList();
+
+   ToolsAppReg regs[] = {
+      { TOOLS_APP_GUESTRPC, VMTools_WrapArray(&rpcs[0], sizeof rpcs[0], rpcs.size()) },
+      { TOOLS_APP_SIGNALS, VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
+   };
+
+   regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs));
+
+   return &regData;
+}
+
diff --git a/open-vm-tools/services/plugins/unity/unitylib/unityInt.h b/open-vm-tools/services/plugins/unity/unitylib/unityInt.h
new file mode 100644 (file)
index 0000000..4e9e96f
--- /dev/null
@@ -0,0 +1,81 @@
+/*********************************************************
+ * Copyright (C) 2010 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *********************************************************/
+
+#ifndef _UNITYINT_H_
+#define _UNITYINT_H_
+
+/**
+ * @file unityInt.h
+ *
+ *    Internal function prototypes.
+ *
+ * @addtogroup vmtools_plugins
+ * @{
+ */
+
+#include "unityWindowTracker.h"
+#include "unity.h"
+#include "unityPlatform.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#include "vmware/tools/guestrpc.h"
+#include "rpcin.h"
+
+/*
+ * Singleton object for tracking the state of the service.
+ */
+typedef struct UnityState {
+   UnityWindowTracker tracker;
+   Bool forceEnable;
+   Bool isEnabled;
+   uint32 currentOptions;                       // Last feature mask received via 'set.options'
+   UnityVirtualDesktopArray virtDesktopArray;   // Virtual desktop configuration
+   UnityUpdateChannel updateChannel;            // Unity update transmission channel.
+   UnityPlatform *up; // Platform-specific state
+} UnityState;
+
+extern UnityState unity;
+
+
+RpcInRet UnityTcloEnter(RpcInData *data);
+RpcInRet UnityTcloGetUpdate(RpcInData *data);
+RpcInRet UnityTcloExit(RpcInData *data);
+RpcInRet UnityTcloGetWindowPath(RpcInData *data);
+RpcInRet UnityTcloWindowCommand(RpcInData *data);
+RpcInRet UnityTcloGetWindowContents(RpcInData *data);
+RpcInRet UnityTcloGetIconData(RpcInData *data);
+RpcInRet UnityTcloSetDesktopWorkArea(RpcInData *data);
+RpcInRet UnityTcloSetTopWindowGroup(RpcInData *data);
+RpcInRet UnityTcloShowTaskbar(RpcInData *data);
+RpcInRet UnityTcloMoveResizeWindow(RpcInData *data);
+RpcInRet UnityTcloSetDesktopConfig(RpcInData *data);
+RpcInRet UnityTcloSetDesktopActive(RpcInData *data);
+RpcInRet UnityTcloSetWindowDesktop(RpcInData *data);
+RpcInRet UnityTcloConfirmOperation(RpcInData *data);
+RpcInRet UnityTcloSetUnityOptions(RpcInData *data);
+RpcInRet UnityTcloRequestWindowContents(RpcInData *data);
+RpcInRet UnityTcloSendMouseWheel(RpcInData *data);
+
+#ifdef __cplusplus
+};
+#endif // __cplusplus
+
+#endif // _UNITYINT_H_