• Home
  • Raw
  • Download

Lines Matching refs:c

26 void MakeColourMap16(vncConsolePtr c)  in MakeColourMap16()  argument
28 rfbColourMap* colourMap=&(c->screen->colourMap); in MakeColourMap16()
35 c->screen->serverFormat.trueColour=FALSE; in MakeColourMap16()
38 void vcDrawOrHideCursor(vncConsolePtr c) in vcDrawOrHideCursor() argument
40 int i,j,w=c->screen->paddedWidthInBytes; in vcDrawOrHideCursor()
41 char *b=c->screen->frameBuffer+c->y*c->cHeight*w+c->x*c->cWidth; in vcDrawOrHideCursor()
42 for(j=c->cy1;j<c->cy2;j++) in vcDrawOrHideCursor()
43 for(i=c->cx1;i<c->cx2;i++) in vcDrawOrHideCursor()
45 rfbMarkRectAsModified(c->screen, in vcDrawOrHideCursor()
46 c->x*c->cWidth+c->cx1,c->y*c->cHeight+c->cy1, in vcDrawOrHideCursor()
47 c->x*c->cWidth+c->cx2,c->y*c->cHeight+c->cy2); in vcDrawOrHideCursor()
48 c->cursorIsDrawn=c->cursorIsDrawn?FALSE:TRUE; in vcDrawOrHideCursor()
51 void vcDrawCursor(vncConsolePtr c) in vcDrawCursor() argument
53 if(c->cursorActive && c->y<c->height && c->x<c->width) { in vcDrawCursor()
55 vcDrawOrHideCursor(c); in vcDrawCursor()
59 void vcHideCursor(vncConsolePtr c) in vcHideCursor() argument
61 if(c->currentlyMarking) in vcHideCursor()
62 vcUnmark(c); in vcHideCursor()
63 vcDrawOrHideCursor(c); in vcHideCursor()
68 vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; in vcMakeSureCursorIsDrawn() local
69 if(!c->dontDrawCursor) in vcMakeSureCursorIsDrawn()
70 vcDrawCursor(c); in vcMakeSureCursorIsDrawn()
80 vncConsolePtr c=(vncConsolePtr)malloc(sizeof(vncConsole)); in vcGetConsole() local
82 c->font=font; in vcGetConsole()
83 c->width=width; in vcGetConsole()
84 c->height=height; in vcGetConsole()
85 c->screenBuffer=(char*)malloc(width*height); in vcGetConsole()
86 memset(c->screenBuffer,' ',width*height); in vcGetConsole()
89 c->attributeBuffer=(char*)malloc(width*height); in vcGetConsole()
90 memset(c->attributeBuffer,0x07,width*height); in vcGetConsole()
92 c->attributeBuffer=NULL; in vcGetConsole()
94 c->x=0; in vcGetConsole()
95 c->y=0; in vcGetConsole()
96 c->wrapBottomToTop=FALSE; in vcGetConsole()
97 c->cursorActive=TRUE; in vcGetConsole()
98 c->cursorIsDrawn=FALSE; in vcGetConsole()
99 c->dontDrawCursor=FALSE; in vcGetConsole()
100 c->inputBuffer=(char*)malloc(1024); in vcGetConsole()
101 c->inputSize=1024; in vcGetConsole()
102 c->inputCount=0; in vcGetConsole()
103 c->selection=0; in vcGetConsole()
104 c->selectTimeOut=40000; /* 40 ms */ in vcGetConsole()
105 c->doEcho=TRUE; in vcGetConsole()
107 c->wasRightButtonDown=FALSE; in vcGetConsole()
108 c->currentlyMarking=FALSE; in vcGetConsole()
110 rfbWholeFontBBox(font,&c->xhot,&c->cHeight,&c->cWidth,&c->yhot); in vcGetConsole()
111 c->cWidth-=c->xhot; in vcGetConsole()
112 c->cHeight=-c->cHeight-c->yhot; in vcGetConsole()
115 c->cx1=c->cWidth/8; in vcGetConsole()
116 c->cx2=c->cWidth*7/8; in vcGetConsole()
117 c->cy2=c->cHeight-1-c->yhot+c->cHeight/16; in vcGetConsole()
118 if(c->cy2>=c->cHeight) in vcGetConsole()
119 c->cy2=c->cHeight-1; in vcGetConsole()
120 c->cy1=c->cy2-c->cHeight/8; in vcGetConsole()
121 if(c->cy1<0) in vcGetConsole()
122 c->cy2=0; in vcGetConsole()
124 if(!(c->screen = rfbGetScreen(argc,argv,c->cWidth*c->width,c->cHeight*c->height,8,1,1))) in vcGetConsole()
126 c->screen->screenData=(void*)c; in vcGetConsole()
127 c->screen->displayHook=vcMakeSureCursorIsDrawn; in vcGetConsole()
128 c->screen->frameBuffer= in vcGetConsole()
129 (char*)malloc(c->screen->width*c->screen->height); in vcGetConsole()
130 memset(c->screen->frameBuffer,c->backColour, in vcGetConsole()
131 c->screen->width*c->screen->height); in vcGetConsole()
132 c->screen->kbdAddEvent=vcKbdAddEventProc; in vcGetConsole()
133 c->screen->ptrAddEvent=vcPtrAddEventProc; in vcGetConsole()
134 c->screen->setXCutText=vcSetXCutTextProc; in vcGetConsole()
136 MakeColourMap16(c); in vcGetConsole()
137 c->foreColour=0x7; in vcGetConsole()
138 c->backColour=0; in vcGetConsole()
140 rfbInitServer(c->screen); in vcGetConsole()
142 return(c); in vcGetConsole()
148 void vcScroll(vncConsolePtr c,int lineCount) in vcScroll() argument
151 rfbScreenInfoPtr s=c->screen; in vcScroll()
157 vcHideCursor(c); in vcScroll()
158 c->dontDrawCursor=TRUE; in vcScroll()
160 if(lineCount>=c->height || lineCount<=-c->height) { in vcScroll()
163 y1=s->height-lineCount*c->cHeight; y2=s->height; in vcScroll()
164 rfbDoCopyRect(s,0,0,s->width,y1,0,-lineCount*c->cHeight); in vcScroll()
165 memmove(c->screenBuffer, in vcScroll()
166 c->screenBuffer+(c->height-lineCount)*c->width, in vcScroll()
167 (c->height-lineCount)*c->width); in vcScroll()
169 if(c->attributeBuffer) in vcScroll()
170 memmove(c->attributeBuffer, in vcScroll()
171 c->attributeBuffer+(c->height-lineCount)*c->width, in vcScroll()
172 (c->height-lineCount)*c->width); in vcScroll()
175 y1=0; y2=-lineCount*c->cHeight; in vcScroll()
176 rfbDoCopyRect(s,0,y2,s->width,s->height,0,-lineCount*c->cHeight); in vcScroll()
177 memmove(c->screenBuffer-lineCount*c->width, in vcScroll()
178 c->screenBuffer, in vcScroll()
179 (c->height+lineCount)*c->width); in vcScroll()
181 if(c->attributeBuffer) in vcScroll()
182 memmove(c->attributeBuffer-lineCount*c->width, in vcScroll()
183 c->attributeBuffer, in vcScroll()
184 (c->height+lineCount)*c->width); in vcScroll()
188 c->dontDrawCursor=FALSE; in vcScroll()
189 memset(s->frameBuffer+y1*s->width,c->backColour,(y2-y1)*s->width); in vcScroll()
190 rfbMarkRectAsModified(s,0,y1-c->cHeight,s->width,y2); in vcScroll()
191 memset(c->screenBuffer+y1/c->cHeight*c->width,' ', in vcScroll()
192 (y2-y1)/c->cHeight*c->width); in vcScroll()
194 if(c->attributeBuffer) in vcScroll()
195 memset(c->attributeBuffer+y1/c->cHeight*c->width,0x07, in vcScroll()
196 (y2-y1)/c->cHeight*c->width); in vcScroll()
201 void vcCheckCoordinates(vncConsolePtr c) in vcCheckCoordinates() argument
203 if(c->x>=c->width) { in vcCheckCoordinates()
204 c->x=0; in vcCheckCoordinates()
205 c->y++; in vcCheckCoordinates()
207 if(c->y>=c->height) { in vcCheckCoordinates()
208 if(c->wrapBottomToTop) in vcCheckCoordinates()
209 c->y=0; in vcCheckCoordinates()
211 vcScroll(c,c->y+1-c->height); in vcCheckCoordinates()
212 c->y=c->height-1; in vcCheckCoordinates()
217 void vcPutChar(vncConsolePtr c,unsigned char ch) in vcPutChar() argument
220 if(c->attributeBuffer) { in vcPutChar()
221 unsigned char colour=c->attributeBuffer[c->x+c->y*c->width]; in vcPutChar()
222 vcPutCharColour(c,ch,colour&0x7,colour>>4); in vcPutChar()
225 vcPutCharColour(c,ch,c->foreColour,c->backColour); in vcPutChar()
228 void vcPutCharColour(vncConsolePtr c,unsigned char ch,unsigned char foreColour,unsigned char backCo… in vcPutCharColour() argument
230 rfbScreenInfoPtr s=c->screen; in vcPutCharColour()
233 vcHideCursor(c); in vcPutCharColour()
240 if(c->x>0) { in vcPutCharColour()
241 c->x--; in vcPutCharColour()
242 vcPutChar(c,' '); in vcPutCharColour()
243 c->x--; in vcPutCharColour()
247 c->x=0; in vcPutCharColour()
248 c->y++; in vcPutCharColour()
249 vcCheckCoordinates(c); in vcPutCharColour()
253 vcPutChar(c,' '); in vcPutCharColour()
254 } while(c->x%8); in vcPutCharColour()
258 vcPutChar(c,' '); in vcPutCharColour()
262 if(c->attributeBuffer) in vcPutCharColour()
263 c->attributeBuffer[c->x+c->y*c->width]=foreColour|(backColour<<4); in vcPutCharColour()
265 x=c->x*c->cWidth; in vcPutCharColour()
266 y=c->y*c->cHeight; in vcPutCharColour()
267 for(j=y+c->cHeight-1;j>=y;j--) in vcPutCharColour()
268 memset(s->frameBuffer+j*s->width+x,backColour,c->cWidth); in vcPutCharColour()
269 rfbDrawChar(s,c->font, in vcPutCharColour()
270 x-c->xhot+(c->cWidth-rfbWidthOfChar(c->font,ch))/2, in vcPutCharColour()
271 y+c->cHeight-c->yhot-1, in vcPutCharColour()
273 c->screenBuffer[c->y*c->width+c->x]=ch; in vcPutCharColour()
274 c->x++; in vcPutCharColour()
275 rfbMarkRectAsModified(s,x,y-c->cHeight+1,x+c->cWidth,y+c->cHeight+1); in vcPutCharColour()
276 vcCheckCoordinates(c); in vcPutCharColour()
280 void vcPrint(vncConsolePtr c,unsigned char* str) in vcPrint() argument
283 vcPutChar(c,*str); in vcPrint()
288 void vcPrintColour(vncConsolePtr c,unsigned char* str,unsigned char foreColour,unsigned char backCo… in vcPrintColour() argument
291 vcPutCharColour(c,*str,foreColour,backColour); in vcPrintColour()
296 void vcPrintF(vncConsolePtr c,char* format,...) in vcPrintF() argument
302 vcPrint(c,(unsigned char*)buf); in vcPrintF()
306 void vcPrintFColour(vncConsolePtr c,unsigned char foreColour,unsigned char backColour,char* format,… in vcPrintFColour() argument
312 vcPrintColour(c,(unsigned char*)buf,foreColour,backColour); in vcPrintFColour()
316 char vcGetCh(vncConsolePtr c) in vcGetCh() argument
318 if(c->inputCount>0) { in vcGetCh()
320 ch=c->inputBuffer[0]; in vcGetCh()
321 c->inputCount--; in vcGetCh()
322 if(c->inputCount>0) in vcGetCh()
323 memmove(c->inputBuffer,c->inputBuffer+1,c->inputCount); in vcGetCh()
329 char vcGetChar(vncConsolePtr c) in vcGetChar() argument
331 while(rfbIsActive(c->screen) && c->inputCount==0) in vcGetChar()
332 vcProcessEvents(c); in vcGetChar()
333 return(vcGetCh(c)); in vcGetChar()
336 char *vcGetString(vncConsolePtr c,char *buffer,int bufferSize) in vcGetString() argument
338 char *bufferBackup=c->inputBuffer; in vcGetString()
341 if(count>c->inputCount) in vcGetString()
342 count=c->inputCount; in vcGetString()
347 c->inputCount-=i; in vcGetString()
348 memmove(bufferBackup,bufferBackup+i+2,c->inputCount); in vcGetString()
351 memcpy(buffer,bufferBackup,c->inputCount); in vcGetString()
352 count=c->inputSize; in vcGetString()
353 c->inputSize=bufferSize; in vcGetString()
354 c->inputBuffer=buffer; in vcGetString()
355 while(rfbIsActive(c->screen) in vcGetString()
356 && c->inputCount<bufferSize-1 && buffer[c->inputCount-1]!='\n') in vcGetString()
357 vcProcessEvents(c); in vcGetString()
358 buffer[c->inputCount]=0; in vcGetString()
359 c->inputBuffer=bufferBackup; in vcGetString()
360 c->inputSize=count; in vcGetString()
361 c->inputCount=0; in vcGetString()
367 vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; in vcKbdAddEventProc() local
369 if(c->inputCount<c->inputSize) { in vcKbdAddEventProc()
378 if(c->inputCount>0) in vcKbdAddEventProc()
379 c->inputCount--; in vcKbdAddEventProc()
381 c->inputBuffer[c->inputCount++]=(char)keySym; in vcKbdAddEventProc()
382 if(c->doEcho) in vcKbdAddEventProc()
383 vcPutChar(c,(unsigned char)keySym); in vcKbdAddEventProc()
391 vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; in vcPtrAddEventProc() local
393 if(c->wasRightButtonDown) { in vcPtrAddEventProc()
395 if(c->selection) { in vcPtrAddEventProc()
397 for(s=c->selection;*s;s++) { in vcPtrAddEventProc()
398 c->screen->kbdAddEvent(1,*s,cl); in vcPtrAddEventProc()
399 c->screen->kbdAddEvent(0,*s,cl); in vcPtrAddEventProc()
402 c->wasRightButtonDown=0; in vcPtrAddEventProc()
405 c->wasRightButtonDown=1; in vcPtrAddEventProc()
408 int cx=x/c->cWidth,cy=y/c->cHeight,pos; in vcPtrAddEventProc()
409 if(cx<0) cx=0; else if(cx>=c->width) cx=c->width-1; in vcPtrAddEventProc()
410 if(cy<0) cy=0; else if(cy>=c->height) cy=c->height-1; in vcPtrAddEventProc()
411 pos=cy*c->width+cx; in vcPtrAddEventProc()
414 if(!c->currentlyMarking) { in vcPtrAddEventProc()
415 c->currentlyMarking=TRUE; in vcPtrAddEventProc()
416 c->markStart=pos; in vcPtrAddEventProc()
417 c->markEnd=pos; in vcPtrAddEventProc()
418 vcToggleMarkCell(c,pos); in vcPtrAddEventProc()
421 c->markStart,c->markEnd,pos)); in vcPtrAddEventProc()
422 if(c->markEnd!=pos) { in vcPtrAddEventProc()
423 if(c->markEnd<pos) { in vcPtrAddEventProc()
424 cx=c->markEnd; cy=pos; in vcPtrAddEventProc()
426 cx=pos; cy=c->markEnd; in vcPtrAddEventProc()
428 if(cx<c->markStart) { in vcPtrAddEventProc()
429 if(cy<c->markStart) in vcPtrAddEventProc()
434 vcToggleMarkCell(c,cx); in vcPtrAddEventProc()
437 c->markEnd=pos; in vcPtrAddEventProc()
440 } else if(c->currentlyMarking) { in vcPtrAddEventProc()
442 if(c->markStart<c->markEnd) { in vcPtrAddEventProc()
443 i=c->markStart; j=c->markEnd+1; in vcPtrAddEventProc()
445 i=c->markEnd; j=c->markStart; in vcPtrAddEventProc()
447 if(c->selection) free(c->selection); in vcPtrAddEventProc()
448 c->selection=(char*)malloc(j-i+1); in vcPtrAddEventProc()
449 memcpy(c->selection,c->screenBuffer+i,j-i); in vcPtrAddEventProc()
450 c->selection[j-i]=0; in vcPtrAddEventProc()
451 vcUnmark(c); in vcPtrAddEventProc()
452 rfbGotXCutText(c->screen,c->selection,j-i); in vcPtrAddEventProc()
459 vncConsolePtr c=(vncConsolePtr)cl->screen->screenData; in vcSetXCutTextProc() local
461 if(c->selection) free(c->selection); in vcSetXCutTextProc()
462 c->selection=(char*)malloc(len+1); in vcSetXCutTextProc()
463 memcpy(c->selection,str,len); in vcSetXCutTextProc()
464 c->selection[len]=0; in vcSetXCutTextProc()
467 void vcToggleMarkCell(vncConsolePtr c,int pos) in vcToggleMarkCell() argument
469 int x=(pos%c->width)*c->cWidth, in vcToggleMarkCell()
470 y=(pos/c->width)*c->cHeight; in vcToggleMarkCell()
472 rfbScreenInfoPtr s=c->screen; in vcToggleMarkCell()
474 for(j=0;j<c->cHeight;j++) in vcToggleMarkCell()
475 for(i=0;i<c->cWidth;i++) in vcToggleMarkCell()
477 rfbMarkRectAsModified(c->screen,x,y,x+c->cWidth,y+c->cHeight); in vcToggleMarkCell()
480 void vcUnmark(vncConsolePtr c) in vcUnmark() argument
483 c->currentlyMarking=FALSE; in vcUnmark()
484 if(c->markStart<c->markEnd) { in vcUnmark()
485 i=c->markStart; j=c->markEnd+1; in vcUnmark()
487 i=c->markEnd; j=c->markStart; in vcUnmark()
490 vcToggleMarkCell(c,i); in vcUnmark()
493 void vcProcessEvents(vncConsolePtr c) in vcProcessEvents() argument
495 rfbProcessEvents(c->screen,c->selectTimeOut); in vcProcessEvents()