aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDRC <dcommander@users.sourceforge.net>2011-10-05 09:29:21 +0000
committerDRC <dcommander@users.sourceforge.net>2011-10-05 09:29:21 +0000
commitf50ec7c5504f708fafd7ee711f6524b327d3c783 (patch)
tree6076eabf3890f9fa1999d12e75012b97dd2a0df5
parentd000252926e7de93c62937df7cf5cd06cde5e8d7 (diff)
downloadtigervnc-f50ec7c5504f708fafd7ee711f6524b327d3c783.tar.gz
tigervnc-f50ec7c5504f708fafd7ee711f6524b327d3c783.zip
Fix WinVNC so that it embeds and serves up the Java viewer whenever BUILD_JAVA=1
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4704 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--java/src/CMakeLists.txt13
-rw-r--r--win/winvnc/CMakeLists.txt14
-rw-r--r--win/winvnc/JavaViewer.cxx5
-rw-r--r--win/winvnc/index.vnc23
-rw-r--r--win/winvnc/winvnc.rc.in (renamed from win/winvnc/winvnc.rc)4
5 files changed, 42 insertions, 17 deletions
diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt
index 7048dd91..a6b4ec8a 100644
--- a/java/src/CMakeLists.txt
+++ b/java/src/CMakeLists.txt
@@ -73,6 +73,7 @@ add_custom_command(OUTPUT ${JAVA_BINDIR}/tigervnc.ico
DEPENDS ${JAVA_SRCDIR}/tigervnc.ico)
string(REGEX REPLACE "jar" "" Java_PATH ${Java_JAR_EXECUTABLE})
+string(REGEX REPLACE ".exe" "" Java_PATH ${Java_PATH})
add_custom_command(OUTPUT VncViewer.jar
DEPENDS ${JAVA_CLASSES_FULL}
@@ -98,8 +99,10 @@ add_custom_command(OUTPUT VncViewer.jar
add_custom_target(java ALL DEPENDS VncViewer.jar)
-install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/VncViewer.jar
- ${JAVA_SRCDIR}/README
- ${JAVA_SRCDIR}/index.vnc
- DESTINATION vnc/classes)
+if(NOT WIN32)
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/VncViewer.jar
+ ${JAVA_SRCDIR}/README
+ ${JAVA_SRCDIR}/index.vnc
+ DESTINATION vnc/classes)
+endif()
diff --git a/win/winvnc/CMakeLists.txt b/win/winvnc/CMakeLists.txt
index 811492c2..6b873c71 100644
--- a/win/winvnc/CMakeLists.txt
+++ b/win/winvnc/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${CMAKE_BINARY_DIR}/win)
+include_directories(${CMAKE_BINARY_DIR}/win ${CMAKE_CURRENT_SOURCE_DIR})
# Disable auto-generated manifests, since we have our own
if(MSVC)
@@ -10,6 +10,11 @@ add_library(wm_hooks SHARED
../wm_hooks/wm_hooks.def
../wm_hooks/wm_hooks.rc)
+string(REGEX REPLACE "/" "\\\\\\\\" CMAKE_WIN_BINARY_DIR ${CMAKE_BINARY_DIR})
+string(REGEX REPLACE "/" "\\\\\\\\" CMAKE_WIN_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+
+configure_file(winvnc.rc.in winvnc.rc)
+
add_executable(winvnc4 WIN32
buildTime.cxx
ControlPanel.cxx
@@ -20,10 +25,15 @@ add_executable(winvnc4 WIN32
VNCServerService.cxx
VNCServerWin32.cxx
winvnc.cxx
- winvnc.rc)
+ ${CMAKE_CURRENT_BINARY_DIR}/winvnc.rc)
target_link_libraries(winvnc4 rfb rfb_win32 Xregion network rdr ws2_32.lib)
+if(BUILD_JAVA)
+ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/winvnc.rc
+ PROPERTIES OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/java/src/VncViewer.jar)
+endif()
+
install(TARGETS winvnc4
RUNTIME DESTINATION .
)
diff --git a/win/winvnc/JavaViewer.cxx b/win/winvnc/JavaViewer.cxx
index ca9c285f..39ff915a 100644
--- a/win/winvnc/JavaViewer.cxx
+++ b/win/winvnc/JavaViewer.cxx
@@ -94,5 +94,10 @@ char* JavaViewerServer::substitute(const char* varName)
if (strcmp(varName, "$DESKTOP") == 0) {
return rfb::strDup(server->getName());
}
+ if (strcmp(varName, "$USER") == 0) {
+ char tempStr[256]; DWORD tempStrLen = 256;
+ GetUserName(tempStr, &tempStrLen);
+ return rfb::strDup(tempStr);
+ }
return 0;
}
diff --git a/win/winvnc/index.vnc b/win/winvnc/index.vnc
index aecb6131..428d4bc8 100644
--- a/win/winvnc/index.vnc
+++ b/win/winvnc/index.vnc
@@ -1,13 +1,20 @@
+<!--
+ index.vnc - default HTML page for TigerVNC Java viewer applet, to be
+ used with WinVNC. On any file ending in .vnc, the HTTP server embedded in
+ WinVNC will substitute the following variables when preceded by a dollar:
+ USER, DESKTOP, APPLETWIDTH, APPLETHEIGHT, WIDTH, HEIGHT, PORT,
+ Use two dollar signs ($$) to get a dollar sign in the generated
+ HTML page.
+-->
+
<HTML>
-<HEAD>
<TITLE>
-VNC viewer for Java
+$USER's $DESKTOP desktop
</TITLE>
-</HEAD>
-<BODY>
-<APPLET CODE=vncviewer/VNCViewer.class ARCHIVE=vncviewer.jar
- WIDTH=400 HEIGHT=250>
-<PARAM name="port" value="$PORT">
+<APPLET CODE=com.tigervnc.vncviewer.VncViewer ARCHIVE=VncViewer.jar
+ WIDTH=$APPLETWIDTH HEIGHT=$APPLETHEIGHT>
+<param name=PORT value=$PORT>
</APPLET>
-</BODY>
+<BR>
+<A href="http://www.tigervnc.org/">TigerVNC site</A>
</HTML>
diff --git a/win/winvnc/winvnc.rc b/win/winvnc/winvnc.rc.in
index 9c503500..93520060 100644
--- a/win/winvnc/winvnc.rc
+++ b/win/winvnc/winvnc.rc.in
@@ -220,8 +220,8 @@ END
// HTTPFILE
//
-//VNCVIEWER.JAR HTTPFILE DISCARDABLE "..\\..\\java\\src\\com\\tigervnc\\vncviewer\\VncViewer.jar"
-//INDEX.VNC HTTPFILE DISCARDABLE "index.vnc"
+/VNCVIEWER.JAR HTTPFILE DISCARDABLE "@CMAKE_WIN_BINARY_DIR@\\java\\src\\VncViewer.jar"
+/INDEX.VNC HTTPFILE DISCARDABLE "@CMAKE_WIN_SOURCE_DIR@\\win\\winvnc\\index.vnc"
/////////////////////////////////////////////////////////////////////////////
//