VNConsole.h 2.67 KB
Newer Older
1
#include <rfb/rfb.h>
dscho's avatar
dscho committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

/* 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. */
23
  rfbBool wrapBottomToTop;
dscho's avatar
dscho committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

  /* 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;
39
  rfbBool doEcho; /* if reading input, do output directly? */
dscho's avatar
dscho committed
40 41 42 43 44

  /* selection */
  char *selection;

  /* mouse */
45 46
  rfbBool wasRightButtonDown;
  rfbBool currentlyMarking;
dscho's avatar
dscho committed
47 48 49
  int markStart,markEnd;

  /* should text cursor be drawn? (an underscore at current position) */
50 51 52
  rfbBool cursorActive;
  rfbBool cursorIsDrawn;
  rfbBool dontDrawCursor; /* for example, while scrolling */
dscho's avatar
dscho committed
53 54

  rfbFontDataPtr font;
55
  rfbScreenInfoPtr screen;
dscho's avatar
dscho committed
56 57 58 59 60
} vncConsole, *vncConsolePtr;

#ifdef USE_ATTRIBUTE_BUFFER
vncConsolePtr vcGetConsole(int *argc,char **argv,
			   int width,int height,rfbFontDataPtr font,
61
			   rfbBool withAttributes);
dscho's avatar
dscho committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#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);

85
void vcKbdAddEventProc(rfbBool down,rfbKeySym keySym,rfbClientPtr cl);
dscho's avatar
dscho committed
86 87 88 89 90 91 92 93 94 95
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);