blob: ae6822d5a1bd27fb0d060016d43791f9b0361d5e [file] [log] [blame]
San Mehata430b2b2014-09-23 08:30:51 -07001#include <rfb/rfb.h>
2
3/* this is now the default */
4#define USE_ATTRIBUTE_BUFFER
5
6typedef struct vncConsole {
7 /* width and height in cells (=characters) */
8 int width, height;
9
10 /* current position */
11 int x,y;
12
13 /* characters */
14 char *screenBuffer;
15
16#ifdef USE_ATTRIBUTE_BUFFER
17 /* attributes: colours. If NULL, default to gray on black, else
18 for each cell an unsigned char holds foreColour|(backColour<<4) */
19 char *attributeBuffer;
20#endif
21
22 /* if this is set, the screen doesn't scroll. */
23 rfbBool wrapBottomToTop;
24
25 /* height and width of one character */
26 int cWidth, cHeight;
27 /* offset of characters */
28 int xhot,yhot;
29
30 /* colour */
31 unsigned char foreColour,backColour;
32 int8_t cx1,cy1,cx2,cy2;
33
34 /* input buffer */
35 char *inputBuffer;
36 int inputCount;
37 int inputSize;
38 long selectTimeOut;
39 rfbBool doEcho; /* if reading input, do output directly? */
40
41 /* selection */
42 char *selection;
43
44 /* mouse */
45 rfbBool wasRightButtonDown;
46 rfbBool currentlyMarking;
47 int markStart,markEnd;
48
49 /* should text cursor be drawn? (an underscore at current position) */
50 rfbBool cursorActive;
51 rfbBool cursorIsDrawn;
52 rfbBool dontDrawCursor; /* for example, while scrolling */
53
54 rfbFontDataPtr font;
55 rfbScreenInfoPtr screen;
56} vncConsole, *vncConsolePtr;
57
58#ifdef USE_ATTRIBUTE_BUFFER
59vncConsolePtr vcGetConsole(int *argc,char **argv,
60 int width,int height,rfbFontDataPtr font,
61 rfbBool withAttributes);
62#else
63vncConsolePtr vcGetConsole(int argc,char **argv,
64 int width,int height,rfbFontDataPtr font);
65#endif
66void vcDrawCursor(vncConsolePtr c);
67void vcHideCursor(vncConsolePtr c);
68void vcCheckCoordinates(vncConsolePtr c);
69
70void vcPutChar(vncConsolePtr c,unsigned char ch);
71void vcPrint(vncConsolePtr c,unsigned char* str);
72void vcPrintF(vncConsolePtr c,char* format,...);
73
74void vcPutCharColour(vncConsolePtr c,unsigned char ch,
75 unsigned char foreColour,unsigned char backColour);
76void vcPrintColour(vncConsolePtr c,unsigned char* str,
77 unsigned char foreColour,unsigned char backColour);
78void vcPrintFColour(vncConsolePtr c,unsigned char foreColour,
79 unsigned char backColour,char* format,...);
80
81char vcGetCh(vncConsolePtr c);
82char vcGetChar(vncConsolePtr c); /* blocking */
83char *vcGetString(vncConsolePtr c,char *buffer,int maxLen);
84
85void vcKbdAddEventProc(rfbBool down,rfbKeySym keySym,rfbClientPtr cl);
86void vcPtrAddEventProc(int buttonMask,int x,int y,rfbClientPtr cl);
87void vcSetXCutTextProc(char* str,int len, struct _rfbClientRec* cl);
88
89void vcToggleMarkCell(vncConsolePtr c,int pos);
90void vcUnmark(vncConsolePtr c);
91
92void vcProcessEvents(vncConsolePtr c);
93
94/* before using this function, hide the cursor */
95void vcScroll(vncConsolePtr c,int lineCount);