From 23f45bc7641dbe9b87ba281cf54ba844fe7edcee Mon Sep 17 00:00:00 2001 From: dscho Date: Sun, 9 Feb 2003 18:05:54 +0000 Subject: included vncterm --- Makefile.am | 4 +- configure.ac | 4 + examples/.cvsignore | 2 +- vncterm/.cvsignore | 7 + vncterm/ChangeLog | 15 ++ vncterm/LinuxVNC.c | 172 ++++++++++++++++++ vncterm/Makefile.am | 16 ++ vncterm/README | 25 +++ vncterm/TODO | 21 +++ vncterm/VNCommand.c | 116 ++++++++++++ vncterm/VNConsole.c | 499 ++++++++++++++++++++++++++++++++++++++++++++++++++++ vncterm/VNConsole.h | 95 ++++++++++ vncterm/example.c | 32 ++++ vncterm/vga.h | 261 +++++++++++++++++++++++++++ 14 files changed, 1266 insertions(+), 3 deletions(-) create mode 100644 vncterm/.cvsignore create mode 100644 vncterm/ChangeLog create mode 100644 vncterm/LinuxVNC.c create mode 100644 vncterm/Makefile.am create mode 100644 vncterm/README create mode 100644 vncterm/TODO create mode 100644 vncterm/VNCommand.c create mode 100644 vncterm/VNConsole.c create mode 100644 vncterm/VNConsole.h create mode 100644 vncterm/example.c create mode 100644 vncterm/vga.h diff --git a/Makefile.am b/Makefile.am index 2981f51..07e5e50 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS=. examples contrib -DIST_SUBDIRS=examples contrib +SUBDIRS=. examples contrib vncterm +DIST_SUBDIRS=examples contrib vncterm bin_SCRIPTS = libvncserver-config diff --git a/configure.ac b/configure.ac index ddc63ee..afac118 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,9 @@ AC_CHECK_LIB(nsl,gethostbyname) AC_CHECK_LIB(socket,socket) AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mkfifo select socket strchr strcspn strdup strerror strstr]) +# Check if /dev/vcsa1 exists, if so, define LINUX +AM_CONDITIONAL(LINUX, test -c /dev/vcsa1) + # Check for rpm SOURCES path echo -n "checking for rpm sources path... " RPMSOURCEDIR="NOT-FOUND" @@ -104,6 +107,7 @@ LDADD="-L.. -lvncserver" AC_CONFIG_FILES([Makefile contrib/Makefile examples/Makefile + vncterm/Makefile libvncserver.spec libvncserver-config]) AC_OUTPUT diff --git a/examples/.cvsignore b/examples/.cvsignore index 549de8a..7aab2d4 100644 --- a/examples/.cvsignore +++ b/examples/.cvsignore @@ -4,7 +4,7 @@ example fontsel pnmshow pnmshow24 -sratest +regiontest storepasswd vncev Makefile.in diff --git a/vncterm/.cvsignore b/vncterm/.cvsignore new file mode 100644 index 0000000..88897f0 --- /dev/null +++ b/vncterm/.cvsignore @@ -0,0 +1,7 @@ +LinuxVNC +VNCommand +example +.deps +Makefile +Makefile.in + diff --git a/vncterm/ChangeLog b/vncterm/ChangeLog new file mode 100644 index 0000000..53a9c37 --- /dev/null +++ b/vncterm/ChangeLog @@ -0,0 +1,15 @@ +included in LibVNCServer package, autoconf'ed it +SetXCutText implemented +fix for cargs +attributes work. +cursor in LinuxVNC is shown. +paste works +selection works (no cursor trails) +LinuxVNC gets it's dimensions via ioctl TIOCGWINSZ +First working key injection in LinuxVNC! +Added Mouse marking +added screenBuffer (so you have ASCII screen also) +fixed CopyRect for scrolling (need to propagate to libvncserver) +made VNCommand work (no prompt for bash, but else seems ok) +added flag for VNCommand to send input only after a newline + (good for interactive bash) diff --git a/vncterm/LinuxVNC.c b/vncterm/LinuxVNC.c new file mode 100644 index 0000000..ec4eb25 --- /dev/null +++ b/vncterm/LinuxVNC.c @@ -0,0 +1,172 @@ +#include "VNConsole.h" +#include "vga.h" +#include +#include + +static int tty=2; +static int tty_inject_device; + +void do_key(Bool down,KeySym keySym,rfbClientPtr cl) +{ + static char isControl=0; + + if(down) { + /* if(keySym==XK_Escape) + rfbCloseClient(cl); + else */ if(keySym==XK_Control_L || keySym==XK_Control_R) + isControl++; + else if(tty_inject_device>=0) { + if(keySym==XK_Escape) + keySym=27; + if(isControl) { + if(keySym>='a' && keySym<='z') + keySym-='a'-1; + else if(keySym>='A' && keySym<='Z') + keySym-='A'-1; + else + keySym=0xffff; + } + + if(keySym==XK_Tab) + keySym='\t'; + else if(keySym==XK_Return) + keySym='\r'; + else if(keySym==XK_BackSpace) + keySym=8; + else if(keySym==XK_Home || keySym==XK_KP_Home) + keySym=1; + else if(keySym==XK_End || keySym==XK_KP_End) + keySym=5; + else if(keySym==XK_Up || keySym==XK_KP_Up) + keySym=16; + else if(keySym==XK_Down || keySym==XK_KP_Down) + keySym=14; + else if(keySym==XK_Right || keySym==XK_KP_Right) + keySym=6; + else if(keySym==XK_Left || keySym==XK_KP_Left) + keySym=2; + + if(keySym<0x100) { + int ret; + //fprintf(stderr,"do_key: %c (0x%lx)\n",(char)keySym,keySym); + ret=ioctl(tty_inject_device,TIOCSTI,&keySym); + if(ret<0) { + static char device[64]; + close(tty_inject_device); + sprintf(device,"/dev/tty%d",tty); + tty_inject_device=open(device,O_WRONLY); + ret=ioctl(tty_inject_device,TIOCSTI,&keySym); + if(ret<0) + fprintf(stderr,"Couldn't reopen device %s!\n",device); + } + } + } + } else if(keySym==XK_Control_L || keySym==XK_Control_R) + isControl--; +} + +int main(int argc,char **argv) +{ + int width=80,height=25; + char *buffer; + vncConsolePtr console; + char tty_device[64],title[128]; + int i; + FILE* tty_file; + struct winsize dimensions; + + if(argc>1) { + if((tty=atoi(argv[1]))<1) { + fprintf(stderr,"Usage: %s [tty_number [vnc args]]\n",argv[0]); + exit(1); + } else { + argv++; + argc--; + } + } + + /* getopt goes here! */ + + sprintf(tty_device,"/dev/tty%d",tty); + if((tty_inject_device=open(tty_device,O_WRONLY))<0) { + fprintf(stderr,"Couldn't open tty device %s!\n",tty_device); + exit(1); + } + fprintf(stderr,"Using device %s.\n",tty_device); + + if(ioctl(tty_inject_device,TIOCGWINSZ,&dimensions)>=0) { + width=dimensions.ws_col; + height=dimensions.ws_row; + } + + sprintf(title,"LinuxVNC: /dev/tty%d",tty); + + /* console init */ + console=vcGetConsole(&argc,argv,width,height,&vgaFont,TRUE); + console->rfbScreen->desktopName=title; + console->rfbScreen->kbdAddEvent=do_key; + console->selectTimeOut=100000; + console->wrapBottomToTop=TRUE; +#ifdef USE_OLD_VCS + buffer=malloc(width*height); + console->cursorActive=FALSE; +#else + buffer=malloc(width*height*2+4); + console->cursorActive=TRUE; +#endif + /* memcpy(buffer,console->screenBuffer,width*height); */ + +#ifdef USE_OLD_VCS + sprintf(tty_device,"/dev/vcs%d",tty); +#else + sprintf(tty_device,"/dev/vcsa%d",tty); +#endif + + while(1) { + if(!console->currentlyMarking) { + tty_file=fopen(tty_device,"rb"); + if(!tty_file) { + fprintf(stderr,"cannot open device \"%s\"\n", + tty_device); + exit(1); + } +#ifdef USE_OLD_VCS + fread(buffer,width,height,tty_file); +#else + fread(buffer,width*height*2+4,1,tty_file); + vcHideCursor(console); +#endif + fclose(tty_file); + + for(i=0;iwidth*console->height;i++) { + if +#ifdef USE_OLD_VCS + (buffer[i]!=console->screenBuffer[i]) +#else + (buffer[4+2*i]!=console->screenBuffer[i] || + buffer[5+2*i]!=console->attributeBuffer[i]) +#endif + { + console->x=(i%console->width); + console->y=(i/console->width); + /* + fprintf(stderr,"changes: %d,%d (%d!=%d || %d!=%d)\n", + console->x,console->y, + buffer[4+2*i],console->screenBuffer[i], + buffer[5+2*i],console->attributeBuffer[i]); + */ + +#ifdef USE_OLD_VCS + vcPutChar(console,buffer[i]); +#else + vcPutCharColour(console,buffer[4+i*2],buffer[5+i*2]&0x7,buffer[5+i*2]>>4); +#endif + } + } + console->x=buffer[2]; + console->y=buffer[3]; + } + vcProcessEvents(console); + } + return(0); +} diff --git a/vncterm/Makefile.am b/vncterm/Makefile.am new file mode 100644 index 0000000..cad88a2 --- /dev/null +++ b/vncterm/Makefile.am @@ -0,0 +1,16 @@ +CONSOLE_SRCS=VNConsole.c + +noinst_HEADERS=VNConsole.h + +LDADD=-L.. -lvncserver +INCLUDES=-I. -I../include + +if LINUX +bin_PROGRAMS=LinuxVNC +LinuxVNC_SOURCES=LinuxVNC.c $(CONSOLE_SRCS) +endif + +noinst_PROGRAMS=VNCommand example +VNCommand_SOURCES=VNCommand.c $(CONSOLE_SRCS) +example_SOURCES=example.c $(CONSOLE_SRCS) + diff --git a/vncterm/README b/vncterm/README new file mode 100644 index 0000000..b01e88a --- /dev/null +++ b/vncterm/README @@ -0,0 +1,25 @@ + +In this stage (beta), there are two programs functional: + +LinuxVNC + monitor a virtual console (text mode) of Linux. You need + root privileges, or at least be in the "tty" group, because + it reads /dev/vcsN and writes /dev/ttyN. + It follows the same idea as WinVNC, x11vnc or OSXvnc, i.e. it + takes an existing desktop and exports it via RFB (VNC), just that + LinuxVNC exports text. + +VNCommand + executes redirecting stdin from a vncviewer and stdout & + stderr to the vnc clients. This might be renamed to vncTerm if + there are some term capabilities added (up to now, bash doesn't look + nice). Colours and other ANSI sequences need to be added. + +My original plan was to create a program named vncTerm. It was meant to +overcome incompatibilities between different TERMs, but I found "screen" to +be just such a program. Maybe once some time in the future I'll make a +patch for screen to use VNConsole to export it's contents via RFB... + +These two programs are a simple application of LibVNCServer with a small +console layer in between (VNConsole). You can use them under the terms +(not vncTerms ;-) of the GPL. They where written by Johannes E. Schindelin. diff --git a/vncterm/TODO b/vncterm/TODO new file mode 100644 index 0000000..5c6f189 --- /dev/null +++ b/vncterm/TODO @@ -0,0 +1,21 @@ +VNConsole: +LinuxVNC: +VNCommand: + make Control or Alt sequences work. + Find out how to satisfy isatty(). => /dev/ptyN + Fix check if child is alive. + Add command line option for real interactive mode. + +done: + +.treat colours correctly (use /dev/vcsaN's attributes). +.introduce per cell colours (for attributes) +.fix cursor fuckup when selecting. +.default to paste for right mouse button. +.have an idea how to insert keys +.convert VNCommand to an interactive shell (vncTerm) +.bidirectional pipes (spawn a shell ...) +.mark with mouse (copy text) +.when scrolling, cursor must be hidden! + + modifiedRegion which are copied with CopyRect have to be modified also. diff --git a/vncterm/VNCommand.c b/vncterm/VNCommand.c new file mode 100644 index 0000000..1e86fe6 --- /dev/null +++ b/vncterm/VNCommand.c @@ -0,0 +1,116 @@ +#include +#include +#include +#include +#include +#include +#include "VNConsole.h" +#include "vga.h" + + +int main(int argc, char **argv) +{ + Bool interactive=FALSE,sendOnlyWholeLines=TRUE; + int serverArgc,programArg0; + for(serverArgc=1;serverArgcdoEcho = FALSE; + + if(max_fd=0) { + /* event loop */ + vcProcessEvents(console); + + /* get input */ + if(console->inputCount) { + if(sendOnlyWholeLines) { + for(i=0;iinputCount;i++) + if(console->inputBuffer[i]=='\n') { + i++; + fwrite(console->inputBuffer,i,1,input_pipe); + fflush(input_pipe); + /* fwrite(console->inputBuffer,i,1,stderr); */ + if(console->inputCount>i) + memmove(console->inputBuffer,console->inputBuffer+i,console->inputCount-i); + console->inputCount-=i; + i=0; + } + } else { + fwrite(console->inputBuffer,console->inputCount,1,input_pipe); + fflush(input_pipe); + /* fwrite(console->inputBuffer,console->inputCount,1,stderr); */ + console->inputCount=0; + } + } + /* process output */ + fs1=fs; tv1=tv; + num_fds=select(max_fd+1,&fs1,NULL,NULL,&tv1); + if(num_fds>0) { + /* + if(FD_ISSET(0,&fs1)) { + ch=getchar(); + fputc(ch,f); + } + */ + if(FD_ISSET(out[0],&fs1)) { + c=read(out[0],buffer,1024); + for(i=0;i +#include "VNConsole.h" + +#define DEBUG(x) + +unsigned char colourMap16[16*3]={ + /* 0 black #000000 */ 0x00,0x00,0x00, + /* 1 maroon #800000 */ 0x80,0x00,0x00, + /* 2 green #008000 */ 0x00,0x80,0x00, + /* 3 khaki #808000 */ 0x80,0x80,0x00, + /* 4 navy #000080 */ 0x00,0x00,0x80, + /* 5 purple #800080 */ 0x80,0x00,0x80, + /* 6 aqua-green #008080 */ 0x00,0x80,0x80, + /* 7 light grey #c0c0c0 */ 0xc0,0xc0,0xc0, + /* 8 dark grey #808080 */ 0x80,0x80,0x80, + /* 9 red #ff0000 */ 0xff,0x00,0x00, + /* a light green #00ff00 */ 0x00,0xff,0x00, + /* b yellow #ffff00 */ 0xff,0xff,0x00, + /* c blue #0000ff */ 0x00,0x00,0xff, + /* d pink #ff00ff */ 0xff,0x00,0xff, + /* e light blue #00ffff */ 0x00,0xff,0xff, + /* f white #ffffff */ 0xff,0xff,0xff +}; + +void MakeColourMap16(vncConsolePtr c) +{ + rfbColourMap* colourMap=&(c->rfbScreen->colourMap); + if(colourMap->count) + free(colourMap->data.bytes); + colourMap->data.bytes=malloc(16*3); + memcpy(colourMap->data.bytes,colourMap16,16*3); + colourMap->count=16; + colourMap->is16=FALSE; + c->rfbScreen->rfbServerFormat.trueColour=FALSE; +} + +void vcDrawOrHideCursor(vncConsolePtr c) +{ + int i,j,w=c->rfbScreen->paddedWidthInBytes; + char *b=c->rfbScreen->frameBuffer+c->y*c->cHeight*w+c->x*c->cWidth; + for(j=c->cy1;jcy2;j++) + for(i=c->cx1;icx2;i++) + b[j*w+i]^=0x0f; + rfbMarkRectAsModified(c->rfbScreen, + c->x*c->cWidth+c->cx1,c->y*c->cHeight+c->cy1, + c->x*c->cWidth+c->cx2,c->y*c->cHeight+c->cy2); + c->cursorIsDrawn=c->cursorIsDrawn?FALSE:TRUE; +} + +void vcDrawCursor(vncConsolePtr c) +{ + rfbDrawCursor(c->rfbScreen); + if(c->cursorActive && !c->cursorIsDrawn && c->yheight && c->xwidth) { + /* fprintf(stderr,"DrawCursor: %d,%d\n",c->x,c->y); */ + vcDrawOrHideCursor(c); + } +} + +void vcHideCursor(vncConsolePtr c) +{ + rfbUndrawCursor(c->rfbScreen); + if(c->currentlyMarking) + vcUnmark(c); + if(c->cursorIsDrawn) { + /* fprintf(stderr,"HideCursor: %d,%d\n",c->x,c->y); */ + vcDrawOrHideCursor(c); + } +} + +void vcMakeSureCursorIsDrawn(rfbClientPtr cl) +{ + vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; + if(!c->dontDrawCursor) + vcDrawCursor(c); +} + +vncConsolePtr vcGetConsole(int *argc,char **argv, + int width,int height,rfbFontDataPtr font +#ifdef USE_ATTRIBUTE_BUFFER + ,Bool withAttributes +#endif + ) +{ + vncConsolePtr c=(vncConsolePtr)malloc(sizeof(vncConsole)); + + c->font=font; + c->width=width; + c->height=height; + c->screenBuffer=(char*)malloc(width*height); + memset(c->screenBuffer,' ',width*height); +#ifdef USE_ATTRIBUTE_BUFFER + if(withAttributes) { + c->attributeBuffer=(char*)malloc(width*height); + memset(c->attributeBuffer,0x07,width*height); + } else + c->attributeBuffer=NULL; +#endif + c->x=0; + c->y=0; + c->wrapBottomToTop=FALSE; + c->cursorActive=TRUE; + c->cursorIsDrawn=FALSE; + c->dontDrawCursor=FALSE; + c->inputBuffer=(char*)malloc(1024); + c->inputSize=1024; + c->inputCount=0; + c->selection=0; + c->selectTimeOut=40000; /* 40 ms */ + c->doEcho=TRUE; + + c->wasRightButtonDown=FALSE; + c->currentlyMarking=FALSE; + + rfbWholeFontBBox(font,&c->xhot,&c->cHeight,&c->cWidth,&c->yhot); + c->cWidth-=c->xhot; + c->cHeight=-c->cHeight-c->yhot; + + /* text cursor */ + c->cx1=c->cWidth/8; + c->cx2=c->cWidth*7/8; + c->cy2=c->cHeight-1-c->yhot+c->cHeight/16; + if(c->cy2>=c->cHeight) + c->cy2=c->cHeight-1; + c->cy1=c->cy2-c->cHeight/8; + if(c->cy1<0) + c->cy2=0; + + c->rfbScreen= + rfbGetScreen(argc,argv,c->cWidth*c->width,c->cHeight*c->height,8,1,1); + c->rfbScreen->screenData=(void*)c; + c->rfbScreen->displayHook=vcMakeSureCursorIsDrawn; + c->rfbScreen->frameBuffer= + (char*)malloc(c->rfbScreen->width*c->rfbScreen->height); + memset(c->rfbScreen->frameBuffer,c->backColour, + c->rfbScreen->width*c->rfbScreen->height); + c->rfbScreen->kbdAddEvent=vcKbdAddEventProc; + c->rfbScreen->ptrAddEvent=vcPtrAddEventProc; + c->rfbScreen->setXCutText=vcSetXCutTextProc; + + MakeColourMap16(c); + c->foreColour=0x7; + c->backColour=0; + + rfbInitServer(c->rfbScreen); + + return(c); +} + +#include "rfbregion.h" + +/* before using this function, hide the cursor */ +void vcScroll(vncConsolePtr c,int lineCount) +{ + int y1,y2; + rfbScreenInfoPtr s=c->rfbScreen; + + if(lineCount==0) + return; + + /* fprintf(stderr,"begin scroll\n"); */ + vcHideCursor(c); + c->dontDrawCursor=TRUE; + + if(lineCount>=c->height || lineCount<=-c->height) { + y1=0; y2=s->height; + } else if(lineCount>0) { + y1=s->height-lineCount*c->cHeight; y2=s->height; + rfbDoCopyRect(s,0,0,s->width,y1,0,-lineCount*c->cHeight); + memmove(c->screenBuffer, + c->screenBuffer+(c->height-lineCount)*c->width, + (c->height-lineCount)*c->width); +#ifdef USE_ATTRIBUTE_BUFFER + memmove(c->attributeBuffer, + c->attributeBuffer+(c->height-lineCount)*c->width, + (c->height-lineCount)*c->width); +#endif + } else { + y1=0; y2=-lineCount*c->cHeight; + rfbDoCopyRect(s,0,y2,s->width,s->height,0,-lineCount*c->cHeight); + memmove(c->screenBuffer-lineCount*c->width, + c->screenBuffer, + (c->height+lineCount)*c->width); +#ifdef USE_ATTRIBUTE_BUFFER + memmove(c->attributeBuffer-lineCount*c->width, + c->attributeBuffer, + (c->height+lineCount)*c->width); +#endif + } + + c->dontDrawCursor=FALSE; + memset(s->frameBuffer+y1*s->width,c->backColour,(y2-y1)*s->width); + rfbMarkRectAsModified(s,0,y1-c->cHeight,s->width,y2); + memset(c->screenBuffer+y1/c->cHeight*c->width,' ', + (y2-y1)/c->cHeight*c->width); +#ifdef USE_ATTRIBUTE_BUFFER + memset(c->attributeBuffer+y1/c->cHeight*c->width,0x07, + (y2-y1)/c->cHeight*c->width); +#endif + /* fprintf(stderr,"end scroll\n"); */ +} + +void vcCheckCoordinates(vncConsolePtr c) +{ + if(c->x>=c->width) { + c->x=0; + c->y++; + } + if(c->y>=c->height) { + if(c->wrapBottomToTop) + c->y=0; + else { + vcScroll(c,c->y+1-c->height); + c->y=c->height-1; + } + } +} + +void vcPutChar(vncConsolePtr c,unsigned char ch) +{ +#ifdef USE_ATTRIBUTE_BUFFER + if(c->attributeBuffer) { + unsigned char colour=c->attributeBuffer[c->x+c->y*c->width]; + vcPutCharColour(c,ch,colour&0x7,colour>>4); + } else +#endif + vcPutCharColour(c,ch,c->foreColour,c->backColour); +} + +void vcPutCharColour(vncConsolePtr c,unsigned char ch,unsigned char foreColour,unsigned char backColour) +{ + rfbScreenInfoPtr s=c->rfbScreen; + int j,x,y; + + vcHideCursor(c); + if(ch<' ') { + switch(ch) { + case 7: + case 13: + break; + case 8: /* BackSpace */ + if(c->x>0) { + c->x--; + vcPutChar(c,' '); + c->x--; + } + break; + case 10: /* return */ + c->x=0; + c->y++; + vcCheckCoordinates(c); + break; + case 9: /* tabulator */ + do { + vcPutChar(c,' '); + } while(c->x%8); + break; + default: + fprintf(stderr,"putchar of unknown character: %c(%d).\n",ch,ch); + vcPutChar(c,' '); + } + } else { +#ifdef USE_ATTRIBUTE_BUFFER + if(c->attributeBuffer) + c->attributeBuffer[c->x+c->y*c->width]=foreColour|(backColour<<4); +#endif + x=c->x*c->cWidth; + y=c->y*c->cHeight; + for(j=y+c->cHeight-1;j>=y;j--) + memset(s->frameBuffer+j*s->width+x,backColour,c->cWidth); + rfbDrawChar(s,c->font, + x-c->xhot+(c->cWidth-rfbWidthOfChar(c->font,ch))/2, + y+c->cHeight-c->yhot-1, + ch,foreColour); + c->screenBuffer[c->y*c->width+c->x]=ch; + c->x++; + rfbMarkRectAsModified(s,x,y-c->cHeight+1,x+c->cWidth,y+c->cHeight+1); + vcCheckCoordinates(c); + } +} + +void vcPrint(vncConsolePtr c,unsigned char* str) +{ + while(*str) { + vcPutChar(c,*str); + str++; + } +} + +void vcPrintColour(vncConsolePtr c,unsigned char* str,unsigned char foreColour,unsigned char backColour) +{ + while(*str) { + vcPutCharColour(c,*str,foreColour,backColour); + str++; + } +} + +void vcPrintF(vncConsolePtr c,char* format,...) +{ + va_list args; + char buf[4096]; + va_start(args, format); + vsprintf(buf, format, args); + vcPrint(c,buf); + va_end(args); +} + +void vcPrintFColour(vncConsolePtr c,unsigned char foreColour,unsigned char backColour,char* format,...) +{ + va_list args; + char buf[4096]; + va_start(args, format); + vsprintf(buf, format, args); + vcPrintColour(c,buf,foreColour,backColour); + va_end(args); +} + +char vcGetCh(vncConsolePtr c) +{ + if(c->inputCount>0) { + char ch; + ch=c->inputBuffer[0]; + c->inputCount--; + if(c->inputCount>0) + memmove(c->inputBuffer,c->inputBuffer+1,c->inputCount); + return(ch); + } else + return(0); +} + +char vcGetChar(vncConsolePtr c) +{ + while(c->inputCount==0) + vcProcessEvents(c); + return(vcGetCh(c)); +} + +char *vcGetString(vncConsolePtr c,char *buffer,int bufferSize) +{ + char *bufferBackup=c->inputBuffer; + int i,count=bufferSize-1; + + if(count>c->inputCount) + count=c->inputCount; + for(i=1;iinputCount-=i; + memmove(bufferBackup,bufferBackup+i+2,c->inputCount); + return(buffer); + } + memcpy(buffer,bufferBackup,c->inputCount); + count=c->inputSize; + c->inputSize=bufferSize; + c->inputBuffer=buffer; + while(c->inputCountinputCount-1]!='\n') + vcProcessEvents(c); + buffer[c->inputCount]=0; + c->inputBuffer=bufferBackup; + c->inputSize=count; + c->inputCount=0; + return(buffer); +} + +void vcKbdAddEventProc(Bool down,KeySym keySym,rfbClientPtr cl) +{ + vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; + if(down) { + if(c->inputCountinputSize) { + if(keySym<0 || keySym>0xff) { + if(keySym==XK_Return) keySym='\n'; + else if(keySym==XK_BackSpace) keySym=8; + else if(keySym==XK_Tab) keySym=9; + else keySym=0; + } + if(keySym>0) { + if(keySym==8) { + if(c->inputCount>0) + c->inputCount--; + } else + c->inputBuffer[c->inputCount++]=(char)keySym; + if(c->doEcho) + vcPutChar(c,(unsigned char)keySym); + } + } + } +} + +void vcPtrAddEventProc(int buttonMask,int x,int y,rfbClientPtr cl) +{ + vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; + + rfbUndrawCursor(c->rfbScreen); + + if(c->wasRightButtonDown) { + if((buttonMask&4)==0) { + if(c->selection) { + char* s; + for(s=c->selection;*s;s++) { + c->rfbScreen->kbdAddEvent(1,*s,cl); + c->rfbScreen->kbdAddEvent(0,*s,cl); + } + } + c->wasRightButtonDown=0; + } + } else if(buttonMask&4) + c->wasRightButtonDown=1; + + if(buttonMask&1) { + int cx=x/c->cWidth,cy=y/c->cHeight,pos; + if(cx<0) cx=0; else if(cx>=c->width) cx=c->width-1; + if(cy<0) cy=0; else if(cy>=c->height) cy=c->height-1; + pos=cy*c->width+cx; + + // mark + if(!c->currentlyMarking) { + c->currentlyMarking=TRUE; + c->markStart=pos; + c->markEnd=pos; + vcToggleMarkCell(c,pos); + } else { + DEBUG(fprintf(stderr,"markStart: %d, markEnd: %d, pos: %d\n", + c->markStart,c->markEnd,pos)); + if(c->markEnd!=pos) { + if(c->markEndmarkEnd; cy=pos; + } else { + cx=pos; cy=c->markEnd; + } + if(cxmarkStart) { + if(cymarkStart) + cy--; + } else + cx++; + while(cx<=cy) { + vcToggleMarkCell(c,cx); + cx++; + } + c->markEnd=pos; + } + } + } else if(c->currentlyMarking) { + int i,j; + if(c->markStartmarkEnd) { + i=c->markStart; j=c->markEnd+1; + } else { + i=c->markEnd; j=c->markStart; + } + if(c->selection) free(c->selection); + c->selection=(char*)malloc(j-i+1); + memcpy(c->selection,c->screenBuffer+i,j-i); + c->selection[j-i]=0; + vcUnmark(c); + rfbGotXCutText(c->rfbScreen,c->selection,j-i); + } + defaultPtrAddEvent(buttonMask,x,y,cl); +} + +void vcSetXCutTextProc(char* str,int len, struct _rfbClientRec* cl) +{ + vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; + + if(c->selection) free(c->selection); + c->selection=(char*)malloc(len+1); + memcpy(c->selection,str,len); + c->selection[len]=0; +} + +void vcToggleMarkCell(vncConsolePtr c,int pos) +{ + int x=(pos%c->width)*c->cWidth, + y=(pos/c->width)*c->cHeight; + int i,j; + rfbScreenInfoPtr s=c->rfbScreen; + char *b=s->frameBuffer+y*s->width+x; + for(j=0;jcHeight;j++) + for(i=0;icWidth;i++) + b[j*s->width+i]^=0x0f; + rfbMarkRectAsModified(c->rfbScreen,x,y,x+c->cWidth,y+c->cHeight); +} + +void vcUnmark(vncConsolePtr c) +{ + int i,j; + c->currentlyMarking=FALSE; + if(c->markStartmarkEnd) { + i=c->markStart; j=c->markEnd+1; + } else { + i=c->markEnd; j=c->markStart; + } + for(;irfbScreen,c->selectTimeOut); +} + diff --git a/vncterm/VNConsole.h b/vncterm/VNConsole.h new file mode 100644 index 0000000..855f0fa --- /dev/null +++ b/vncterm/VNConsole.h @@ -0,0 +1,95 @@ +#include "rfb.h" + +/* this is now the default */ +#define USE_ATTRIBUTE_BUFFER + +typedef struct vncConsole { + /* width and height in cells (=characters) */ + int width, height; + + /* current position */ + int x,y; + + /* characters */ + char *screenBuffer; + +#ifdef USE_ATTRIBUTE_BUFFER + /* attributes: colours. If NULL, default to gray on black, else + for each cell an unsigned char holds foreColour|(backColour<<4) */ + char *attributeBuffer; +#endif + + /* if this is set, the screen doesn't scroll. */ + Bool wrapBottomToTop; + + /* height and width of one character */ + int cWidth, cHeight; + /* offset of characters */ + int xhot,yhot; + + /* colour */ + unsigned char foreColour,backColour; + int8_t cx1,cy1,cx2,cy2; + + /* input buffer */ + char *inputBuffer; + int inputCount; + int inputSize; + long selectTimeOut; + Bool doEcho; /* if reading input, do output directly? */ + + /* selection */ + char *selection; + + /* mouse */ + Bool wasRightButtonDown; + Bool currentlyMarking; + int markStart,markEnd; + + /* should text cursor be drawn? (an underscore at current position) */ + Bool cursorActive; + Bool cursorIsDrawn; + Bool dontDrawCursor; /* for example, while scrolling */ + + rfbFontDataPtr font; + rfbScreenInfoPtr rfbScreen; +} vncConsole, *vncConsolePtr; + +#ifdef USE_ATTRIBUTE_BUFFER +vncConsolePtr vcGetConsole(int *argc,char **argv, + int width,int height,rfbFontDataPtr font, + Bool withAttributes); +#else +vncConsolePtr vcGetConsole(int argc,char **argv, + int width,int height,rfbFontDataPtr font); +#endif +void vcDrawCursor(vncConsolePtr c); +void vcHideCursor(vncConsolePtr c); +void vcCheckCoordinates(vncConsolePtr c); + +void vcPutChar(vncConsolePtr c,unsigned char ch); +void vcPrint(vncConsolePtr c,unsigned char* str); +void vcPrintF(vncConsolePtr c,char* format,...); + +void vcPutCharColour(vncConsolePtr c,unsigned char ch, + unsigned char foreColour,unsigned char backColour); +void vcPrintColour(vncConsolePtr c,unsigned char* str, + unsigned char foreColour,unsigned char backColour); +void vcPrintFColour(vncConsolePtr c,unsigned char foreColour, + unsigned char backColour,char* format,...); + +char vcGetCh(vncConsolePtr c); +char vcGetChar(vncConsolePtr c); /* blocking */ +char *vcGetString(vncConsolePtr c,char *buffer,int maxLen); + +void vcKbdAddEventProc(Bool down,KeySym keySym,rfbClientPtr cl); +void vcPtrAddEventProc(int buttonMask,int x,int y,rfbClientPtr cl); +void vcSetXCutTextProc(char* str,int len, struct _rfbClientRec* cl); + +void vcToggleMarkCell(vncConsolePtr c,int pos); +void vcUnmark(vncConsolePtr c); + +void vcProcessEvents(vncConsolePtr c); + +/* before using this function, hide the cursor */ +void vcScroll(vncConsolePtr c,int lineCount); diff --git a/vncterm/example.c b/vncterm/example.c new file mode 100644 index 0000000..fd77d54 --- /dev/null +++ b/vncterm/example.c @@ -0,0 +1,32 @@ +#include "VNConsole.h" +#include "vga.h" + +int main(int argc,char **argv) +{ + vncConsolePtr c=vcGetConsole(&argc,argv,80,25,&vgaFont,FALSE); + char buffer[1024]; + int i,j,l; + for(j=32;j<256;j+=16) { + vcPrintF(c,"%02x: ",j); + for(i=j;i ",i); + vcGetString(c,buffer,1024); + l=strlen(buffer)-1; + while(l>=0 && buffer[l]=='\n') + buffer[l]=0; + //fprintf(stderr,"%s (%d)",buffer,strlen(buffer)); + if(!strcmp(buffer,"quit")) + return(0); + if(!strcmp(buffer,"s")) + vcScroll(c,2); + if(!strcmp(buffer,"S")) + vcScroll(c,-2); + i++; + } + return(0); +} diff --git a/vncterm/vga.h b/vncterm/vga.h new file mode 100644 index 0000000..21e03eb --- /dev/null +++ b/vncterm/vga.h @@ -0,0 +1,261 @@ +unsigned char vgaFontData[2399]={ +0x7c,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c, /* 0 */ +0x7e,0x81,0xa5,0x81,0x81,0xa5,0x99,0x81,0x81,0x7e, /* 1 */ +0x7e,0xff,0xdb,0xff,0xff,0xdb,0xe7,0xff,0xff,0x7e, /* 2 */ +0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10, /* 3 */ +0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, /* 4 */ +0x18,0x3c,0x3c,0xe7,0xe7,0xe7,0x18,0x18,0x3c, /* 5 */ +0x18,0x3c,0x7e,0xff,0xff,0x7e,0x18,0x18,0x3c, /* 6 */ +0x60,0xf0,0xf0,0x60, /* 7 */ +0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, /* 8 */ +0x78,0xcc,0x84,0x84,0xcc,0x78, /* 9 */ +0xff,0xff,0xff,0xff,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xff,0xff,0xff,0xff, /* 10 */ +0x1e,0x06,0x0e,0x1a,0x78,0xcc,0xcc,0xcc,0xcc,0x78, /* 11 */ +0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0xfc,0x30,0x30, /* 12 */ +0x3f,0x33,0x3f,0x30,0x30,0x30,0x30,0x70,0xf0,0xe0, /* 13 */ +0x7f,0x63,0x7f,0x63,0x63,0x63,0x63,0x67,0xe7,0xe6,0xc0, /* 14 */ +0x18,0x18,0xdb,0x3c,0xe7,0x3c,0xdb,0x18,0x18, /* 15 */ +0x80,0xc0,0xe0,0xf0,0xf8,0xfe,0xf8,0xf0,0xe0,0xc0,0x80, /* 16 */ +0x02,0x06,0x0e,0x1e,0x3e,0xfe,0x3e,0x1e,0x0e,0x06,0x02, /* 17 */ +0x30,0x78,0xfc,0x30,0x30,0x30,0xfc,0x78,0x30, /* 18 */ +0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0xcc,0xcc, /* 19 */ +0x7f,0xdb,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x1b,0x1b, /* 20 */ +0x7c,0xc6,0x60,0x38,0x6c,0xc6,0xc6,0x6c,0x38,0x0c,0xc6,0x7c, /* 21 */ +0xfe,0xfe,0xfe,0xfe, /* 22 */ +0x30,0x78,0xfc,0x30,0x30,0x30,0xfc,0x78,0x30,0xfc, /* 23 */ +0x30,0x78,0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30, /* 24 */ +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0x78,0x30, /* 25 */ +0x18,0x0c,0xfe,0x0c,0x18, /* 26 */ +0x30,0x60,0xfe,0x60,0x30, /* 27 */ +0xc0,0xc0,0xc0,0xfe, /* 28 */ +0x28,0x6c,0xfe,0x6c,0x28, /* 29 */ +0x10,0x38,0x38,0x7c,0x7c,0xfe,0xfe, /* 30 */ +0xfe,0xfe,0x7c,0x7c,0x38,0x38,0x10, /* 31 */ + /* 32 */ +0x60,0xf0,0xf0,0xf0,0x60,0x60,0x60,0x00,0x60,0x60, /* 33 */ +0xcc,0xcc,0xcc,0x48, /* 34 */ +0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c, /* 35 */ +0x18,0x18,0x7c,0xc6,0xc2,0xc0,0x7c,0x06,0x06,0x86,0xc6,0x7c,0x18,0x18, /* 36 */ +0xc2,0xc6,0x0c,0x18,0x30,0x60,0xc6,0x86, /* 37 */ +0x38,0x6c,0x6c,0x38,0x76,0xdc,0xcc,0xcc,0xcc,0x76, /* 38 */ +0x60,0x60,0x60,0xc0, /* 39 */ +0x30,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60,0x30, /* 40 */ +0xc0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xc0, /* 41 */ +0x66,0x3c,0xff,0x3c,0x66, /* 42 */ +0x30,0x30,0xfc,0x30,0x30, /* 43 */ +0x60,0x60,0x60,0xc0, /* 44 */ +0xfe, /* 45 */ +0xc0,0xc0, /* 46 */ +0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80, /* 47 */ +0x38,0x6c,0xc6,0xc6,0xd6,0xd6,0xc6,0xc6,0x6c,0x38, /* 48 */ +0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0xfc, /* 49 */ +0x7c,0xc6,0x06,0x0c,0x18,0x30,0x60,0xc0,0xc6,0xfe, /* 50 */ +0x7c,0xc6,0x06,0x06,0x3c,0x06,0x06,0x06,0xc6,0x7c, /* 51 */ +0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x0c,0x0c,0x1e, /* 52 */ +0xfe,0xc0,0xc0,0xc0,0xfc,0x06,0x06,0x06,0xc6,0x7c, /* 53 */ +0x38,0x60,0xc0,0xc0,0xfc,0xc6,0xc6,0xc6,0xc6,0x7c, /* 54 */ +0xfe,0xc6,0x06,0x06,0x0c,0x18,0x30,0x30,0x30,0x30, /* 55 */ +0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,0xc6,0xc6,0xc6,0x7c, /* 56 */ +0x7c,0xc6,0xc6,0xc6,0x7e,0x06,0x06,0x06,0x0c,0x78, /* 57 */ +0xc0,0xc0,0x00,0x00,0x00,0xc0,0xc0, /* 58 */ +0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xc0, /* 59 */ +0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c, /* 60 */ +0xfc,0x00,0x00,0xfc, /* 61 */ +0xc0,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0xc0, /* 62 */ +0x7c,0xc6,0xc6,0x0c,0x18,0x18,0x18,0x00,0x18,0x18, /* 63 */ +0x7c,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c, /* 64 */ +0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6, /* 65 */ +0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0x66,0xfc, /* 66 */ +0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc0,0xc2,0x66,0x3c, /* 67 */ +0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8, /* 68 */ +0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xfe, /* 69 */ +0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xf0, /* 70 */ +0x3c,0x66,0xc2,0xc0,0xc0,0xde,0xc6,0xc6,0x66,0x3a, /* 71 */ +0xc6,0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0xc6, /* 72 */ +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xf0, /* 73 */ +0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0xcc,0x78, /* 74 */ +0xe6,0x66,0x66,0x6c,0x78,0x78,0x6c,0x66,0x66,0xe6, /* 75 */ +0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xfe, /* 76 */ +0xc6,0xee,0xfe,0xfe,0xd6,0xc6,0xc6,0xc6,0xc6,0xc6, /* 77 */ +0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0xc6, /* 78 */ +0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 79 */ +0xfc,0x66,0x66,0x66,0x7c,0x60,0x60,0x60,0x60,0xf0, /* 80 */ +0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xd6,0xde,0x7c,0x0c,0x0e, /* 81 */ +0xfc,0x66,0x66,0x66,0x7c,0x6c,0x66,0x66,0x66,0xe6, /* 82 */ +0x7c,0xc6,0xc6,0x60,0x38,0x0c,0x06,0xc6,0xc6,0x7c, /* 83 */ +0xfc,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x78, /* 84 */ +0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 85 */ +0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x6c,0x38,0x10, /* 86 */ +0xc6,0xc6,0xc6,0xc6,0xd6,0xd6,0xd6,0xfe,0xee,0x6c, /* 87 */ +0xc6,0xc6,0x6c,0x7c,0x38,0x38,0x7c,0x6c,0xc6,0xc6, /* 88 */ +0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x30,0x78, /* 89 */ +0xfe,0xc6,0x86,0x0c,0x18,0x30,0x60,0xc2,0xc6,0xfe, /* 90 */ +0xf0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xf0, /* 91 */ +0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x06,0x02, /* 92 */ +0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xf0, /* 93 */ +0x10,0x38,0x6c,0xc6, /* 94 */ +0xff, /* 95 */ +0xc0,0xc0,0x60, /* 96 */ +0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 97 */ +0xe0,0x60,0x60,0x78,0x6c,0x66,0x66,0x66,0x66,0x7c, /* 98 */ +0x7c,0xc6,0xc0,0xc0,0xc0,0xc6,0x7c, /* 99 */ +0x1c,0x0c,0x0c,0x3c,0x6c,0xcc,0xcc,0xcc,0xcc,0x76, /* 100 */ +0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 101 */ +0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0, /* 102 */ +0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0xcc,0x78, /* 103 */ +0xe0,0x60,0x60,0x6c,0x76,0x66,0x66,0x66,0x66,0xe6, /* 104 */ +0x60,0x60,0x00,0xe0,0x60,0x60,0x60,0x60,0x60,0xf0, /* 105 */ +0x0c,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0x78, /* 106 */ +0xe0,0x60,0x60,0x66,0x6c,0x78,0x78,0x6c,0x66,0xe6, /* 107 */ +0xe0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xf0, /* 108 */ +0xec,0xfe,0xd6,0xd6,0xd6,0xd6,0xc6, /* 109 */ +0xdc,0x66,0x66,0x66,0x66,0x66,0x66, /* 110 */ +0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 111 */ +0xdc,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xf0, /* 112 */ +0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1e, /* 113 */ +0xdc,0x76,0x66,0x60,0x60,0x60,0xf0, /* 114 */ +0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c, /* 115 */ +0x10,0x30,0x30,0xfc,0x30,0x30,0x30,0x30,0x36,0x1c, /* 116 */ +0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 117 */ +0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30, /* 118 */ +0xc6,0xc6,0xd6,0xd6,0xd6,0xfe,0x6c, /* 119 */ +0xc6,0x6c,0x38,0x38,0x38,0x6c,0xc6, /* 120 */ +0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0xf8, /* 121 */ +0xfe,0xcc,0x18,0x30,0x60,0xc6,0xfe, /* 122 */ +0x1c,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x30,0x1c, /* 123 */ +0xc0,0xc0,0xc0,0xc0,0x00,0xc0,0xc0,0xc0,0xc0,0xc0, /* 124 */ +0xe0,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0x30,0xe0, /* 125 */ +0x76,0xdc, /* 126 */ +0x10,0x38,0x6c,0xc6,0xc6,0xc6,0xfe, /* 127 */ +0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x0c,0x06,0x7c, /* 128 */ +0xcc,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 129 */ +0x0c,0x18,0x30,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 130 */ +0x10,0x38,0x6c,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 131 */ +0xcc,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 132 */ +0x60,0x30,0x18,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 133 */ +0x38,0x6c,0x38,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 134 */ +0x78,0xcc,0xc0,0xc0,0xcc,0x78,0x18,0x0c,0x78, /* 135 */ +0x10,0x38,0x6c,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 136 */ +0xc6,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 137 */ +0x60,0x30,0x18,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 138 */ +0xcc,0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78, /* 139 */ +0x30,0x78,0xcc,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78, /* 140 */ +0xc0,0x60,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78, /* 141 */ +0xc6,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6, /* 142 */ +0x38,0x6c,0x38,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6, /* 143 */ +0x18,0x30,0x60,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0x66,0xfe, /* 144 */ +0xcc,0x76,0x36,0x7e,0xd8,0xd8,0x6e, /* 145 */ +0x3e,0x6c,0xcc,0xcc,0xfe,0xcc,0xcc,0xcc,0xcc,0xce, /* 146 */ +0x10,0x38,0x6c,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 147 */ +0xc6,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 148 */ +0x60,0x30,0x18,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 149 */ +0x30,0x78,0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 150 */ +0x60,0x30,0x18,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 151 */ +0xc6,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0x78, /* 152 */ +0xc6,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 153 */ +0xc6,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 154 */ +0x30,0x30,0x78,0xcc,0xc0,0xc0,0xc0,0xcc,0x78,0x30,0x30, /* 155 */ +0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xe6,0xfc, /* 156 */ +0xcc,0xcc,0x78,0x30,0xfc,0x30,0xfc,0x30,0x30,0x30, /* 157 */ +0xf8,0xcc,0xcc,0xf8,0xc4,0xcc,0xde,0xcc,0xcc,0xcc,0xc6, /* 158 */ +0x0e,0x1b,0x18,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x18,0xd8,0x70, /* 159 */ +0x18,0x30,0x60,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 160 */ +0x30,0x60,0xc0,0x00,0xe0,0x60,0x60,0x60,0x60,0x60,0xf0, /* 161 */ +0x18,0x30,0x60,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 162 */ +0x18,0x30,0x60,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 163 */ +0x76,0xdc,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66, /* 164 */ +0x76,0xdc,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6, /* 165 */ +0x78,0xd8,0xd8,0x7c,0x00,0xfc, /* 166 */ +0x70,0xd8,0xd8,0x70,0x00,0xf8, /* 167 */ +0x30,0x30,0x00,0x30,0x30,0x60,0xc0,0xc6,0xc6,0x7c, /* 168 */ +0xfe,0xc0,0xc0,0xc0,0xc0, /* 169 */ +0xfe,0x06,0x06,0x06,0x06, /* 170 */ +0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x60,0xdc,0x86,0x0c,0x18,0x3e, /* 171 */ +0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x66,0xce,0x9e,0x3e,0x06,0x06, /* 172 */ +0x60,0x60,0x00,0x60,0x60,0x60,0xf0,0xf0,0xf0,0x60, /* 173 */ +0x36,0x6c,0xd8,0x6c,0x36, /* 174 */ +0xd8,0x6c,0x36,0x6c,0xd8, /* 175 */ +0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88, /* 176 */ +0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, /* 177 */ +0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77, /* 178 */ +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 179 */ +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 180 */ +0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 181 */ +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 182 */ +0xfe,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 183 */ +0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 184 */ +0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 185 */ +0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 186 */ +0xfe,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 187 */ +0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xfe, /* 188 */ +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xfe, /* 189 */ +0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8, /* 190 */ +0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 191 */ +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xf8, /* 192 */ +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff, /* 193 */ +0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 194 */ +0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 195 */ +0xff, /* 196 */ +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 197 */ +0xc0,0xc0,0xc0,0xc0,0xc0,0xf8,0xc0,0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 198 */ +0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xdc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 199 */ +0xd8,0xd8,0xd8,0xd8,0xd8,0xdc,0xc0,0xfc, /* 200 */ +0xfc,0xc0,0xdc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 201 */ +0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xff, /* 202 */ +0xff,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 203 */ +0xd8,0xd8,0xd8,0xd8,0xd8,0xdc,0xc0,0xdc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 204 */ +0xff,0x00,0xff, /* 205 */ +0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 206 */ +0x18,0x18,0x18,0x18,0x18,0xff,0x00,0xff, /* 207 */ +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff, /* 208 */ +0xff,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 209 */ +0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 210 */ +0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xfc, /* 211 */ +0xc0,0xc0,0xc0,0xc0,0xc0,0xf8,0xc0,0xf8, /* 212 */ +0xf8,0xc0,0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 213 */ +0xfc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 214 */ +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 215 */ +0x18,0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 216 */ +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8, /* 217 */ +0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 218 */ +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, /* 219 */ +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, /* 220 */ +0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, /* 221 */ +0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, /* 222 */ +0xff,0xff,0xff,0xff,0xff,0xff,0xff, /* 223 */ +0x76,0xdc,0xd8,0xd8,0xd8,0xdc,0x76, /* 224 */ +0x78,0xcc,0xcc,0xcc,0xd8,0xcc,0xc6,0xc6,0xc6,0xcc, /* 225 */ +0xfe,0xc6,0xc6,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 226 */ +0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c, /* 227 */ +0xfe,0xc6,0x60,0x30,0x18,0x30,0x60,0xc6,0xfe, /* 228 */ +0x7e,0xd8,0xd8,0xd8,0xd8,0xd8,0x70, /* 229 */ +0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xc0, /* 230 */ +0x76,0xdc,0x18,0x18,0x18,0x18,0x18,0x18, /* 231 */ +0xfc,0x30,0x78,0xcc,0xcc,0xcc,0x78,0x30,0xfc, /* 232 */ +0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0x6c,0x38, /* 233 */ +0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x6c,0x6c,0x6c,0xee, /* 234 */ +0x3c,0x60,0x30,0x18,0x7c,0xcc,0xcc,0xcc,0xcc,0x78, /* 235 */ +0x7e,0xdb,0xdb,0xdb,0x7e, /* 236 */ +0x03,0x06,0x7e,0xdb,0xdb,0xf3,0x7e,0x60,0xc0, /* 237 */ +0x38,0x60,0xc0,0xc0,0xf8,0xc0,0xc0,0xc0,0x60,0x38, /* 238 */ +0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6, /* 239 */ +0xfe,0x00,0x00,0xfe,0x00,0x00,0xfe, /* 240 */ +0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0xff, /* 241 */ +0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00,0xfc, /* 242 */ +0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x00,0xfc, /* 243 */ +0x70,0xd8,0xd8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 244 */ +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0xd8,0x70, /* 245 */ +0x30,0x30,0x00,0xfc,0x00,0x30,0x30, /* 246 */ +0x76,0xdc,0x00,0x76,0xdc, /* 247 */ +0x70,0xd8,0xd8,0x70, /* 248 */ +0xc0,0xc0, /* 249 */ +0xc0, /* 250 */ +0x0f,0x0c,0x0c,0x0c,0x0c,0x0c,0xec,0x6c,0x6c,0x3c,0x1c, /* 251 */ +0xd8,0x6c,0x6c,0x6c,0x6c,0x6c, /* 252 */ +0x70,0xd8,0x30,0x60,0xc8,0xf8, /* 253 */ +0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8, /* 254 */ + /* 255 */ +}; +int vgaFontMetaData[256*5]={ +0,8,9,0,0,9,8,10,0,0,19,8,10,0,0,29,8,8,0,0,37,8,7,0,1,44,8,9,0,0,53,8,9,0,0,62,8,4,2,2,66,8,16,0,-4,82,8,6,1,1,88,8,16,0,-4,104,8,10,0,0,114,8,10,1,0,124,8,10,0,0,134,8,11,0,-1,145,8,9,0,0,154,8,11,0,0,165,8,11,0,0,176,8,9,1,1,185,8,10,1,0,195,8,10,0,0,205,8,12,0,-1,217,8,4,0,0,221,8,10,1,0,231,8,10,1,0,241,8,10,1,0,251,8,5,0,2,256,8,5,0,2,261,8,4,0,2,265,8,5,0,2,270,8,7,0,1,277,8,7,0,1,284,8,0,0,0,284,8,10,2,0,294,8,4,1,7,298,8,9,0,0,307,8,14,0,-2,321,8,8,0,0,329,8,10,0,0,339,8,4,1,7,343,8,10,2,0,353,8,10,2,0,363,8,5,0,2,368,8,5,1,2,373,8,4,2,-1,377,8,1,0,4,378,8,2,3,0,380,8,8,0,0,388,8,10,0,0,398,8,10,1,0,408,8,10,0,0,418,8,10,0,0,428,8,10,0,0,438,8,10,0,0,448,8,10,0,0,458,8,10,0,0,468,8,10,0,0,478,8,10,0,0,488,8,7,3,1,495,8,8,2,0,503,8,9,1,0,512,8,4,1,3,516,8,9,1,0,525,8,10,0,0,535,8,9,0,0,544,8,10,0,0,554,8,10,0,0,564,8,10,0,0,574,8,10,0,0,584,8,10,0,0,594,8,10,0,0,604,8,10,0,0,614,8,10,0,0,624,8,10,2,0,634,8,10,0,0,644,8,10,0,0,654,8,10,0,0,664,8,10,0,0,674,8,10,0,0,684,8,10,0,0,694,8,10,0,0,704,8,12,0,-2,716,8,10,0,0,726,8,10,0,0,736,8,10,1,0,746,8,10,0,0,756,8,10,0,0,766,8,10,0,0,776,8,10,0,0,786,8,10,1,0,796,8,10,0,0,806,8,10,2,0,816,8,9,0,0,825,8,10,2,0,835,8,4,0,8,839,8,1,0,-2,840,8,3,2,9,843,8,7,0,0,850,8,10,0,0,860,8,7,0,0,867,8,10,0,0,877,8,7,0,0,884,8,10,0,0,894,8,10,0,-3,904,8,10,0,0,914,8,10,2,0,924,8,13,1,-3,937,8,10,0,0,947,8,10,2,0,957,8,7,0,0,964,8,7,0,0,971,8,7,0,0,978,8,10,0,-3,988,8,10,0,-3,998,8,7,0,0,1005,8,7,0,0,1012,8,10,0,0,1022,8,7,0,0,1029,8,7,1,0,1036,8,7,0,0,1043,8,7,0,0,1050,8,10,0,-3,1060,8,7,0,0,1067,8,10,1,0,1077,8,10,3,0,1087,8,10,1,0,1097,8,2,0,8,1099,8,7,0,1,1106,8,12,0,-2,1118,8,10,0,0,1128,8,11,0,0,1139,8,11,0,0,1150,8,10,0,0,1160,8,11,0,0,1171,8,11,0,0,1182,8,9,1,-1,1191,8,11,0,0,1202,8,10,0,0,1212,8,11,0,0,1223,8,10,1,0,1233,8,11,1,0,1244,8,11,1,0,1255,8,11,0,0,1266,8,12,0,0,1278,8,12,0,0,1290,8,7,0,0,1297,8,10,0,0,1307,8,11,0,0,1318,8,10,0,0,1328,8,11,0,0,1339,8,11,0,0,1350,8,11,0,0,1361,8,13,0,-3,1374,8,11,0,0,1385,8,11,0,0,1396,8,11,1,0,1407,8,11,0,0,1418,8,10,1,0,1428,8,11,0,0,1439,8,13,0,-2,1452,8,11,0,0,1463,8,11,2,0,1474,8,11,0,0,1485,8,11,0,0,1496,8,10,0,0,1506,8,12,0,0,1518,8,6,1,5,1524,8,6,1,5,1530,8,10,0,0,1540,8,5,0,1,1545,8,5,0,1,1550,8,13,0,-2,1563,8,13,0,-2,1576,8,10,2,0,1586,8,5,0,2,1591,8,5,0,2,1596,8,16,1,-4,1612,8,16,0,-4,1628,8,16,0,-4,1644,8,16,3,-4,1660,8,16,0,-4,1676,8,16,0,-4,1692,8,16,0,-4,1708,8,9,0,-4,1717,8,11,0,-4,1728,8,16,0,-4,1744,8,16,2,-4,1760,8,11,0,-4,1771,8,8,0,4,1779,8,8,0,4,1787,8,8,0,4,1795,8,9,0,-4,1804,8,8,3,4,1812,8,8,0,4,1820,8,9,0,-4,1829,8,16,3,-4,1845,8,1,0,4,1846,8,16,0,-4,1862,8,16,3,-4,1878,8,16,2,-4,1894,8,8,2,4,1902,8,11,2,-4,1913,8,8,0,4,1921,8,11,0,-4,1932,8,16,2,-4,1948,8,3,0,4,1951,8,16,0,-4,1967,8,8,0,4,1975,8,8,0,4,1983,8,11,0,-4,1994,8,9,0,-4,2003,8,8,2,4,2011,8,8,3,4,2019,8,11,3,-4,2030,8,9,2,-4,2039,8,16,0,-4,2055,8,16,0,-4,2071,8,8,0,4,2079,8,9,3,-4,2088,8,16,0,-4,2104,8,9,0,-4,2113,8,16,0,-4,2129,8,16,4,-4,2145,8,7,0,5,2152,8,7,0,0,2159,8,10,0,0,2169,8,10,0,0,2179,8,8,0,0,2187,8,9,0,0,2196,8,7,0,0,2203,8,9,0,-1,2212,8,8,0,0,2220,8,9,1,0,2229,8,9,0,0,2238,8,10,0,0,2248,8,10,1,0,2258,8,5,0,2,2263,8,9,0,0,2272,8,10,1,0,2282,8,9,0,0,2291,8,7,0,1,2298,8,8,0,0,2306,8,9,1,0,2315,8,9,1,0,2324,8,14,3,-4,2338,8,12,0,0,2350,8,7,1,1,2357,8,5,0,2,2362,8,4,1,7,2366,8,2,3,3,2368,8,1,3,3,2369,8,11,0,0,2380,8,6,0,5,2386,8,6,0,5,2392,8,7,1,1,2399,8,0,0,0,}; +rfbFontData vgaFont={vgaFontData, vgaFontMetaData}; -- cgit v1.2.1