static void selPaintButtons(rfbSelectData* m,Bool invertOk,Bool invertCancel) { rfbScreenInfoPtr s = m->screen; Pixel bcolour = m->backColour; Pixel colour = m->colour; rfbFillRect(s,m->x1,m->okY-m->textH,m->x2,m->okY,bcolour); if(invertOk) { rfbFillRect(s,m->okBX,m->okY-m->textH,m->okBX+m->buttonWidth,m->okY,colour); rfbDrawStringWithClip(s,m->font,m->okX+m->xhot,m->okY-1+m->yhot,okStr, m->x1,m->okY-m->textH,m->x2,m->okY, bcolour,colour); } else rfbDrawString(s,m->font,m->okX+m->xhot,m->okY-1+m->yhot,okStr,colour); if(invertCancel) { rfbFillRect(s,m->cancelBX,m->okY-m->textH, m->cancelBX+m->buttonWidth,m->okY,colour); rfbDrawStringWithClip(s,m->font,m->cancelX+m->xhot,m->okY-1+m->yhot, cancelStr,m->x1,m->okY-m->textH,m->x2,m->okY, bcolour,colour); } else rfbDrawString(s,m->font,m->cancelX+m->xhot,m->okY-1+m->yhot,cancelStr,colour); m->okInverted = invertOk; m->cancelInverted = invertCancel; }
int main(int argc,char** argv) { rfbScreenInfoPtr rfbScreen = rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp); rfbScreen->desktopName = "LibVNCServer Example"; rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp); rfbScreen->alwaysShared = TRUE; rfbScreen->ptrAddEvent = doptr; rfbScreen->kbdAddEvent = dokey; rfbScreen->newClientHook = newclient; rfbScreen->httpDir = "../classes"; rfbScreen->httpEnableProxyConnect = TRUE; initBuffer((unsigned char*)rfbScreen->frameBuffer); rfbDrawString(rfbScreen,&radonFont,20,100,"Hello, World!",0xffffff); /* This call creates a mask and then a cursor: */ /* rfbScreen->defaultCursor = rfbMakeXCursor(exampleCursorWidth,exampleCursorHeight,exampleCursor,0); */ MakeRichCursor(rfbScreen); /* initialize the server */ rfbInitServer(rfbScreen); #ifndef BACKGROUND_LOOP_TEST #ifdef USE_OWN_LOOP { int i; for(i=0;rfbIsActive(rfbScreen);i++) { fprintf(stderr,"%d\r",i); rfbProcessEvents(rfbScreen,100000); } } #else /* this is the blocking event loop, i.e. it never returns */ /* 40000 are the microseconds to wait on select(), i.e. 0.04 seconds */ rfbRunEventLoop(rfbScreen,40000,FALSE); #endif /* OWN LOOP */ #else #if !defined(LIBVNCSERVER_HAVE_LIBPTHREAD) #error "I need pthreads for that." #endif /* this is the non-blocking event loop; a background thread is started */ rfbRunEventLoop(rfbScreen,-1,TRUE); /* now we could do some cool things like rendering in idle time */ while(1) sleep(5); /* render(); */ #endif /* BACKGROUND_LOOP */ free(rfbScreen->frameBuffer); rfbScreenCleanup(rfbScreen); return(0); }
static void output(rfbScreenInfoPtr s,char* line) { rfbDoCopyRect(s,0,0,width,height-lineHeight,0,-lineHeight); rfbDrawString(s,&default8x16Font,10,lineY,line,0x01); rfbLog("%s\n",line); }
void output(rfbScreenInfoPtr s,char* line) { rfbDoCopyRect(s,0,0,640,480-lineHeight,0,-lineHeight); rfbDrawString(s,&default8x16Font,10,lineY,line,0x01); fprintf(stderr,"%s\n",line); }