Commit d999a8ea authored by Christian Beier's avatar Christian Beier
parent 7960c687
SUBDIRS=libvncserver examples libvncclient vncterm webclients client_examples test
DIST_SUBDIRS=libvncserver examples libvncclient vncterm webclients client_examples test
SUBDIRS=libvncserver examples libvncclient webclients client_examples test
DIST_SUBDIRS=libvncserver examples libvncclient webclients client_examples test
EXTRA_DIST = CMakeLists.txt rfb/rfbint.h.cmake rfb/rfbconfig.h.cmake
bin_SCRIPTS = libvncserver-config
......
......@@ -598,7 +598,6 @@ AC_CONFIG_FILES([Makefile
libvncserver/Makefile
examples/Makefile
examples/android/Makefile
vncterm/Makefile
webclients/Makefile
webclients/java-applet/Makefile
webclients/java-applet/ssl/Makefile
......
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)
#include <rfb/keysym.h>
#include "VNConsole.h"
#include "vga.h"
#include <fcntl.h>
#include <sys/ioctl.h>
static int tty=2;
static int tty_inject_device;
void do_key(rfbBool down,rfbKeySym 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;
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)
rfbErr("Couldn't reopen device %s!\n",device);
}
}
}
} else if(keySym==XK_Control_L || keySym==XK_Control_R)
if(isControl>0)
isControl--;
}
/* these colours are from linux kernel drivers/char/console.c */
unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7,
8,12,10,14, 9,13,11,15 };
/* the default colour table, for VGA+ colour systems */
int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,
0x55,0xff,0x55,0xff,0x55,0xff,0x55,0xff};
int default_grn[] = {0x00,0x00,0xaa,0x55,0x00,0x00,0xaa,0xaa,
0x55,0x55,0xff,0xff,0x55,0x55,0xff,0xff};
int default_blu[] = {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,
0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff};
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) {
rfbErr("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) {
rfbErr("Couldn't open tty device %s!\n",tty_device);
exit(1);
}
rfbLog("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 */
if(!(console=vcGetConsole(&argc,argv,width,height,&vgaFont,TRUE)))
exit(1);
for(i=0;i<16;i++) {
console->screen->colourMap.data.bytes[i*3+0]=default_red[color_table[i]];
console->screen->colourMap.data.bytes[i*3+1]=default_grn[color_table[i]];
console->screen->colourMap.data.bytes[i*3+2]=default_blu[color_table[i]];
}
console->screen->desktopName=title;
console->screen->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(rfbIsActive(console->screen)) {
if(!console->currentlyMarking) {
tty_file=fopen(tty_device,"rb");
if(!tty_file) {
rfbErr("cannot open device \"%s\"\n",
tty_device);
exit(1);
}
#ifdef USE_OLD_VCS
fread(buffer,width,height,tty_file);
#else
if(fread(buffer,width*height*2+4,1,tty_file) != 1) {
rfbErr("Error reading framebuffer\n");
exit(1);
}
vcHideCursor(console);
#endif
fclose(tty_file);
for(i=0;i<console->width*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);
/*
rfbLog("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);
}
INCLUDES = -I$(top_srcdir)
CONSOLE_SRCS=VNConsole.c
noinst_HEADERS=VNConsole.h vga.h
LDADD=../libvncserver/libvncserver.la @WSOCKLIB@
if LINUX
if ! MINGW
if ! ANDROID
bin_PROGRAMS=linuxvnc
linuxvnc_SOURCES=LinuxVNC.c $(CONSOLE_SRCS)
endif
endif
endif
if ! MINGW
VNCOMMAND=vncommand
endif
noinst_PROGRAMS=example $(VNCOMMAND)
example_SOURCES=example.c $(CONSOLE_SRCS)
vncommand_SOURCES=VNCommand.c $(CONSOLE_SRCS)
In this stage (beta), there are two programs functional:
LinuxVNC <tty number>
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 <command> <args>
executes <command> 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.
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.
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE
#endif
#include "VNConsole.h"
#include "vga.h"
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef LIBVNCSERVER_HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef LIBVNCSERVER_HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <errno.h>
int main(int argc, char **argv)
{
rfbBool interactive=FALSE,sendOnlyWholeLines=TRUE;
int serverArgc,programArg0;
for(serverArgc=1;serverArgc<argc
&& argv[serverArgc][0]=='-' && argv[serverArgc][1]!='-';serverArgc++)
if(!strcmp(argv[serverArgc],"-interactive")) {
interactive=TRUE;
sendOnlyWholeLines=FALSE;
rfbPurgeArguments(&argc,&serverArgc,1,argv);
}
programArg0=serverArgc;
if(programArg0<argc && argv[programArg0][0]=='-' && argv[programArg0][1]=='-')
programArg0++;
argv[argc]=0;
if(programArg0<argc) {
int in[2],out[2],err[2],pid;
if(pipe(in)<0 || pipe(out)<0 || pipe(err)<0) {
rfbErr("Couldn't make pipes!");
return(1);
}
pid=fork();
if(!pid) {
dup2(in[0],0);
dup2(out[1],1);
dup2(err[1],2);
/*setbuf(stdin,NULL);*/
execvp(argv[programArg0],argv+programArg0);
}
{
char buffer[1024];
fd_set fs,fs1/*,ifs,ifs1*/;
struct timeval tv,tv1;
int i,c=1,num_fds,max_fd=out[0],status;
FILE *input_pipe;
vncConsolePtr console=vcGetConsole(&serverArgc,argv,80,25,&vgaFont,FALSE);
if(interactive)
console->doEcho = FALSE;
if(max_fd<err[0])
max_fd=err[0];
FD_ZERO(&fs);
FD_SET(out[0],&fs);
FD_SET(err[0],&fs);
/*FD_SET(0,&fs);*/
tv.tv_sec=0; tv.tv_usec=5000;
input_pipe=fdopen(in[1],"w");
setbuf(input_pipe,NULL);
while(c || waitpid(pid,&status,WNOHANG)==0) {
/* event loop */
vcProcessEvents(console);
/* get input */
if(console->inputCount) {
if(sendOnlyWholeLines) {
for(i=0;i<console->inputCount;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<c;i++)
vcPutChar(console,buffer[i]);
}
if(FD_ISSET(err[0],&fs1)) {
c=read(err[0],buffer,1024);
for(i=0;i<c;i++)
vcPutChar(console,buffer[i]);
}
} else
c=0;
}
}
}
rfbLog("exit\n");
return(0);
}
#include <stdarg.h>
#include <rfb/keysym.h>
#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->screen->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->screen->serverFormat.trueColour=FALSE;
}
void vcDrawOrHideCursor(vncConsolePtr c)
{
int i,j,w=c->screen->paddedWidthInBytes;
char *b=c->screen->frameBuffer+c->y*c->cHeight*w+c->x*c->cWidth;
for(j=c->cy1;j<c->cy2;j++)
for(i=c->cx1;i<c->cx2;i++)
b[j*w+i]^=0x0f;
rfbMarkRectAsModified(c->screen,
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)
{
if(c->cursorActive && c->y<c->height && c->x<c->width) {
/* rfbLog("DrawCursor: %d,%d\n",c->x,c->y); */
vcDrawOrHideCursor(c);
}
}
void vcHideCursor(vncConsolePtr c)
{
if(c->currentlyMarking)
vcUnmark(c);
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
,rfbBool 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;
if(!(c->screen = rfbGetScreen(argc,argv,c->cWidth*c->width,c->cHeight*c->height,8,1,1)))
return NULL;
c->screen->screenData=(void*)c;
c->screen->displayHook=vcMakeSureCursorIsDrawn;
c->screen->frameBuffer=
(char*)malloc(c->screen->width*c->screen->height);
memset(c->screen->frameBuffer,c->backColour,
c->screen->width*c->screen->height);
c->screen->kbdAddEvent=vcKbdAddEventProc;
c->screen->ptrAddEvent=vcPtrAddEventProc;
c->screen->setXCutText=vcSetXCutTextProc;
MakeColourMap16(c);
c->foreColour=0x7;
c->backColour=0;
rfbInitServer(c->screen);
return(c);
}
#include <rfb/rfbregion.h>
/* before using this function, hide the cursor */
void vcScroll(vncConsolePtr c,int lineCount)
{
int y1,y2;
rfbScreenInfoPtr s=c->screen;
if(lineCount==0)
return;
/* rfbLog("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
if(c->attributeBuffer)
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
if(c->attributeBuffer)
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
if(c->attributeBuffer)
memset(c->attributeBuffer+y1/c->cHeight*c->width,0x07,
(y2-y1)/c->cHeight*c->width);
#endif
/* rfbLog("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->screen;
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:
rfbLog("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,(unsigned char*)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,(unsigned char*)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(rfbIsActive(c->screen) && 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;i<count && bufferBackup[i-1]!='\n';i++);
if(i<count || i==bufferSize-1) {
memcpy(buffer,bufferBackup,i);
buffer[i+1]=0;
c->inputCount-=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(rfbIsActive(c->screen)
&& c->inputCount<bufferSize-1 && buffer[c->inputCount-1]!='\n')
vcProcessEvents(c);
buffer[c->inputCount]=0;
c->inputBuffer=bufferBackup;
c->inputSize=count;
c->inputCount=0;
return(buffer);
}
void vcKbdAddEventProc(rfbBool down,rfbKeySym keySym,rfbClientPtr cl)
{
vncConsolePtr c=(vncConsolePtr)cl->screen->screenData;
if(down) {
if(c->inputCount<c->inputSize) {
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;
if(c->wasRightButtonDown) {
if((buttonMask&4)==0) {
if(c->selection) {
char* s;
for(s=c->selection;*s;s++) {
c->screen->kbdAddEvent(1,*s,cl);
c->screen->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(rfbLog("markStart: %d, markEnd: %d, pos: %d\n",
c->markStart,c->markEnd,pos));
if(c->markEnd!=pos) {
if(c->markEnd<pos) {
cx=c->markEnd; cy=pos;
} else {
cx=pos; cy=c->markEnd;
}
if(cx<c->markStart) {
if(cy<c->markStart)
cy--;
} else
cx++;
while(cx<=cy) {
vcToggleMarkCell(c,cx);
cx++;
}
c->markEnd=pos;
}
}
} else if(c->currentlyMarking) {
int i,j;
if(c->markStart<c->markEnd) {
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->screen,c->selection,j-i);
}
rfbDefaultPtrAddEvent(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->screen;
char *b=s->frameBuffer+y*s->width+x;
for(j=0;j<c->cHeight;j++)
for(i=0;i<c->cWidth;i++)
b[j*s->width+i]^=0x0f;
rfbMarkRectAsModified(c->screen,x,y,x+c->cWidth,y+c->cHeight);
}
void vcUnmark(vncConsolePtr c)
{
int i,j;
c->currentlyMarking=FALSE;
if(c->markStart<c->markEnd) {
i=c->markStart; j=c->markEnd+1;
} else {
i=c->markEnd; j=c->markStart;
}
for(;i<j;i++)
vcToggleMarkCell(c,i);
}
void vcProcessEvents(vncConsolePtr c)
{
rfbProcessEvents(c->screen,c->selectTimeOut);
}
#include <rfb/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. */
rfbBool 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;
rfbBool doEcho; /* if reading input, do output directly? */
/* selection */
char *selection;
/* mouse */
rfbBool wasRightButtonDown;
rfbBool currentlyMarking;
int markStart,markEnd;
/* should text cursor be drawn? (an underscore at current position) */
rfbBool cursorActive;
rfbBool cursorIsDrawn;
rfbBool dontDrawCursor; /* for example, while scrolling */
rfbFontDataPtr font;
rfbScreenInfoPtr screen;
} vncConsole, *vncConsolePtr;
#ifdef USE_ATTRIBUTE_BUFFER
vncConsolePtr vcGetConsole(int *argc,char **argv,
int width,int height,rfbFontDataPtr font,
rfbBool 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(rfbBool down,rfbKeySym 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);
#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<j+16;i++)
vcPutChar(c,i);
vcPutChar(c,'\n');
}
i=0;
while(1) {
vcPrintF(c,"%d :> ",i);
vcGetString(c,buffer,1024);
l=strlen(buffer)-1;
while(l>=0 && buffer[l]=='\n')
buffer[l]=0;
if(!strcmp(buffer,"quit"))
return(0);
if(!strcmp(buffer,"s"))
vcScroll(c,2);
if(!strcmp(buffer,"S"))
vcScroll(c,-2);
i++;
}
return(0);
}
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};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment