summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-02-06 16:56:55 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-02-06 16:56:55 +0100
commitf3f392caec43b4095bc1d84b315ed7972c13c144 (patch)
tree5c4ba8b5d38f1ae33de71507c5634a15a0b35bfe /examples
parent8c081c8888bccbf5adfe0fc4ec518e2cbfba9871 (diff)
parent0a70095271d845d16a3ed17354841b01f33963ad (diff)
downloadlibtdevnc-f3f392caec43b4095bc1d84b315ed7972c13c144.tar.gz
libtdevnc-f3f392caec43b4095bc1d84b315ed7972c13c144.zip
Merge tag 'LibVNCServer-0.9.12'
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am27
-rw-r--r--examples/android/Makefile.am7
-rw-r--r--examples/android/README63
-rw-r--r--examples/android/jni/Android.mk65
-rw-r--r--examples/androidvncserver.c (renamed from examples/android/jni/fbvncserver.c)17
-rw-r--r--examples/repeater.c10
-rw-r--r--examples/vncev.c6
7 files changed, 22 insertions, 173 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
deleted file mode 100644
index 829f735..0000000
--- a/examples/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)
-LDADD = ../libvncserver/libvncserver.la @WSOCKLIB@
-
-if OSX
-MAC=mac
-mac_LDFLAGS=-framework ApplicationServices -framework Carbon -framework IOKit
-endif
-
-if ANDROID
-SUBDIRS=android
-endif
-
-if WITH_TIGHTVNC_FILETRANSFER
-FILETRANSFER=filetransfer
-endif
-
-if HAVE_LIBPTHREAD
-BLOOPTEST=blooptest
-endif
-
-noinst_HEADERS=radon.h rotatetemplate.c
-
-noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \
- vncev storepasswd colourmaptest simple simple15 $(MAC) \
- $(FILETRANSFER) backchannel $(BLOOPTEST) camera rotate \
- zippy repeater
-
diff --git a/examples/android/Makefile.am b/examples/android/Makefile.am
deleted file mode 100644
index 9cb5c02..0000000
--- a/examples/android/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)
-LDADD = $(top_srcdir)/libvncserver/libvncserver.la @WSOCKLIB@
-
-noinst_PROGRAMS=androidvncserver
-androidvncserver_SOURCES=jni/fbvncserver.c
-
-EXTRA_DIST=jni/Android.mk
diff --git a/examples/android/README b/examples/android/README
deleted file mode 100644
index 57e14cf..0000000
--- a/examples/android/README
+++ /dev/null
@@ -1,63 +0,0 @@
-
-This example VNC server for Android is adopted from
-http://code.google.com/p/android-vnc-server/ with some additional
-fixes applied.
-
-To build, you'll need the Android Native Development Kit from
-http://developer.android.com/sdk/ndk/.
-
-
-Building with autotools
------------------------
-
-This has the advantage that the LibVNCServer sources are properly set up
-using the configure script.
-
-1. Read <NDK location>/docs/STANDALONE-TOOLCHAIN.html.
-
-2. Setup your toolchain according to step 3 in the above file.
-
-3. Execute
-
- ./configure --host=arm-eabi CC=arm-linux-androideabi-gcc
-
- in the LibVNCServer root directory.
-
-4. Execute
-
- make
-
- in the LibVNCServer root directory. This will build the whole
- LibVNCServer distribution for Android, including androidvncserver.
-
-
-
-
-Building with the NDK build system
-----------------------------------
-
-This is probably easier than the autotools method, but you'll have to edit
-some files manually.
-
-1. Edit rfb/rfbconfig.h to match your Android target. For instance, comment out
- LIBVNCSERVER_HAVE_LIBJPEG if you don't have libjpeg for Android.
-
-2. Edit the HAVE_X variables in jni/Android.mk accordingly.
-
-3. Execute
-
- ndk-build -C .
-
- in the examples/android directory. The resulting binary will be in libs/.
-
-
-
-Installing && Running
----------------------
-
-This can be done via
-
- adb push androidvncserver /data/local/
- adb shell /data/local/androidvncserver
-
-
diff --git a/examples/android/jni/Android.mk b/examples/android/jni/Android.mk
deleted file mode 100644
index 731a790..0000000
--- a/examples/android/jni/Android.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LIBVNCSERVER_ROOT:=../../..
-
-HAVE_LIBZ=1
-#HAVE_LIBJPEG=1
-
-ifdef HAVE_LIBZ
-ZLIBSRCS := \
- $(LIBVNCSERVER_ROOT)/libvncserver/zlib.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/zrle.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/zrleoutstream.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/zrlepalettehelper.c \
- $(LIBVNCSERVER_ROOT)/common/zywrletemplate.c
-ifdef HAVE_LIBJPEG
-TIGHTSRCS := $(LIBVNCSERVER_ROOT)/libvncserver/tight.c
-endif
-endif
-
-LOCAL_SRC_FILES:= \
- fbvncserver.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/main.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/rfbserver.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/rfbregion.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/auth.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/sockets.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/stats.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/corre.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/hextile.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/rre.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/translate.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/cutpaste.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/httpd.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/cursor.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/font.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/draw.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/selbox.c \
- $(LIBVNCSERVER_ROOT)/common/d3des.c \
- $(LIBVNCSERVER_ROOT)/common/vncauth.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/cargs.c \
- $(LIBVNCSERVER_ROOT)/common/minilzo.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/ultra.c \
- $(LIBVNCSERVER_ROOT)/libvncserver/scale.c \
- $(ZLIBSRCS) \
- $(TIGHTSRCS)
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH) \
- $(LOCAL_PATH)/$(LIBVNCSERVER_ROOT)/libvncserver \
- $(LOCAL_PATH)/$(LIBVNCSERVER_ROOT)/common \
- $(LOCAL_PATH)/$(LIBVNCSERVER_ROOT) \
- external/jpeg
-
-ifdef HAVE_LIBZ
-LOCAL_SHARED_LIBRARIES := libz
-LOCAL_LDLIBS := -lz
-endif
-ifdef HAVE_LIBJPEG
-LOCAL_STATIC_LIBRARIES := libjpeg
-endif
-
-LOCAL_MODULE:= androidvncserver
-
-include $(BUILD_EXECUTABLE)
diff --git a/examples/android/jni/fbvncserver.c b/examples/androidvncserver.c
index a8c4827..885a7ef 100644
--- a/examples/android/jni/fbvncserver.c
+++ b/examples/androidvncserver.c
@@ -1,5 +1,10 @@
/*
- * $Id$
+ * This example VNC server for Android is adopted from
+ * http://code.google.com/p/android-vnc-server/ with some additional
+ * fixes applied.
+ *
+ * To build, you'll need the Android Native Development Kit from
+ * http://developer.android.com/sdk/ndk/.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -243,7 +248,7 @@ static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl)
} else if (code>=0xFF50 && code<=0xFF58) {
static const uint16_t map[] =
{ KEY_HOME, KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN,
- KEY_SOFT1, KEY_SOFT2, KEY_END, 0 };
+ KEY_END, 0 };
scancode = map[code & 0xF];
} else if (code>=0xFFE1 && code<=0xFFEE) {
static const uint16_t map[] =
@@ -264,10 +269,7 @@ static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl)
scancode = map[(code & 0x5F) - 'A'];
} else {
switch (code) {
- case 0x0003: scancode = KEY_CENTER; break;
case 0x0020: scancode = KEY_SPACE; break;
- case 0x0023: scancode = KEY_SHARP; break;
- case 0x0033: scancode = KEY_SHARP; break;
case 0x002C: scancode = KEY_COMMA; break;
case 0x003C: scancode = KEY_COMMA; break;
case 0x002E: scancode = KEY_DOT; break;
@@ -280,7 +282,6 @@ static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl)
case 0xFF1B: scancode = KEY_BACK; break;
case 0xFF09: scancode = KEY_TAB; break;
case 0xFF0D: scancode = KEY_ENTER; break;
- case 0x002A: scancode = KEY_STAR; break;
case 0xFFBE: scancode = KEY_F1; break; // F1
case 0xFFBF: scancode = KEY_F2; break; // F2
case 0xFFC0: scancode = KEY_F3; break; // F3
@@ -459,7 +460,7 @@ void print_usage(char **argv)
printf("%s [-k device] [-t device] [-h]\n"
"-k device: keyboard device node, default is /dev/input/event3\n"
"-t device: touch device node, default is /dev/input/event1\n"
- "-h : print this help\n");
+ "-h : print this help\n", argv[0]);
}
int main(int argc, char **argv)
@@ -517,6 +518,6 @@ int main(int argc, char **argv)
printf("Cleaning up...\n");
cleanup_fb();
- cleanup_kdb();
+ cleanup_kbd();
cleanup_touch();
}
diff --git a/examples/repeater.c b/examples/repeater.c
index cf0350f..dbfa39e 100644
--- a/examples/repeater.c
+++ b/examples/repeater.c
@@ -12,6 +12,7 @@ int main(int argc,char** argv)
char *repeaterHost;
int repeaterPort, sock;
char id[250];
+ int idlen;
rfbClientPtr cl;
int i,j;
@@ -23,7 +24,12 @@ int main(int argc,char** argv)
"Usage: %s <id> <repeater-host> [<repeater-port>]\n", argv[0]);
exit(1);
}
- snprintf(id, sizeof(id) - 1, "ID:%s", argv[1]);
+ idlen = snprintf(id, sizeof(id) - 1, "ID:%s", argv[1]);
+ if(idlen < 0 || idlen >= (int)sizeof(id)) {
+ fprintf(stderr, "Error, given ID is probably too long.\n");
+ return 1;
+ }
+
repeaterHost = argv[2];
repeaterPort = argc < 4 ? 5500 : atoi(argv[3]);
@@ -48,7 +54,7 @@ int main(int argc,char** argv)
perror("connect to repeater");
return 1;
}
- if (write(sock, id, sizeof(id)) != sizeof(id)) {
+ if (write(sock, id, idlen+1) != idlen+1) {
perror("writing id");
return 1;
}
diff --git a/examples/vncev.c b/examples/vncev.c
index a8e0884..4051d2b 100644
--- a/examples/vncev.c
+++ b/examples/vncev.c
@@ -2,10 +2,14 @@
* @example vncev.c
* This program is a simple server to show events coming from the client
*/
+#ifdef __STRICT_ANSI__
+#define _BSD_SOURCE
+#endif
+#include <rfb/rfbconfig.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
-#ifndef __MINGW32__
+#if LIBVNCSERVER_HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <rfb/rfb.h>