diff options
-rw-r--r-- | VisualNaCro/.gitignore | 5 | ||||
-rw-r--r-- | VisualNaCro/AUTHORS | 2 | ||||
-rw-r--r-- | VisualNaCro/ChangeLog | 15 | ||||
-rw-r--r-- | VisualNaCro/Makefile.am | 51 | ||||
-rw-r--r-- | VisualNaCro/NEWS | 10 | ||||
-rw-r--r-- | VisualNaCro/README | 88 | ||||
-rwxr-xr-x | VisualNaCro/autogen.sh | 55 | ||||
-rw-r--r-- | VisualNaCro/configure.ac | 252 | ||||
-rw-r--r-- | VisualNaCro/default8x16.h | 261 | ||||
-rw-r--r-- | VisualNaCro/nacro.c | 801 | ||||
-rw-r--r-- | VisualNaCro/nacro.h | 120 | ||||
-rw-r--r-- | VisualNaCro/recorder.pl | 282 |
12 files changed, 0 insertions, 1942 deletions
diff --git a/VisualNaCro/.gitignore b/VisualNaCro/.gitignore deleted file mode 100644 index a7007d3..0000000 --- a/VisualNaCro/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/COPYING -/INSTALL -/nacro.pm -/nacro.so -/nacro_wrap.c diff --git a/VisualNaCro/AUTHORS b/VisualNaCro/AUTHORS deleted file mode 100644 index 1081101..0000000 --- a/VisualNaCro/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Johannes Schindelin <Johannes.Schindelin@gmx.de> - diff --git a/VisualNaCro/ChangeLog b/VisualNaCro/ChangeLog deleted file mode 100644 index 78b9858..0000000 --- a/VisualNaCro/ChangeLog +++ /dev/null @@ -1,15 +0,0 @@ -2006-10-10: Johannes Schindelin <Johannes.Schindelin@gmx.de> - * implement --compact and --compact-dragging to shut up the - script about mouse movements or drags. - * add 'i', 'c' and 'r' menu keys. - -2006-09-12: Johannes Schindelin <Johannes.Schindelin@gmx.de> - * the reference rectangle is selected with a rubber band, - and can be shown with 'd'. - -2006-06-15: Johannes Schindelin <Johannes.Schindelin@gmx.de> - * added timing: you can record the events with their timestamps now - -2005-01-13: Johannes Schindelin <Johannes.Schindelin@gmx.de> - * started the project - diff --git a/VisualNaCro/Makefile.am b/VisualNaCro/Makefile.am deleted file mode 100644 index 7b1fe67..0000000 --- a/VisualNaCro/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -INTERFACE=nacro.h -SRCS=nacro.c -OBJS=nacro.o -ISRCS=nacro_wrap.c -IOBJS=nacro_wrap.o -TARGET=nacro -LIBS= @LIBVNCSERVERLIBS@ - -nacro_CFLAGS= @LIBVNCSERVERCFLAGS@ - -SWIGOPT= - -EXTRA_DIST=autogen.sh $(INTERFACE) $(SRCS) $(ISRCS) nacro.pm recorder.pl - -all: $(LIBPREFIX)$(TARGET)$(SO) - -# the following is borrowed from SWIG - -SWIG= @SWIG@ - -################################################################## -##### PERL 5 ###### -################################################################## - -# You need to set this variable to the Perl5 directory containing the -# files "perl.h", "EXTERN.h" and "XSUB.h". With Perl5.003, it's -# usually something like /usr/local/lib/perl5/arch-osname/5.003/CORE. - -PERL5_INCLUDE= @PERL5EXT@ - -# Extra Perl specific dynamic linking options -PERL5_DLNK = @PERL5DYNAMICLINKING@ -PERL5_CCFLAGS = @PERL5CCFLAGS@ - -# ---------------------------------------------------------------- -# Build a Perl5 dynamically loadable module (C) -# ---------------------------------------------------------------- - -$(ISRCS): $(INTERFACE) - @test -n "$(SWIG)" || (echo "Need SWIG" && exit 1) - $(SWIG) -perl5 $(SWIGOPT) $(INTERFACE) - -$(OBJS): $(SRCS) $(INTERFACE) - $(CC) -c -Dbool=char $(CCSHARED) $(CFLAGS) -o $@ $< $(LIBVNCSERVERCFLAGS) $(INCLUDES) -I$(PERL5_INCLUDE) - -$(IOBJS): $(ISRCS) $(INTERFACE) - $(CC) -c -Dbool=char $(CCSHARED) $(CFLAGS) -o $@ $< $(INCLUDES) $(PERL5_CCFLAGS) -I$(PERL5_INCLUDE) - -$(LIBPREFIX)$(TARGET)$(SO): $(OBJS) $(IOBJS) - $(LDSHARED) $(OBJS) $(IOBJS) $(PERL5_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) - diff --git a/VisualNaCro/NEWS b/VisualNaCro/NEWS deleted file mode 100644 index 6707d33..0000000 --- a/VisualNaCro/NEWS +++ /dev/null @@ -1,10 +0,0 @@ -With --timing, you can actually record action scripts which are meaningful... -Earlier, the events just got garbled, because the GUI could not react as -fast as the events were churned out. - -Clipboard is supported (thanks to Uwe). - -Keys are recorded by their symbols with the --symbolic switch, provided you -have the X11::Keysyms module. - -After pressing Control twice, you can show the last reference image with 'd'. diff --git a/VisualNaCro/README b/VisualNaCro/README deleted file mode 100644 index 8c92b32..0000000 --- a/VisualNaCro/README +++ /dev/null @@ -1,88 +0,0 @@ -This is VisualNaCro. - -DISCLAIMER: recorder.pl is not yet functional. - -What does it? - - It is a Perl module meant to remote control a VNC server. - - It includes a recorder (written in Perl) to make it easy to - record a macro, which is just a Perl script, and which you can - modify to your heart's content. - - The most important feature, however, is that you can mark a - rectangle which the Perl script will try to find again when you - run it. Thus when you play a game and want to hit a certain button, - you just hit the Ctrl key twice, mark the button, and from then on, - all mouse movements will be repeated relative to that button, even - if the button is somewhere else when you run the script the next - time. - - If you know Tcl Expect, you will recognize this approach. Only this - time, it is not text, but an image which is expected. - -How does it work? - - It acts as a VNC proxy: your Perl script starts its own VNC server. - The script now can intercept inputs and outputs, and act upon them. - In order to write a macro, start - - recorder.pl --script my-macro.pl --timing host:port - - connect with a vncviewer of your choice to <host2>:23, where <host2> - is the computer on which recorder.pl was started (not necessarily the - same as the VNC server!). Now your actions are recorded into - my_macro.pl, and the images you want to grep for will be saved as - my_macro-1.pnm, my_macro-2.pnm, ... - - In order to finish the script, hit Ctrl twice and say "q". - -Why did I do it? - - Because I could ;-) - - No really, I needed a way to write automated tests. While there - exist a lot of OpenSource programs for web testing, I found none - of them easy to use, and for GUI testing I found xautomation. - - Xautomation has this "visual grep" (or "graphical expect") feature: - given an image it tries to find it on the desktop and returns the - coordinates. Unfortunately, there is no easy way to record macros - with it, and it only works on X11. - - As I know VNC pretty well, and there are VNC servers for every OS - and gadget, I thought it might be cool to have this feature to - control a VNC server. - - Actually, it makes it even easier: with plain X11, for example, you - can not know where on the screen the action is if you don't check - the whole screen. This complex problem is beautifully addressed - in Karl Runge's x11vnc. - - My main purpose is to run regression tests on different browsers, - which I can easily do by starting Xvnc and using VisualNaCro. - -How did I do it? - - I wondered long about how to do it. I couldn't take the same approach - as xautomation: I cannot connect to the VNC server thousand times - per second. So I decided to create an interface of LibVNCServer/ - LibVNCClient for use in a script language. - - Fortunately, this task is made very, very easy by SWIG. As Perl - is one of my favorite script languages, I decided to use this. - But SWIG makes it easy to use the very same interface for other - popular languages, so you are welcome to port VisualNaCro to - the language of your choice! - -Isn't it pronounced "Visual Macro"? - - Yes. But I liked the Visual Na Cro play of acronyms. I'm sorry if - you don't find it funny. - -What's the license? - - GPL. It is based on LibVNCServer/LibVNCClient, so it has to be. - If you want to port this package to use vncreflector, which has a - BSD license, go ahead. - diff --git a/VisualNaCro/autogen.sh b/VisualNaCro/autogen.sh deleted file mode 100755 index 2d1645d..0000000 --- a/VisualNaCro/autogen.sh +++ /dev/null @@ -1,55 +0,0 @@ -#! /bin/sh -# Run this to generate all the initial makefiles, etc. - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -DIE=0 - -AUTOMAKE=automake-1.4 -ACLOCAL=aclocal-1.4 - -($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || { - AUTOMAKE=automake - ACLOCAL=aclocal -} - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile VisualNaCro." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have automake installed to compile VisualNaCro." - echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -(test -f $srcdir/nacro.h) || { - echo "You must run this script in the top-level VisualNaCro directory" - exit 1 -} - -if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." -fi - -$ACLOCAL $ACLOCAL_FLAGS -#autoheader -$AUTOMAKE --add-missing --copy -autoconf - -echo "Running ./configure --enable-maintainer-mode" "$@" -$srcdir/configure --enable-maintainer-mode "$@" - -echo "Now type 'make' to compile VisualNaCro." diff --git a/VisualNaCro/configure.ac b/VisualNaCro/configure.ac deleted file mode 100644 index 1f78317..0000000 --- a/VisualNaCro/configure.ac +++ /dev/null @@ -1,252 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -dnl The macros which aren't shipped with the autotools are stored in the -dnl Tools/config directory in .m4 files. - -AC_INIT([VisualNaCro],[0.1],[http://libvncserver.sourceforge.net]) -AC_PREREQ(2.54) -AC_CANONICAL_HOST -AM_INIT_AUTOMAKE - -dnl Checks for programs. -AC_CHECK_PROG(SWIG,swig,swig) -AC_CHECK_PROG(LIBVNCSERVERCONFIG,libvncserver-config,yes,no) -if test "$LIBVNCSERVERCONFIG" != "yes"; then - AC_MSG_ERROR([Need to have libvncserver-config in PATH]) - exit 1 -fi -AC_PROG_CC -AC_PROG_RANLIB -AC_EXEEXT -AC_OBJEXT - -LIBVNCSERVERCFLAGS=`libvncserver-config --cflags` -LIBVNCSERVERLIBS=`libvncserver-config --libs` -AC_SUBST(LIBVNCSERVERCFLAGS) -AC_SUBST(LIBVNCSERVERLIBS) - -dnl Checks for header files. -AC_HEADER_STDC - -dnl How to specify include directories that may be system directories. -# -I should not be used on system directories (GCC) -if test "$GCC" = yes; then - ISYSTEM="-isystem " -else - ISYSTEM="-I" -fi - - -# Set info about shared libraries. -AC_SUBST(SO) -AC_SUBST(LDSHARED) -AC_SUBST(CCSHARED) -AC_SUBST(LINKFORSHARED) - -# SO is the extension of shared libraries `(including the dot!) -AC_MSG_CHECKING(SO) -if test -z "$SO" -then - case $host in - *-*-hp*) SO=.sl;; - *-*-darwin*) SO=.bundle;; - *-*-cygwin* | *-*-mingw*) SO=.dll;; - *) SO=.so;; - esac -fi -AC_MSG_RESULT($SO) - -# LDSHARED is the ld *command* used to create shared library -# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5 -# (Shared libraries in this instance are shared modules to be loaded into -# Python, as opposed to building Python itself as a shared library.) -AC_MSG_CHECKING(LDSHARED) -if test -z "$LDSHARED" -then - case $host in - *-*-aix*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";; - *-*-cygwin* | *-*-mingw*) - if test "$GCC" = yes; then - LDSHARED="dllwrap --driver-name gcc --dlltool dlltool --export-all-symbols --as as --dllname \$(LIBPREFIX)\$(TARGET)\$(SO)" - else - if test "cl" = $CC ; then - # Microsoft Visual C++ (MSVC) - LDSHARED="$CC -nologo -LD" - else - # Unknown compiler try gcc approach - LDSHARED="$CC -shared" - fi - fi ;; - *-*-irix5*) LDSHARED="ld -shared";; - *-*-irix6*) LDSHARED="ld ${SGI_ABI} -shared -all";; - *-*-sunos4*) LDSHARED="ld";; - *-*-solaris*) LDSHARED="ld -G";; - *-*-hp*) LDSHARED="ld -b";; - *-*-osf*) LDSHARED="ld -shared -expect_unresolved \"*\"";; - *-sequent-sysv4) LDSHARED="ld -G";; - *-*-next*) - if test "$ns_dyld" - then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind' - else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; - fi - if test "$with_next_framework" ; then - LDSHARED="$LDSHARED \$(LDLIBRARY)" - fi ;; - *-*-linux*) LDSHARED="gcc -shared";; - *-*-dgux*) LDSHARED="ld -G";; - *-*-freebsd3*) LDSHARED="gcc -shared";; - *-*-freebsd* | *-*-openbsd*) LDSHARED="ld -Bshareable";; - *-*-netbsd*) - if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] - then - LDSHARED="cc -shared" - else - LDSHARED="ld -Bshareable" - fi;; - *-sco-sysv*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; - *-*-darwin*) LDSHARED="cc -bundle -undefined suppress -flat_namespace";; - *) LDSHARED="ld";; - esac -fi -AC_MSG_RESULT($LDSHARED) -# CCSHARED are the C *flags* used to create objects to go into a shared -# library (module) -- this is only needed for a few systems -AC_MSG_CHECKING(CCSHARED) -if test -z "$CCSHARED" -then - case $host in - *-*-hp*) if test "$GCC" = yes; - then CCSHARED="-fpic"; - else CCSHARED="+z"; - fi;; - *-*-linux*) CCSHARED="-fpic";; - *-*-freebsd* | *-*-openbsd*) CCSHARED="-fpic";; - *-*-netbsd*) CCSHARED="-fPIC";; - *-sco-sysv*) CCSHARED="-KPIC -dy -Bdynamic";; - *-*-irix6*) case $CC in - *gcc*) CCSHARED="-shared";; - *) CCSHARED="";; - esac;; - esac -fi -AC_MSG_RESULT($CCSHARED) - -# RPATH is the path used to look for shared library files. -AC_MSG_CHECKING(RPATH) -if test -z "$RPATH" -then - case $host in - *-*-solaris*) RPATH='-R. -R$(exec_prefix)/lib';; - *-*-irix*) RPATH='-rpath .:$(exec_prefix)/lib';; - *-*-linux*) RPATH='-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .';; - *) RPATH='';; - esac -fi -AC_MSG_RESULT($RPATH) -AC_SUBST(RPATH) - -# LINKFORSHARED are the flags passed to the $(CC) command that links -# the a few executables -- this is only needed for a few systems - -AC_MSG_CHECKING(LINKFORSHARED) -if test -z "$LINKFORSHARED" -then - case $host in - *-*-aix*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';; - *-*-hp*) - LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; - *-*-linux*) LINKFORSHARED="-Xlinker -export-dynamic";; - *-*-next*) LINKFORSHARED="-u libsys_s";; - *-sco-sysv*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; - *-*-irix6*) LINKFORSHARED="-all";; - esac -fi -AC_MSG_RESULT($LINKFORSHARED) - -# This variation is needed on OS-X because there is no (apparent) consistency in shared libary naming. -# Sometimes .bundle works, but sometimes .so is needed. It depends on the target language - -# Optional CFLAGS used to silence compiler warnings on some platforms. - -AC_SUBST(PLATFLAGS) -case $host in - *-*-darwin*) PLATFLAGS="-Wno-long-double";; - *) PLATFLAGS="";; -esac - -#---------------------------------------------------------------- -# Look for Perl5 -#---------------------------------------------------------------- - -PERLBIN= - -AC_ARG_WITH(perl5,[ --with-perl5=path Set location of Perl5 executable],[ PERLBIN="$withval"], [PERLBIN=]) - -# First figure out what the name of Perl5 is - -if test -z "$PERLBIN"; then -AC_CHECK_PROGS(PERL, perl perl5.8.1 perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl) -else -PERL="$PERLBIN" -fi - - -AC_MSG_CHECKING(for Perl5 header files) -if test -n "$PERL"; then - PERL5DIR=`($PERL -e 'use Config; print $Config{archlib}, "\n";') 2>/dev/null` - if test "$PERL5DIR" != ""; then - dirs="$PERL5DIR $PERL5DIR/CORE" - PERL5EXT=none - for i in $dirs; do - if test -r $i/perl.h; then - AC_MSG_RESULT($i) - PERL5EXT="$i" - break; - fi - done - if test "$PERL5EXT" = none; then - PERL5EXT="$PERL5DIR/CORE" - AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT) - fi - - AC_MSG_CHECKING(for Perl5 library) - PERL5LIB=`($PERL -e 'use Config; $_=$Config{libperl}; s/^lib//; s/$Config{_a}$//; print $_, "\n"') 2>/dev/null` - if test "$PERL5LIB" = "" ; then - AC_MSG_RESULT(not found) - else - AC_MSG_RESULT($PERL5LIB) - fi - AC_MSG_CHECKING(for Perl5 compiler options) - PERL5CCFLAGS=`($PERL -e 'use Config; print $Config{ccflags}, "\n"' | sed "s/-I/$ISYSTEM/") 2>/dev/null` - if test "$PERL5CCFLAGS" = "" ; then - AC_MSG_RESULT(not found) - else - AC_MSG_RESULT($PERL5CCFLAGS) - fi - else - AC_MSG_RESULT(unable to determine perl5 configuration) - PERL5EXT=$PERL5DIR - fi -else - AC_MSG_RESULT(could not figure out how to run perl5) -fi - -# Cygwin (Windows) needs the library for dynamic linking -case $host in -*-*-cygwin* | *-*-mingw*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5LIB";; -*)PERL5DYNAMICLINKING="";; -esac - -AC_SUBST(PERL) -AC_SUBST(PERL5EXT) -AC_SUBST(PERL5DYNAMICLINKING) -AC_SUBST(PERL5LIB) -AC_SUBST(PERL5CCFLAGS) - -#---------------------------------------------------------------- -# Miscellaneous -#---------------------------------------------------------------- - -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT - -dnl configure.in ends here diff --git a/VisualNaCro/default8x16.h b/VisualNaCro/default8x16.h deleted file mode 100644 index 252f411..0000000 --- a/VisualNaCro/default8x16.h +++ /dev/null @@ -1,261 +0,0 @@ -static unsigned char default8x16FontData[4096+1]={ -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, -0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x18,0x3c,0x3c,0xe7,0xe7,0xe7,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x7e,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0x00,0x00,0x00,0x00, -0xff,0xff,0xff,0xff,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xff,0xff,0xff,0xff, -0x00,0x00,0x1e,0x0e,0x1a,0x32,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00, -0x00,0x00,0x3c,0x66,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x3f,0x33,0x3f,0x30,0x30,0x30,0x30,0x70,0xf0,0xe0,0x00,0x00,0x00,0x00, -0x00,0x00,0x7f,0x63,0x7f,0x63,0x63,0x63,0x63,0x67,0xe7,0xe6,0xc0,0x00,0x00,0x00, -0x00,0x00,0x00,0x18,0x18,0xdb,0x3c,0xe7,0x3c,0xdb,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfe,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00, -0x00,0x02,0x06,0x0e,0x1e,0x3e,0xfe,0x3e,0x1e,0x0e,0x06,0x02,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, -0x00,0x00,0x7f,0xdb,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x1b,0x1b,0x00,0x00,0x00,0x00, -0x00,0x7c,0xc6,0x60,0x38,0x6c,0xc6,0xc6,0x6c,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,0xfe,0xfe,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7c,0x7c,0xfe,0xfe,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0xfe,0xfe,0x7c,0x7c,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c,0x00,0x00,0x00,0x00, -0x18,0x18,0x7c,0xc6,0xc2,0xc0,0x7c,0x06,0x06,0x86,0xc6,0x7c,0x18,0x18,0x00,0x00, -0x00,0x00,0x00,0x00,0xc2,0xc6,0x0c,0x18,0x30,0x60,0xc6,0x86,0x00,0x00,0x00,0x00, -0x00,0x00,0x38,0x6c,0x6c,0x38,0x76,0xdc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00,0x00,0x00, -0x00,0x00,0x30,0x18,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0xce,0xde,0xf6,0xe6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0x06,0x0c,0x18,0x30,0x60,0xc0,0xc6,0xfe,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0x06,0x06,0x3c,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, -0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xfc,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x38,0x60,0xc0,0xc0,0xfc,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0xfe,0xc6,0x06,0x06,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7e,0x06,0x06,0x06,0x0c,0x78,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x60,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x60,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0x0c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0x66,0xfc,0x00,0x00,0x00,0x00, -0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8,0x00,0x00,0x00,0x00, -0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00, -0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xde,0xc6,0xc6,0x66,0x3a,0x00,0x00,0x00,0x00, -0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00, -0x00,0x00,0xe6,0x66,0x66,0x6c,0x78,0x78,0x6c,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -0x00,0x00,0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00, -0x00,0x00,0xc3,0xe7,0xff,0xff,0xdb,0xc3,0xc3,0xc3,0xc3,0xc3,0x00,0x00,0x00,0x00, -0x00,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xd6,0xde,0x7c,0x0c,0x0e,0x00,0x00, -0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x6c,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -0x00,0x00,0x7c,0xc6,0xc6,0x60,0x38,0x0c,0x06,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0xff,0xdb,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x66,0x00,0x00,0x00,0x00, -0x00,0x00,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x3c,0x66,0xc3,0xc3,0x00,0x00,0x00,0x00, -0x00,0x00,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0xff,0xc3,0x86,0x0c,0x18,0x30,0x60,0xc1,0xc3,0xff,0x00,0x00,0x00,0x00, -0x00,0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x06,0x02,0x00,0x00,0x00,0x00, -0x00,0x00,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,0x00,0x00,0x00, -0x10,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00, -0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0xe0,0x60,0x60,0x78,0x6c,0x66,0x66,0x66,0x66,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc0,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x1c,0x0c,0x0c,0x3c,0x6c,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0xcc,0x78,0x00, -0x00,0x00,0xe0,0x60,0x60,0x6c,0x76,0x66,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00, -0x00,0x00,0xe0,0x60,0x60,0x66,0x6c,0x78,0x78,0x6c,0x66,0xe6,0x00,0x00,0x00,0x00, -0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xe6,0xff,0xdb,0xdb,0xdb,0xdb,0xdb,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xf0,0x00, -0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1e,0x00, -0x00,0x00,0x00,0x00,0x00,0xdc,0x76,0x66,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x10,0x30,0x30,0xfc,0x30,0x30,0x30,0x30,0x36,0x1c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xc3,0x66,0x3c,0x18,0x3c,0x66,0xc3,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0xf8,0x00, -0x00,0x00,0x00,0x00,0x00,0xfe,0xcc,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00, -0x00,0x00,0x0e,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0e,0x00,0x00,0x00,0x00, -0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x70,0x18,0x18,0x18,0x0e,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, -0x00,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xc6,0xfe,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x0c,0x06,0x7c,0x00,0x00, -0x00,0x00,0xcc,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x0c,0x18,0x30,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x10,0x38,0x6c,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0xcc,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x60,0x30,0x18,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x38,0x6c,0x38,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x3c,0x66,0x60,0x60,0x66,0x3c,0x0c,0x06,0x3c,0x00,0x00,0x00, -0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x18,0x3c,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0xc6,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -0x38,0x6c,0x38,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -0x18,0x30,0x60,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0x66,0xfe,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x1b,0x7e,0xd8,0xdc,0x77,0x00,0x00,0x00,0x00, -0x00,0x00,0x3e,0x6c,0xcc,0xcc,0xfe,0xcc,0xcc,0xcc,0xcc,0xce,0x00,0x00,0x00,0x00, -0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x30,0x78,0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x60,0x30,0x18,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0xc6,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0x78,0x00, -0x00,0xc6,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0xc6,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x18,0x18,0x7e,0xc3,0xc0,0xc0,0xc0,0xc3,0x7e,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xe6,0xfc,0x00,0x00,0x00,0x00, -0x00,0x00,0xc3,0x66,0x3c,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0xfc,0x66,0x66,0x7c,0x62,0x66,0x6f,0x66,0x66,0x66,0xf3,0x00,0x00,0x00,0x00, -0x00,0x0e,0x1b,0x18,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x18,0xd8,0x70,0x00,0x00, -0x00,0x18,0x30,0x60,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x0c,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -0x00,0x18,0x30,0x60,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x18,0x30,0x60,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0x76,0xdc,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -0x76,0xdc,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -0x00,0x3c,0x6c,0x6c,0x3e,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x38,0x6c,0x6c,0x38,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xc0,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, -0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x60,0xce,0x9b,0x06,0x0c,0x1f,0x00,0x00, -0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x66,0xce,0x96,0x3e,0x06,0x06,0x00,0x00, -0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3c,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x36,0x6c,0xd8,0x6c,0x36,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xd8,0x6c,0x36,0x6c,0xd8,0x00,0x00,0x00,0x00,0x00,0x00, -0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, -0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, -0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x18,0x18,0x18,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x18,0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, -0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0xd8,0xd8,0xd8,0xdc,0x76,0x00,0x00,0x00,0x00, -0x00,0x00,0x78,0xcc,0xcc,0xcc,0xd8,0xcc,0xc6,0xc6,0xc6,0xcc,0x00,0x00,0x00,0x00, -0x00,0x00,0xfe,0xc6,0xc6,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0xfe,0xc6,0x60,0x30,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x7e,0xd8,0xd8,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xc0,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x76,0xdc,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x7e,0x18,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0x6c,0x38,0x00,0x00,0x00,0x00, -0x00,0x00,0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x6c,0x6c,0x6c,0xee,0x00,0x00,0x00,0x00, -0x00,0x00,0x1e,0x30,0x18,0x0c,0x3e,0x66,0x66,0x66,0x66,0x3c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x7e,0xdb,0xdb,0xdb,0x7e,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x03,0x06,0x7e,0xdb,0xdb,0xf3,0x7e,0x60,0xc0,0x00,0x00,0x00,0x00, -0x00,0x00,0x1c,0x30,0x60,0x60,0x7c,0x60,0x60,0x60,0x30,0x1c,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0xff,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x00,0x7e,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x7e,0x00,0x00,0x00,0x00, -0x00,0x00,0x0e,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7e,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x38,0x6c,0x6c,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x0f,0x0c,0x0c,0x0c,0x0c,0x0c,0xec,0x6c,0x6c,0x3c,0x1c,0x00,0x00,0x00,0x00, -0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x70,0xd8,0x30,0x60,0xc8,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; -static int default8x16FontMetaData[256*5+1]={ -0,8,16,0,0,16,8,16,0,0,32,8,16,0,0,48,8,16,0,0,64,8,16,0,0,80,8,16,0,0,96,8,16,0,0,112,8,16,0,0,128,8,16,0,0,144,8,16,0,0,160,8,16,0,0,176,8,16,0,0,192,8,16,0,0,208,8,16,0,0,224,8,16,0,0,240,8,16,0,0,256,8,16,0,0,272,8,16,0,0,288,8,16,0,0,304,8,16,0,0,320,8,16,0,0,336,8,16,0,0,352,8,16,0,0,368,8,16,0,0,384,8,16,0,0,400,8,16,0,0,416,8,16,0,0,432,8,16,0,0,448,8,16,0,0,464,8,16,0,0,480,8,16,0,0,496,8,16,0,0,512,8,16,0,0,528,8,16,0,0,544,8,16,0,0,560,8,16,0,0,576,8,16,0,0,592,8,16,0,0,608,8,16,0,0,624,8,16,0,0,640,8,16,0,0,656,8,16,0,0,672,8,16,0,0,688,8,16,0,0,704,8,16,0,0,720,8,16,0,0,736,8,16,0,0,752,8,16,0,0,768,8,16,0,0,784,8,16,0,0,800,8,16,0,0,816,8,16,0,0,832,8,16,0,0,848,8,16,0,0,864,8,16,0,0,880,8,16,0,0,896,8,16,0,0,912,8,16,0,0,928,8,16,0,0,944,8,16,0,0,960,8,16,0,0,976,8,16,0,0,992,8,16,0,0,1008,8,16,0,0,1024,8,16,0,0,1040,8,16,0,0,1056,8,16,0,0,1072,8,16,0,0,1088,8,16,0,0,1104,8,16,0,0,1120,8,16,0,0,1136,8,16,0,0,1152,8,16,0,0,1168,8,16,0,0,1184,8,16,0,0,1200,8,16,0,0,1216,8,16,0,0,1232,8,16,0,0,1248,8,16,0,0,1264,8,16,0,0,1280,8,16,0,0,1296,8,16,0,0,1312,8,16,0,0,1328,8,16,0,0,1344,8,16,0,0,1360,8,16,0,0,1376,8,16,0,0,1392,8,16,0,0,1408,8,16,0,0,1424,8,16,0,0,1440,8,16,0,0,1456,8,16,0,0,1472,8,16,0,0,1488,8,16,0,0,1504,8,16,0,0,1520,8,16,0,0,1536,8,16,0,0,1552,8,16,0,0,1568,8,16,0,0,1584,8,16,0,0,1600,8,16,0,0,1616,8,16,0,0,1632,8,16,0,0,1648,8,16,0,0,1664,8,16,0,0,1680,8,16,0,0,1696,8,16,0,0,1712,8,16,0,0,1728,8,16,0,0,1744,8,16,0,0,1760,8,16,0,0,1776,8,16,0,0,1792,8,16,0,0,1808,8,16,0,0,1824,8,16,0,0,1840,8,16,0,0,1856,8,16,0,0,1872,8,16,0,0,1888,8,16,0,0,1904,8,16,0,0,1920,8,16,0,0,1936,8,16,0,0,1952,8,16,0,0,1968,8,16,0,0,1984,8,16,0,0,2000,8,16,0,0,2016,8,16,0,0,2032,8,16,0,0,2048,8,16,0,0,2064,8,16,0,0,2080,8,16,0,0,2096,8,16,0,0,2112,8,16,0,0,2128,8,16,0,0,2144,8,16,0,0,2160,8,16,0,0,2176,8,16,0,0,2192,8,16,0,0,2208,8,16,0,0,2224,8,16,0,0,2240,8,16,0,0,2256,8,16,0,0,2272,8,16,0,0,2288,8,16,0,0,2304,8,16,0,0,2320,8,16,0,0,2336,8,16,0,0,2352,8,16,0,0,2368,8,16,0,0,2384,8,16,0,0,2400,8,16,0,0,2416,8,16,0,0,2432,8,16,0,0,2448,8,16,0,0,2464,8,16,0,0,2480,8,16,0,0,2496,8,16,0,0,2512,8,16,0,0,2528,8,16,0,0,2544,8,16,0,0,2560,8,16,0,0,2576,8,16,0,0,2592,8,16,0,0,2608,8,16,0,0,2624,8,16,0,0,2640,8,16,0,0,2656,8,16,0,0,2672,8,16,0,0,2688,8,16,0,0,2704,8,16,0,0,2720,8,16,0,0,2736,8,16,0,0,2752,8,16,0,0,2768,8,16,0,0,2784,8,16,0,0,2800,8,16,0,0,2816,8,16,0,0,2832,8,16,0,0,2848,8,16,0,0,2864,8,16,0,0,2880,8,16,0,0,2896,8,16,0,0,2912,8,16,0,0,2928,8,16,0,0,2944,8,16,0,0,2960,8,16,0,0,2976,8,16,0,0,2992,8,16,0,0,3008,8,16,0,0,3024,8,16,0,0,3040,8,16,0,0,3056,8,16,0,0,3072,8,16,0,0,3088,8,16,0,0,3104,8,16,0,0,3120,8,16,0,0,3136,8,16,0,0,3152,8,16,0,0,3168,8,16,0,0,3184,8,16,0,0,3200,8,16,0,0,3216,8,16,0,0,3232,8,16,0,0,3248,8,16,0,0,3264,8,16,0,0,3280,8,16,0,0,3296,8,16,0,0,3312,8,16,0,0,3328,8,16,0,0,3344,8,16,0,0,3360,8,16,0,0,3376,8,16,0,0,3392,8,16,0,0,3408,8,16,0,0,3424,8,16,0,0,3440,8,16,0,0,3456,8,16,0,0,3472,8,16,0,0,3488,8,16,0,0,3504,8,16,0,0,3520,8,16,0,0,3536,8,16,0,0,3552,8,16,0,0,3568,8,16,0,0,3584,8,16,0,0,3600,8,16,0,0,3616,8,16,0,0,3632,8,16,0,0,3648,8,16,0,0,3664,8,16,0,0,3680,8,16,0,0,3696,8,16,0,0,3712,8,16,0,0,3728,8,16,0,0,3744,8,16,0,0,3760,8,16,0,0,3776,8,16,0,0,3792,8,16,0,0,3808,8,16,0,0,3824,8,16,0,0,3840,8,16,0,0,3856,8,16,0,0,3872,8,16,0,0,3888,8,16,0,0,3904,8,16,0,0,3920,8,16,0,0,3936,8,16,0,0,3952,8,16,0,0,3968,8,16,0,0,3984,8,16,0,0,4000,8,16,0,0,4016,8,16,0,0,4032,8,16,0,0,4048,8,16,0,0,4064,8,16,0,0,4080,8,16,0,0,}; -static rfbFontData default8x16Font = { default8x16FontData, default8x16FontMetaData }; diff --git a/VisualNaCro/nacro.c b/VisualNaCro/nacro.c deleted file mode 100644 index 9c492b0..0000000 --- a/VisualNaCro/nacro.c +++ /dev/null @@ -1,801 +0,0 @@ -#include <assert.h> -#include <string.h> -#include <rfb/rfb.h> -#include <rfb/rfbclient.h> - -#include "nacro.h" - -/* for visual grepping */ -typedef struct image_t { - int width,height; - char* buffer; -} image_t; - -/* this is a VNC connection */ -typedef struct private_resource_t { - int listen_port; - rfbScreenInfo* server; - rfbClient* client; - - uint32_t keysym; - rfbBool keydown; - - int x,y; - int buttons; - - char* text_client; - char* text_server; - - image_t* grep_image; - int x_origin,y_origin; - - enum { SLEEP,VISUALGREP,WAITFORUPDATE } state; - result_t result; -} private_resource_t; - -/* resource management */ - -#define MAX_RESOURCE_COUNT 20 - -static private_resource_t resource_pool[MAX_RESOURCE_COUNT]; -static int resource_count=0; - -static private_resource_t* get_resource(int resource) -{ - if(resource>=MAX_RESOURCE_COUNT || resource<0 || resource_pool[resource].client==0) - return NULL; - return resource_pool+resource; -} - -static private_resource_t* get_next_resource(void) -{ - if(resource_count<MAX_RESOURCE_COUNT) { - memset(resource_pool+resource_count,0,sizeof(private_resource_t)); - resource_count++; - return resource_pool+resource_count-1; - } else { - int i; - - for(i=0;i<MAX_RESOURCE_COUNT && resource_pool[i].client;i++); - if(i<MAX_RESOURCE_COUNT) - return resource_pool+i; - } - return NULL; -} - -static void free_resource(int resource) -{ - private_resource_t* res=get_resource(resource); - if(res) - res->client=NULL; -} - -/* hooks */ - -static void got_key(rfbBool down,rfbKeySym keysym,rfbClientRec* cl) -{ - private_resource_t* res=(private_resource_t*)cl->screen->screenData; - - res->keydown=down; - res->keysym=keysym; - res->result|=RESULT_KEY; -} - -static void got_mouse(int buttons,int x,int y,rfbClientRec* cl) -{ - private_resource_t* res=(private_resource_t*)cl->screen->screenData; - - res->buttons=buttons; - res->x=x; - res->y=y; - res->result|=RESULT_MOUSE; -} - -static void got_text(char* str,int len,rfbClientRec* cl) -{ - private_resource_t* res=(private_resource_t*)cl->screen->screenData; - - if (res->text_client) - free(res->text_client); - res->text_client=strdup(str); - res->result|=RESULT_TEXT_CLIENT; -} - -static void got_text_from_server(rfbClient* cl, const char *str, int textlen) -{ - private_resource_t* res=(private_resource_t*)cl->clientData; - - if (res->text_server) - free(res->text_server); - res->text_server=strdup(str); - res->result|=RESULT_TEXT_SERVER; -} - -static rfbBool malloc_frame_buffer(rfbClient* cl) -{ - private_resource_t* res=(private_resource_t*)cl->clientData; - - if(!res->server) { - int w=cl->width,h=cl->height; - - res->client->frameBuffer=malloc(w*4*h); - - res->server=rfbGetScreen(NULL,NULL,w,h,8,3,4); - if(!res->server) - return FALSE; - res->server->screenData=res; - res->server->port=res->listen_port; - res->server->frameBuffer=res->client->frameBuffer; - res->server->kbdAddEvent=got_key; - res->server->ptrAddEvent=got_mouse; - res->server->setXCutText=got_text; - rfbInitServer(res->server); - } else { - /* TODO: realloc if necessary */ - /* TODO: resolution change: send NewFBSize */ - /* TODO: if the origin is out of bounds, reset to 0 */ - } -} - -static bool_t do_visual_grep(private_resource_t* res,int x,int y,int w,int h) -{ - rfbClient* cl; - image_t* image; - int x_start,y_start,x_end=x+w-1,y_end=y+h-1; - bool_t found=0; - - if(res==0 || (cl=res->client)==0 || (image=res->grep_image)==0) - return 0; - - x_start=x-image->width; - y_start=y-image->height; - if(x_start<0) x_start=0; - if(y_start<0) y_start=0; - if(x_end+image->width>cl->width) x_end=cl->width-image->width; - if(y_end+image->height>cl->height) y_end=cl->height-image->height; - - /* find image and set x_origin,y_origin if found */ - for(y=y_start;y<y_end;y++) - for(x=x_start;x<x_end;x++) { - bool_t matching=1; - int i,j; - for(j=0;matching && j<image->height;j++) - for(i=0;matching && i<image->width;i++) - if(memcmp(cl->frameBuffer+4*(x+i+cl->width*(y+j)),image->buffer+4*(i+image->width*j),3)) - matching=0; - if(matching) { - private_resource_t* res=(private_resource_t*)cl->clientData; - res->x_origin=x; - res->y_origin=y; - return -1; - } - } - return 0; -} - -static void got_frame_buffer(rfbClient* cl,int x,int y,int w,int h) -{ - private_resource_t* res=(private_resource_t*)cl->clientData; - - assert(res->server); - - if(res->grep_image && do_visual_grep(res,x,y,w,h)) { - res->result|=RESULT_FOUNDIMAGE; - } - if(res->server) { - rfbMarkRectAsModified(res->server,x,y,x+w,y+h); - } - - res->result|=RESULT_SCREEN; -} - -/* init/shutdown functions */ - -resource_t initvnc(const char* server,int server_port,int listen_port) -{ - private_resource_t* res=get_next_resource(); - int dummy=0; - - if(res==0) - return -1; - - /* remember for later */ - res->listen_port=listen_port; - - res->text_client = NULL; - res->text_server = NULL; - - res->client=rfbGetClient(8,3,4); - res->client->clientData=(void*)res; - res->client->GotFrameBufferUpdate=got_frame_buffer; - res->client->MallocFrameBuffer=malloc_frame_buffer; - res->client->GotXCutText=got_text_from_server; - res->client->serverHost=strdup(server); - res->client->serverPort=server_port; - res->client->appData.encodingsString="raw"; - if(!rfbInitClient(res->client,&dummy,NULL)) { - res->client=NULL; - return -1; - } - return res-resource_pool; -} - -void closevnc(resource_t resource) -{ - private_resource_t* res=get_resource(resource); - if(res==0) - return; - - if(res->server) - rfbScreenCleanup(res->server); - - assert(res->client); - - rfbClientCleanup(res->client); - - res->client=NULL; -} - -/* PNM (image) helpers */ - -bool_t savepnm(resource_t resource,const char* filename,int x1,int y1,int x2,int y2) -{ - private_resource_t* res=get_resource(resource); - int i,j,w,h; - uint32_t* buffer; - FILE* f; - - if(res==0 || res->client==0) - return 0; - assert(res->client->format.depth==24); - - w=res->client->width; - h=res->client->height; - buffer=(uint32_t*)res->client->frameBuffer; - - if(res==0 || x1>x2 || y1>y2 || x1<0 || x2>=w || y1<0 || y2>=h) - return FALSE; - - f=fopen(filename,"wb"); - - if(f==0) - return FALSE; - - fprintf(f,"P6\n%d %d\n255\n",1+x2-x1,1+y2-y1); - for(j=y1;j<=y2;j++) - for(i=x1;i<=x2;i++) { - fwrite(buffer+i+j*w,3,1,f); - } - if(fclose(f)) - return FALSE; - return TRUE; -} - -static image_t* loadpnm(const char* filename) -{ - FILE* f=fopen(filename,"rb"); - char buffer[1024]; - int i,j,w,h; - image_t* image; - - if(f==0) - return NULL; - - if(!fgets(buffer,1024,f) || strcmp("P6\n",buffer)) { - fclose(f); - return NULL; - } - - do { - fgets(buffer,1024,f); - if(feof(f)) { - fclose(f); - return NULL; - } - } while(buffer[0]=='#'); - - if( sscanf(buffer,"%d %d",&w,&h)!=2 - || !fgets(buffer,1024,f) || strcmp("255\n",buffer)) { - fclose(f); - return NULL; - } - - image=(image_t*)malloc(sizeof(image_t)); - image->width=w; - image->height=h; - image->buffer=malloc(w*4*h); - if(!image->buffer) { - fclose(f); - free(image); - return NULL; - } - - for(j=0;j<h;j++) - for(i=0;i<w;i++) - if(fread(image->buffer+4*(i+w*j),3,1,f)!=1) { - fprintf(stderr,"Could not read 3 bytes at %d,%d\n",i,j); - fclose(f); - free(image->buffer); - free(image); - return NULL; - } - - fclose(f); - - return image; -} - -static void free_image(image_t* image) -{ - if(image->buffer) - free(image->buffer); - free(image); -} - -static void copy_line(rfbScreenInfo *dest, char *backup, - int x0, int y0, int x1, int y1, int color_offset) -{ - uint8_t *d = (uint8_t *)dest->frameBuffer, *s = (uint8_t *)backup; - int i; - int steps0 = x1 > x0 ? x1 - x0 : x0 - x1; - int steps1 = y1 > y0 ? y1 - y0 : y0 - y1; - - if (steps1 > steps0) - steps0 = steps1; - else if (steps0 == 0) - steps0 = 1; - - for (i = 0; i <= steps0; i++) { - int j, index = 4 * (x0 + i * (x1 - x0) / steps0 - + dest->width * (y0 + i * (y1 - y0) / steps0)); - for (j = 0; j < 4; j++) - d[index + j] = s[index + j] + color_offset; - } - - rfbMarkRectAsModified(dest, x0 - 5, y0 - 5, x1 + 1, y1 + 2); -} - -result_t displaypnm(resource_t resource, const char *filename, - coordinate_t x, coordinate_t y, bool_t border, - timeout_t timeout_in_seconds) -{ - private_resource_t* res = get_resource(resource); - image_t *image; - char* fake_frame_buffer; - char* backup; - int w, h, i, j, w2, h2; - result_t result; - - if (res == NULL || res->server == NULL || - (image = loadpnm(filename)) == NULL) - return 0; - - w = res->server->width; - h = res->server->height; - fake_frame_buffer = malloc(w * 4 * h); - if(!fake_frame_buffer) - return 0; - memcpy(fake_frame_buffer, res->server->frameBuffer, w * 4 * h); - - backup = res->server->frameBuffer; - res->server->frameBuffer = fake_frame_buffer; - - w2 = image->width; - if (x + w2 > w) - w2 = w - x; - h2 = image->height; - if (y + h2 > h) - h2 = h - y; - for (j = 0; j < h2; j++) - memcpy(fake_frame_buffer + 4 * (x + (y + j) * w), - image->buffer + j * 4 * image->width, 4 * w2); - free(image); - if (border) { - copy_line(res->server, backup, x, y, x + w2, y, 0x80); - copy_line(res->server, backup, x, y, x, y + h2, 0x80); - copy_line(res->server, backup, x + w2, y, x + w2, y + h2, 0x80); - copy_line(res->server, backup, x, y + h2, x + w2, y + h2, 0x80); - } - rfbMarkRectAsModified(res->server, - x - 1, y - 1, x + w2 + 1, y + h2 + 1); - - result = waitforinput(resource, timeout_in_seconds); - - res->server->frameBuffer=backup; - free(fake_frame_buffer); - rfbMarkRectAsModified(res->server, - x - 1, y - 1, x + w2 + 1, y + h2 + 1); - - return result; -} - -/* process() and friends */ - -/* this function returns only if res->result in return_mask */ -static result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result_t return_mask) -{ - private_resource_t* res=get_resource(resource); - fd_set fds; - struct timeval tv,tv_start,tv_end; - unsigned long timeout=(unsigned long)(timeout_in_seconds*1000000UL); - int count,max_fd; - - if(res==0) - return 0; - - assert(res->client); - - gettimeofday(&tv_start,NULL); - res->result=0; - - do { - unsigned long timeout_done; - - if(res->server) { - rfbBool loop; - do { - loop=rfbProcessEvents(res->server,res->server->deferUpdateTime); - } while(loop && (res->result&return_mask)==0 - && rfbIsActive(res->server)); - - if(!rfbIsActive(res->server)) - return RESULT_SHUTDOWN; - - if((res->result&return_mask)!=0) - return res->result; - - memcpy((char*)&fds,(const char*)&(res->server->allFds),sizeof(fd_set)); - max_fd=res->server->maxFd; - } else { - FD_ZERO(&fds); - max_fd=0; - } - FD_SET(res->client->sock,&fds); - if(res->client->sock>max_fd) - max_fd=res->client->sock; - - gettimeofday(&tv_end,NULL); - timeout_done=tv_end.tv_usec-tv_start.tv_usec+ - 1000000L*(tv_end.tv_sec-tv_start.tv_sec); - if(timeout_done>=timeout) - return RESULT_TIMEOUT; - - tv.tv_usec=((timeout-timeout_done)%1000000); - tv.tv_sec=(timeout-timeout_done)/1000000; - - count=select(max_fd+1,&fds,NULL,NULL,&tv); - if(count<0) - return 0; - - if(count>0) { - if(FD_ISSET(res->client->sock,&fds)) { - if(!HandleRFBServerMessage(res->client)) { - closevnc(resource); - return 0; - } - if((res->result&return_mask)!=0) - return res->result; - } - } else { - res->result|=RESULT_TIMEOUT; - return res->result; - } - } while(1); - - return RESULT_TIMEOUT; -} - -result_t process(resource_t res,timeout_t timeout) -{ - return private_process(res,timeout,RESULT_TIMEOUT); -} - -result_t waitforanything(resource_t res,timeout_t timeout) -{ - return private_process(res,timeout,-1); -} - -result_t waitforinput(resource_t res,timeout_t timeout) -{ - return private_process(res,timeout,RESULT_KEY|RESULT_MOUSE|RESULT_TIMEOUT); -} - -result_t waitforupdate(resource_t res,timeout_t timeout) -{ - return private_process(res,timeout,RESULT_SCREEN|RESULT_TIMEOUT); -} - -result_t visualgrep(resource_t resource,const char* filename,timeout_t timeout) -{ - private_resource_t* res=get_resource(resource); - image_t* image; - result_t result; - - if(res==0 || res->client==0) - return 0; - - /* load filename and set res->grep_image to this image */ - image=loadpnm(filename); - if(image==0) - return 0; - if(res->grep_image) - free_image(res->grep_image); - res->grep_image=image; - - if(do_visual_grep(res,0,0,res->client->width,res->client->height)) - return RESULT_FOUNDIMAGE; - - result=private_process(resource,timeout,RESULT_FOUNDIMAGE|RESULT_TIMEOUT); - - /* free image */ - if(res->grep_image) { - free_image(res->grep_image); - res->grep_image=NULL; - } - - return result; -} - -/* auxiliary function for alert */ - -#include "default8x16.h" - -static void center_text(rfbScreenInfo* screen,const char* message,int* x,int* y,int* w,int* h) -{ - rfbFontData* font=&default8x16Font; - const char* pointer; - int j,x1,y1,x2,y2,line_count=0; - if(message==0 || screen==0) - return; - rfbWholeFontBBox(font,&x1,&y1,&x2,&y2); - for(line_count=1,pointer=message;*pointer;pointer++) - if(*pointer=='\n') - line_count++; - - *h=(y2-y1)*line_count; - assert(*h>0); - - if(*h>screen->height) - *h=screen->height; - - *x=0; *w=screen->width; *y=(screen->height-*h)/2; - - rfbFillRect(screen,*x,*y,*x+*w,*y+*h,0xff0000); - - for(pointer=message,j=0;j<line_count;j++) { - const char* eol; - int x_cur,y_cur=*y-y1+j*(y2-y1),width; - - for(width=0,eol=pointer;*eol && *eol!='\n';eol++) - width+=rfbWidthOfChar(font,*eol); - if(width>screen->width) - width=screen->width; - - x_cur=(screen->width-width)/2; - for(;pointer!=eol;pointer++) - x_cur+=rfbDrawCharWithClip(screen,font, - x_cur,y_cur,*pointer, - 0,0,screen->width,screen->height, - 0xffffffff,0xffffffff); - pointer++; - } - rfbMarkRectAsModified(screen,*x,*y,*x+*w,*y+*h); -} - -/* this is an overlay which is shown for a certain time */ - -result_t alert(resource_t resource,const char* message,timeout_t timeout) -{ - private_resource_t* res=get_resource(resource); - char* fake_frame_buffer; - char* backup; - int x,y,w,h; - result_t result; - - if(res == NULL || res->server==NULL) - return -1; - - w=res->server->width; - h=res->server->height; - - fake_frame_buffer=malloc(w*4*h); - if(!fake_frame_buffer) - return -1; - memcpy(fake_frame_buffer,res->server->frameBuffer,w*4*h); - - backup=res->server->frameBuffer; - res->server->frameBuffer=fake_frame_buffer; - center_text(res->server,message,&x,&y,&w,&h); - fprintf(stderr,"%s\n",message); - - result=waitforinput(resource,timeout); - - res->server->frameBuffer=backup; - free(fake_frame_buffer); - rfbMarkRectAsModified(res->server,x,y,x+w,y+h); - - return result; -} -/* inspect last events */ - -keysym_t getkeysym(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->keysym; -} - -bool_t getkeydown(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->keydown; -} - -coordinate_t getx(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->x; -} - -coordinate_t gety(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->y; -} - -buttons_t getbuttons(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->buttons; -} - -const char *gettext_client(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->text_client; -} - -result_t rubberband(resource_t resource, coordinate_t x0, coordinate_t y0) -{ - private_resource_t* res=get_resource(resource); - char* fake_frame_buffer; - char* backup; - int w, h, x, y; - - if(res == NULL || res->server==NULL) - return -1; - - x = res->x; - y = res->y; - w = res->server->width; - h = res->server->height; - fake_frame_buffer = malloc(w * 4 * h); - if(!fake_frame_buffer) - return 0; - memcpy(fake_frame_buffer, res->server->frameBuffer, w * 4 * h); - - backup = res->server->frameBuffer; - res->server->frameBuffer = fake_frame_buffer; - - while (res->buttons) { - result_t r = waitforinput(resource, 1000000L); - if (x == res->x && y == res->y) - continue; - copy_line(res->server, backup, x0, y0, x, y0, 0); - copy_line(res->server, backup, x0, y0, x0, y, 0); - copy_line(res->server, backup, x, y0, x, y, 0); - copy_line(res->server, backup, x0, y, x, y, 0); - x = res->x; - y = res->y; - copy_line(res->server, backup, x0, y0, x, y0, 0x80); - copy_line(res->server, backup, x0, y0, x0, y, 0x80); - copy_line(res->server, backup, x, y0, x, y, 0x80); - copy_line(res->server, backup, x0, y, x, y, 0x80); - } - - copy_line(res->server, backup, x0, y0, x, y0, 0); - copy_line(res->server, backup, x0, y0, x0, y, 0); - copy_line(res->server, backup, x, y0, x, y, 0); - copy_line(res->server, backup, x0, y, x, y, 0); - - res->server->frameBuffer=backup; - free(fake_frame_buffer); - - return RESULT_MOUSE; -} - -const char *gettext_server(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->text_server; -} - -/* send events to the server */ - -bool_t sendkey(resource_t res,keysym_t keysym,bool_t keydown) -{ - private_resource_t* r=get_resource(res); - if(r==NULL) - return 0; - return SendKeyEvent(r->client,keysym,keydown); -} - -bool_t sendascii(resource_t res,const char *string) -{ - timeout_t delay = 0.1; - private_resource_t* r=get_resource(res); - int i; - if(r==NULL) - return 0; - while (*string) { - int keysym = *string; - int need_shift = 0; - - if (keysym >= 8 && keysym < ' ') - keysym += 0xff00; - else if (keysym >= 'A' && keysym <= 'Z') - need_shift = 1; - else if (keysym > '~') { - fprintf(stderr, "String contains non-ASCII " - "character 0x%02x\n", *string); - return FALSE; - } - - if (need_shift) { - if (!SendKeyEvent(r->client,0xffe1,1)) - return FALSE; - waitforinput(r,delay); - } - for (i = 1; i >= 0; i--) { - if (!SendKeyEvent(r->client,keysym,i)) - return FALSE; - waitforinput(r,delay); - } - if (need_shift) { - if (!SendKeyEvent(r->client,0xffe1,0)) - return FALSE; - waitforinput(r,delay); - } - string++; - } - return TRUE; -} - -bool_t sendmouse(resource_t res,coordinate_t x,coordinate_t y,buttons_t buttons) -{ - private_resource_t* r=get_resource(res); - if(r==NULL) - return 0; - return SendPointerEvent(r->client,x,y,buttons); -} - -bool_t sendtext(resource_t res, const char *string) -{ - private_resource_t* r=get_resource(res); - if(r==NULL) - return 0; - return SendClientCutText(r->client, (char *)string, (int)strlen(string)); -} - -bool_t sendtext_to_server(resource_t res, const char *string) -{ - private_resource_t* r=get_resource(res); - if(r==NULL) - return 0; - rfbSendServerCutText(r->server, (char *)string, (int)strlen(string)); - return 1; -} - -/* for visual grepping */ - -coordinate_t getxorigin(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->x_origin; -} - -coordinate_t getyorigin(resource_t res) -{ - private_resource_t* r=get_resource(res); - return r->y_origin; -} - diff --git a/VisualNaCro/nacro.h b/VisualNaCro/nacro.h deleted file mode 100644 index abd0067..0000000 --- a/VisualNaCro/nacro.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef NACRO_H -#define NACRO_H - -#ifdef SWIG -%module nacro - -%{ - -/* types used */ - -/* 0=false, every other value=true */ -typedef int bool_t; - -/* a keysym: identical with ASCII for values between 0-127 */ -typedef int keysym_t; - -/* this can be negative, because of a new origin set via visual grep */ -typedef int coordinate_t; - -/* left button is 1<<0, middle button is 1<<1, right button is 1<<2 */ -typedef unsigned char buttons_t; - -/* this is sort of a "file descriptor" for the proxy */ -typedef int resource_t; - -/* the timeout, specified in microseconds, for process() and friends */ -typedef double timeout_t; - -/* the return values of process() and friends */ -typedef int result_t; -/* -%constant int RESULT_TIMEOUT=1; -%constant int RESULT_KEY=2; -%constant int RESULT_MOUSE=4; -%constant int RESULT_TEXT_CLIENT=8; -%constant int RESULT_TEXT_CLIENT=16; -%constant int RESULT_SCREEN=32; -%constant int RESULT_FOUNDIMAGE=64; -%constant int RESULT_SHUTDOWN=128; -*/ - -%} - -#endif // SWIG - -typedef int bool_t; -typedef int keysym_t; -typedef int coordinate_t; -typedef unsigned char buttons_t; -typedef int resource_t; -typedef double timeout_t; -typedef int result_t; -#define RESULT_TIMEOUT 1 -#define RESULT_KEY 2 -#define RESULT_MOUSE 4 -#define RESULT_TEXT_CLIENT 8 -#define RESULT_TEXT_SERVER 16 -#define RESULT_SCREEN 32 -#define RESULT_FOUNDIMAGE 64 -#define RESULT_SHUTDOWN 128 - -/* init/shutdown */ - -resource_t initvnc(const char* server,int serverPort,int listenPort); -void closevnc(resource_t res); - -/* run the event loop for a while: process() and friends: - * process() returns only on timeout, - * waitforanything returns on any event (input, output or timeout), - * waitforupdate() returns only on timeout or screen update, - * waitforinput() returns only on timeout or user input, - * visualgrep() returns only on timeout or if the specified PNM was found - * (in that case, x_origin and y_origin are set to the upper left - * corner of the matched image). */ - -result_t process(resource_t res,timeout_t seconds); -result_t waitforanything(resource_t res,timeout_t seconds); -result_t waitforupdate(resource_t res,timeout_t seconds); -result_t waitforinput(resource_t res,timeout_t seconds); -result_t visualgrep(resource_t res,const char* filename,timeout_t seconds); - -/* inspect last events */ - -keysym_t getkeysym(resource_t res); -bool_t getkeydown(resource_t res); - -coordinate_t getx(resource_t res); -coordinate_t gety(resource_t res); -buttons_t getbuttons(resource_t res); - -const char *gettext_client(resource_t res); -const char *gettext_server(resource_t res); - -/* send events to the server */ - -bool_t sendkey(resource_t res,keysym_t keysym,bool_t keydown); -bool_t sendascii(resource_t res,const char *string); -bool_t sendmouse(resource_t res,coordinate_t x,coordinate_t y,buttons_t buttons); -bool_t sendtext(resource_t res, const char *string); -bool_t sendtext_to_server(resource_t res, const char *string); - -/* for visual grepping */ - -coordinate_t getxorigin(resource_t res); -coordinate_t getyorigin(resource_t res); - -bool_t savepnm(resource_t res,const char* filename,coordinate_t x1, coordinate_t y1, coordinate_t x2, coordinate_t y2); - -result_t displaypnm(resource_t res, const char *filename, coordinate_t x, coordinate_t y, bool_t border, timeout_t timeout); - -/* this displays an overlay which is shown for a certain time */ - -result_t alert(resource_t res,const char* message,timeout_t timeout); - -/* display a rectangular rubber band between (x0, y0) and the current - mouse pointer, as long as a button us pressed. */ - -result_t rubberband(resource_t res, coordinate_t x0, coordinate_t y0); - -#endif diff --git a/VisualNaCro/recorder.pl b/VisualNaCro/recorder.pl deleted file mode 100644 index 01ab3f2..0000000 --- a/VisualNaCro/recorder.pl +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/perl - -use Getopt::Long; -use nacro; - -$output="my_script"; -$server="localhost"; -$port=5900; -$listen_port=5923; -$timing=0; -$symbolic=0; -$compact=0; -$compact_dragging=0; - -if(!GetOptions( - "script:s" => \$output, - "listen:i" => \$listen_port, - "timing" => \$timing, - "symbolic" => \$symbolic, - "compact" => \$compact, - "compact-dragging" => \$compact_dragging, -) || $#ARGV!=0) { - print STDERR "Usage: $ARGV0 [--script output_name] [--listen listen_port] [--timing]\n\t[--symbolic] [--compact] [--compact-dragging] server[:port]\n"; - exit 2; -} - -$output=~s/\.pl$//; - -if ($timing) { - eval 'use Time::HiRes'; - $timing=0 if $@; - $starttime=-1; -} - -if ($symbolic) { - eval 'use X11::Keysyms qw(%Keysyms)'; - $symbolic=0 if $@; - %sym_name = reverse %Keysyms; -} - -$server=$ARGV[0]; - -if($server=~/^(.*):(\d+)$/) { - $server=$1; - $port=$2; - if($2<100) { - $port+=5900; - } -} - -if($listen_port<100) { - $listen_port+=5900; -} - -# do not overwrite script - -if(stat("$output.pl")) { - print STDERR "Will not overwrite $output.pl\n"; - exit 2; -} - -# start connection -$vnc=nacro::initvnc($server,$port,$listen_port); - -if($vnc<0) { - print STDERR "Could not initialize $server:$port\n"; - exit 1; -} - -open OUT, ">$output.pl"; -print OUT "#!/usr/bin/perl\n"; -print OUT "\n"; -if ($symbolic) { - print OUT "use X11::Keysyms qw(\%sym);\n"; -} -print OUT "use nacro;\n"; -print OUT "\n"; -print OUT "\$x_origin=0; \$y_origin=0;\n"; -print OUT "\$vnc=nacro::initvnc(\"$server\",$port,$listen_port);\n"; - -$mode="passthru"; -$image_counter=1; -$magickey=0; -$x_origin=0; $y_origin=0; - -sub writetiming () { - if ($timing) { - $now=Time::HiRes::time(); - if ($starttime>0) { - print OUT "nacro::process(\$vnc," . ($now - $starttime) . ");\n"; - } - $starttime=$now; - } -} - -$last_button = -1; - -sub handle_mouse { - my $x = shift; - my $y = shift; - my $buttons = shift; - if(nacro::sendmouse($vnc,$x,$y,$buttons)) { - $x-=$x_origin; $y-=$y_origin; - writetiming(); - print OUT "nacro::sendmouse(\$vnc,\$x_origin" - . ($x>=0?"+":"")."$x,\$y_origin" - . ($y>=0?"+":"")."$y,$buttons);\n"; - } -} - -sub toggle_text { - my $text = shift; - if ($text eq "Timing") { - return $text . " is " . ($timing ? "on" : "off"); - } elsif ($text eq "Key presses") { - return $text . " are recorded " . ($symbolic ? "symbolically" - : "numerically"); - } elsif ($text eq "Mouse moves") { - return $text . " are recorded " . ($compact ? "compacted" - : "verbosely"); - } elsif ($text eq "Mouse drags") { - return $text . " are recorded " . ($compact ? "compacted" - : "verbosely"); - } - return $text . ": <unknown>"; -} - -$menu_message = "VisualNaCro: press 'q' to quit,\n" - . "'i' to display current settings,\n" - . "'c', 'r' to toggle compact mouse movements or drags,\n" - . "'d' to display current reference image,\n" - . "or mark reference rectangle by dragging"; - -while(1) { - $result=nacro::waitforinput($vnc,999999); - if($result==0) { - # server went away - close OUT; - exit 0; - } - - if($mode eq "passthru") { - if($result&$nacro::RESULT_KEY) { - $keysym=nacro::getkeysym($vnc); - $keydown=nacro::getkeydown($vnc); - if(nacro::sendkey($vnc,$keysym,$keydown)) { - writetiming(); - if ($symbolic and exists $sym_name{$keysym}) { - print OUT 'nacro::sendkey($vnc,$sym{'.$sym_name{$keysym}."},$keydown);\n"; - } else { - print OUT "nacro::sendkey(\$vnc,$keysym,$keydown);\n"; - } - } - if($keysym==0xffe3 || $keysym==0xffe4) { - if (!$keydown) { - # Control pressed - $magickey++; - if ($magickey > 1) { - $magickey = 0; - $mode = "menu"; - nacro::alert($vnc, - $menu_message, 10); - } - } - } else { - $magickey=0; - } - } - if($result&$nacro::RESULT_MOUSE) { - $x=nacro::getx($vnc); - $y=nacro::gety($vnc); - $buttons=nacro::getbuttons($vnc); - if ($buttons != $last_buttons) { - if (!$buttons && $compact_dragging) { - handle_mouse($x, $y, $last_buttons); - } - $last_buttons = $buttons; - } else { - if (($buttons && $compact_dragging) || - (!$buttons && $compact)) { - next; - } - } - handle_mouse($x, $y, $buttons); - } - if ($result & $nacro::RESULT_TEXT_CLIENT) { - my $text = nacro::gettext_client($vnc); - if (nacro::sendtext($vnc,$text)) { - writetiming(); - print OUT "nacro::sendtext(\$vnc, q(\Q$text\E));\n"; - print "got text from client: $text\n"; - } - } - if ($result & $nacro::RESULT_TEXT_SERVER) { - my $text = nacro::gettext_server($vnc); - if (nacro::sendtext_to_server($vnc,$text)) { - writetiming(); - print OUT "nacro::sendtext_to_server(\$vnc, q(\Q$text\E));\n"; - print "got text from server: $text\n"; - } - } - } else { - if($result&$nacro::RESULT_KEY) { - $keysym=nacro::getkeysym($vnc); - $keydown=nacro::getkeydown($vnc); - if($keysym==ord('q')) { - # shutdown - close OUT; - nacro::closevnc($vnc); - exit 0; - } elsif ($keysym == ord('d')) { - $pnm=$output.($image_counter - 1).".pnm"; - $res = nacro::displaypnm($vnc, $pnm, - $x_origin, $y_origin, 1, 10); - #0, 0, 1, 10); - if ($res == 0) { - nacro::alert($vnc, "Error displaying " - . $pnm, 10); - } - } elsif ($keysym == ord('i')) { - nacro::alert($vnc, "Current settings:\n" - . "\n" - . "Script: $output\n" - . "Server: $server\n" - . "Listening on port: $port\n" - . toggle_text("Timing") . "\n" - . toggle_text("Key presses") . "\n" - . toggle_text("Mouse moves") . "\n" - . toggle_text("Mouse drags"), 10); - } elsif ($keysym == ord('c')) { - $compact = !$compact; - nacro::alert($vnc, - toggle_text("Mouse moves"), 10); - } elsif ($keysym == ord('r')) { - $compact_dragging = !$compact_dragging; - nacro::alert($vnc, - toggle_text("Mouse drags"), 10); - } else { - nacro::alert($vnc,"Unknown key",10); - } - $mode="passthru"; - } - if($result&$nacro::RESULT_MOUSE) { - $x=nacro::getx($vnc); - $y=nacro::gety($vnc); - $buttons=nacro::getbuttons($vnc); - if(($buttons&1)==1) { - print STDERR "start draggin: $x $y\n"; - $start_x=$x; - $start_y=$y; - nacro::rubberband($vnc, $x, $y); - $x=nacro::getx($vnc); - $y=nacro::gety($vnc); - if($start_x==$x && $start_y==$y) { - # reset - print OUT "\$x_origin=0; \$y_origin=0;\n"; - } else { - if($start_x>$x) { - $dummy=$x; $x=$start_x; $start_x=$dummy; - } - if($start_y>$y) { - $dummy=$y; $y=$start_y; $start_y=$dummy; - } - $pnm=$output.$image_counter.".pnm"; - $image_counter++; - if(!nacro::savepnm($vnc,$pnm,$start_x,$start_y,$x,$y)) { - nacro::alert($vnc,"Saving $pnm failed!",10); - } else { - $x_origin=$start_x; - $y_origin=$start_y; - nacro::alert($vnc,"Got new origin: $x_origin $y_origin",10); - print OUT "if(nacro::visualgrep(\$vnc,\"$pnm\",999999)) {\n" - . "\t\$x_origin=nacro::getxorigin(\$vnc);\n" - . "\t\$y_origin=nacro::getyorigin(\$vnc);\n}\n"; - } - } - $mode="passthru"; - } - } - } -} - |