LibVNCServer/LibVNCClient
SDLvncviewer.c
Go to the documentation of this file.
1 
6 #include <SDL.h>
7 #include <signal.h>
8 #include <rfb/rfbclient.h>
9 
10 struct { int sdl; int rfb; } buttonMapping[]={
11  {1, rfbButton1Mask},
12  {2, rfbButton2Mask},
13  {3, rfbButton3Mask},
14  {4, rfbButton4Mask},
15  {5, rfbButton5Mask},
16  {0,0}
17 };
18 
19 struct { char mask; int bits_stored; } utf8Mapping[]= {
20  {0b00111111, 6},
21  {0b01111111, 7},
22  {0b00011111, 5},
23  {0b00001111, 4},
24  {0b00000111, 3},
25  {0,0}
26 };
27 
28 static int enableResizable = 1, viewOnly, listenLoop, buttonMask;
30 SDL_Texture *sdlTexture;
31 SDL_Renderer *sdlRenderer;
32 SDL_Window *sdlWindow;
33 /* client's pointer position */
34 int x,y;
35 
36 static int rightAltKeyDown, leftAltKeyDown;
37 
38 static rfbBool resize(rfbClient* client) {
39  int width=client->width,height=client->height,
40  depth=client->format.bitsPerPixel;
41 
42  if (enableResizable)
43  sdlFlags |= SDL_WINDOW_RESIZABLE;
44 
45  client->updateRect.x = client->updateRect.y = 0;
46  client->updateRect.w = width; client->updateRect.h = height;
47 
48  /* (re)create the surface used as the client's framebuffer */
49  SDL_FreeSurface(rfbClientGetClientData(client, SDL_Init));
50  SDL_Surface* sdl=SDL_CreateRGBSurface(0,
51  width,
52  height,
53  depth,
54  0,0,0,0);
55  if(!sdl)
56  rfbClientErr("resize: error creating surface: %s\n", SDL_GetError());
57 
58  rfbClientSetClientData(client, SDL_Init, sdl);
59  client->width = sdl->pitch / (depth / 8);
60  client->frameBuffer=sdl->pixels;
61 
62  client->format.bitsPerPixel=depth;
63  client->format.redShift=sdl->format->Rshift;
64  client->format.greenShift=sdl->format->Gshift;
65  client->format.blueShift=sdl->format->Bshift;
66  client->format.redMax=sdl->format->Rmask>>client->format.redShift;
67  client->format.greenMax=sdl->format->Gmask>>client->format.greenShift;
68  client->format.blueMax=sdl->format->Bmask>>client->format.blueShift;
69  SetFormatAndEncodings(client);
70 
71  /* create or resize the window */
72  if(!sdlWindow) {
73  sdlWindow = SDL_CreateWindow(client->desktopName,
74  SDL_WINDOWPOS_UNDEFINED,
75  SDL_WINDOWPOS_UNDEFINED,
76  width,
77  height,
78  sdlFlags);
79  if(!sdlWindow)
80  rfbClientErr("resize: error creating window: %s\n", SDL_GetError());
81  } else {
82  SDL_SetWindowSize(sdlWindow, width, height);
83  }
84 
85  /* create the renderer if it does not already exist */
86  if(!sdlRenderer) {
87  sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
88  if(!sdlRenderer)
89  rfbClientErr("resize: error creating renderer: %s\n", SDL_GetError());
90  SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); /* make the scaled rendering look smoother. */
91  }
92  SDL_RenderSetLogicalSize(sdlRenderer, width, height); /* this is a departure from the SDL1.2-based version, but more in the sense of a VNC viewer in keeeping aspect ratio */
93 
94  /* (re)create the texture that sits in between the surface->pixels and the renderer */
95  if(sdlTexture)
96  SDL_DestroyTexture(sdlTexture);
97  sdlTexture = SDL_CreateTexture(sdlRenderer,
98  SDL_PIXELFORMAT_ARGB8888,
99  SDL_TEXTUREACCESS_STREAMING,
100  width, height);
101  if(!sdlTexture)
102  rfbClientErr("resize: error creating texture: %s\n", SDL_GetError());
103  return TRUE;
104 }
105 
106 static rfbKeySym SDL_key2rfbKeySym(SDL_KeyboardEvent* e) {
107  rfbKeySym k = 0;
108  SDL_Keycode sym = e->keysym.sym;
109 
110  switch (sym) {
111  case SDLK_BACKSPACE: k = XK_BackSpace; break;
112  case SDLK_TAB: k = XK_Tab; break;
113  case SDLK_CLEAR: k = XK_Clear; break;
114  case SDLK_RETURN: k = XK_Return; break;
115  case SDLK_PAUSE: k = XK_Pause; break;
116  case SDLK_ESCAPE: k = XK_Escape; break;
117  case SDLK_DELETE: k = XK_Delete; break;
118  case SDLK_KP_0: k = XK_KP_0; break;
119  case SDLK_KP_1: k = XK_KP_1; break;
120  case SDLK_KP_2: k = XK_KP_2; break;
121  case SDLK_KP_3: k = XK_KP_3; break;
122  case SDLK_KP_4: k = XK_KP_4; break;
123  case SDLK_KP_5: k = XK_KP_5; break;
124  case SDLK_KP_6: k = XK_KP_6; break;
125  case SDLK_KP_7: k = XK_KP_7; break;
126  case SDLK_KP_8: k = XK_KP_8; break;
127  case SDLK_KP_9: k = XK_KP_9; break;
128  case SDLK_KP_PERIOD: k = XK_KP_Decimal; break;
129  case SDLK_KP_DIVIDE: k = XK_KP_Divide; break;
130  case SDLK_KP_MULTIPLY: k = XK_KP_Multiply; break;
131  case SDLK_KP_MINUS: k = XK_KP_Subtract; break;
132  case SDLK_KP_PLUS: k = XK_KP_Add; break;
133  case SDLK_KP_ENTER: k = XK_KP_Enter; break;
134  case SDLK_KP_EQUALS: k = XK_KP_Equal; break;
135  case SDLK_UP: k = XK_Up; break;
136  case SDLK_DOWN: k = XK_Down; break;
137  case SDLK_RIGHT: k = XK_Right; break;
138  case SDLK_LEFT: k = XK_Left; break;
139  case SDLK_INSERT: k = XK_Insert; break;
140  case SDLK_HOME: k = XK_Home; break;
141  case SDLK_END: k = XK_End; break;
142  case SDLK_PAGEUP: k = XK_Page_Up; break;
143  case SDLK_PAGEDOWN: k = XK_Page_Down; break;
144  case SDLK_F1: k = XK_F1; break;
145  case SDLK_F2: k = XK_F2; break;
146  case SDLK_F3: k = XK_F3; break;
147  case SDLK_F4: k = XK_F4; break;
148  case SDLK_F5: k = XK_F5; break;
149  case SDLK_F6: k = XK_F6; break;
150  case SDLK_F7: k = XK_F7; break;
151  case SDLK_F8: k = XK_F8; break;
152  case SDLK_F9: k = XK_F9; break;
153  case SDLK_F10: k = XK_F10; break;
154  case SDLK_F11: k = XK_F11; break;
155  case SDLK_F12: k = XK_F12; break;
156  case SDLK_F13: k = XK_F13; break;
157  case SDLK_F14: k = XK_F14; break;
158  case SDLK_F15: k = XK_F15; break;
159  case SDLK_NUMLOCKCLEAR: k = XK_Num_Lock; break;
160  case SDLK_CAPSLOCK: k = XK_Caps_Lock; break;
161  case SDLK_SCROLLLOCK: k = XK_Scroll_Lock; break;
162  case SDLK_RSHIFT: k = XK_Shift_R; break;
163  case SDLK_LSHIFT: k = XK_Shift_L; break;
164  case SDLK_RCTRL: k = XK_Control_R; break;
165  case SDLK_LCTRL: k = XK_Control_L; break;
166  case SDLK_RALT: k = XK_Alt_R; break;
167  case SDLK_LALT: k = XK_Alt_L; break;
168  case SDLK_LGUI: k = XK_Super_L; break;
169  case SDLK_RGUI: k = XK_Super_R; break;
170 #if 0
171  case SDLK_COMPOSE: k = XK_Compose; break;
172 #endif
173  case SDLK_MODE: k = XK_Mode_switch; break;
174  case SDLK_HELP: k = XK_Help; break;
175  case SDLK_PRINTSCREEN: k = XK_Print; break;
176  case SDLK_SYSREQ: k = XK_Sys_Req; break;
177  default: break;
178  }
179  /* SDL_TEXTINPUT does not generate characters if ctrl is down, so handle those here */
180  if (k == 0 && sym > 0x0 && sym < 0x100 && e->keysym.mod & KMOD_CTRL)
181  k = sym;
182 
183  return k;
184 }
185 
186 /* UTF-8 decoding is from https://rosettacode.org/wiki/UTF-8_encode_and_decode which is under GFDL 1.2 */
187 static rfbKeySym utf8char2rfbKeySym(const char chr[4]) {
188  int bytes = strlen(chr);
189  int shift = utf8Mapping[0].bits_stored * (bytes - 1);
190  rfbKeySym codep = (*chr++ & utf8Mapping[bytes].mask) << shift;
191  int i;
192  for(i = 1; i < bytes; ++i, ++chr) {
193  shift -= utf8Mapping[0].bits_stored;
194  codep |= ((char)*chr & utf8Mapping[0].mask) << shift;
195  }
196  return codep;
197 }
198 
199 static void update(rfbClient* cl,int x,int y,int w,int h) {
200  SDL_Surface *sdl = rfbClientGetClientData(cl, SDL_Init);
201  /* update texture from surface->pixels */
202  SDL_Rect r = {x,y,w,h};
203  if(SDL_UpdateTexture(sdlTexture, &r, sdl->pixels + y*sdl->pitch + x*4, sdl->pitch) < 0)
204  rfbClientErr("update: failed to update texture: %s\n", SDL_GetError());
205  /* copy texture to renderer and show */
206  if(SDL_RenderClear(sdlRenderer) < 0)
207  rfbClientErr("update: failed to clear renderer: %s\n", SDL_GetError());
208  if(SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL) < 0)
209  rfbClientErr("update: failed to copy texture to renderer: %s\n", SDL_GetError());
210  SDL_RenderPresent(sdlRenderer);
211 }
212 
213 static void kbd_leds(rfbClient* cl, int value, int pad) {
214  /* note: pad is for future expansion 0=unused */
215  fprintf(stderr,"Led State= 0x%02X\n", value);
216  fflush(stderr);
217 }
218 
219 /* trivial support for textchat */
220 static void text_chat(rfbClient* cl, int value, char *text) {
221  switch(value) {
222  case rfbTextChatOpen:
223  fprintf(stderr,"TextChat: We should open a textchat window!\n");
224  TextChatOpen(cl);
225  break;
226  case rfbTextChatClose:
227  fprintf(stderr,"TextChat: We should close our window!\n");
228  break;
229  case rfbTextChatFinished:
230  fprintf(stderr,"TextChat: We should close our window!\n");
231  break;
232  default:
233  fprintf(stderr,"TextChat: Received \"%s\"\n", text);
234  break;
235  }
236  fflush(stderr);
237 }
238 
239 #ifdef __MINGW32__
240 #define LOG_TO_FILE
241 #endif
242 
243 #ifdef LOG_TO_FILE
244 #include <stdarg.h>
245 static void
246 log_to_file(const char *format, ...)
247 {
248  FILE* logfile;
249  static char* logfile_str=0;
250  va_list args;
251  char buf[256];
252  time_t log_clock;
253 
255  return;
256 
257  if(logfile_str==0) {
258  logfile_str=getenv("VNCLOG");
259  if(logfile_str==0)
260  logfile_str="vnc.log";
261  }
262 
263  logfile=fopen(logfile_str,"a");
264 
265  va_start(args, format);
266 
267  time(&log_clock);
268  strftime(buf, 255, "%d/%m/%Y %X ", localtime(&log_clock));
269  fprintf(logfile,buf);
270 
271  vfprintf(logfile, format, args);
272  fflush(logfile);
273 
274  va_end(args);
275  fclose(logfile);
276 }
277 #endif
278 
279 
280 static void cleanup(rfbClient* cl)
281 {
282  /*
283  just in case we're running in listenLoop:
284  close viewer window by restarting SDL video subsystem
285  */
286  SDL_QuitSubSystem(SDL_INIT_VIDEO);
287  SDL_InitSubSystem(SDL_INIT_VIDEO);
288  if(cl)
289  rfbClientCleanup(cl);
290 }
291 
292 
293 static rfbBool handleSDLEvent(rfbClient *cl, SDL_Event *e)
294 {
295  switch(e->type) {
296  case SDL_WINDOWEVENT:
297  switch (e->window.event) {
298  case SDL_WINDOWEVENT_EXPOSED:
300  cl->width, cl->height, FALSE);
301  break;
302  case SDL_WINDOWEVENT_FOCUS_GAINED:
303  if (SDL_HasClipboardText()) {
304  char *text = SDL_GetClipboardText();
305  if(text) {
306  rfbClientLog("sending clipboard text '%s'\n", text);
307  SendClientCutText(cl, text, strlen(text));
308  }
309  }
310 
311  break;
312  case SDL_WINDOWEVENT_FOCUS_LOST:
313  if (rightAltKeyDown) {
315  rightAltKeyDown = FALSE;
316  rfbClientLog("released right Alt key\n");
317  }
318  if (leftAltKeyDown) {
320  leftAltKeyDown = FALSE;
321  rfbClientLog("released left Alt key\n");
322  }
323  break;
324  }
325  break;
326  case SDL_MOUSEWHEEL:
327  {
328  int steps;
329  if (viewOnly)
330  break;
331 
332  if(e->wheel.y > 0)
333  for(steps = 0; steps < e->wheel.y; ++steps) {
335  SendPointerEvent(cl, x, y, 0);
336  }
337  if(e->wheel.y < 0)
338  for(steps = 0; steps > e->wheel.y; --steps) {
340  SendPointerEvent(cl, x, y, 0);
341  }
342  if(e->wheel.x > 0)
343  for(steps = 0; steps < e->wheel.x; ++steps) {
344  SendPointerEvent(cl, x, y, 0b01000000);
345  SendPointerEvent(cl, x, y, 0);
346  }
347  if(e->wheel.x < 0)
348  for(steps = 0; steps > e->wheel.x; --steps) {
349  SendPointerEvent(cl, x, y, 0b00100000);
350  SendPointerEvent(cl, x, y, 0);
351  }
352  break;
353  }
354  case SDL_MOUSEBUTTONUP:
355  case SDL_MOUSEBUTTONDOWN:
356  case SDL_MOUSEMOTION:
357  {
358  int state, i;
359  if (viewOnly)
360  break;
361 
362  if (e->type == SDL_MOUSEMOTION) {
363  x = e->motion.x;
364  y = e->motion.y;
365  state = e->motion.state;
366  }
367  else {
368  x = e->button.x;
369  y = e->button.y;
370  state = e->button.button;
371  for (i = 0; buttonMapping[i].sdl; i++)
372  if (state == buttonMapping[i].sdl) {
373  state = buttonMapping[i].rfb;
374  if (e->type == SDL_MOUSEBUTTONDOWN)
375  buttonMask |= state;
376  else
377  buttonMask &= ~state;
378  break;
379  }
380  }
381  SendPointerEvent(cl, x, y, buttonMask);
382  buttonMask &= ~(rfbButton4Mask | rfbButton5Mask);
383  break;
384  }
385  case SDL_KEYUP:
386  case SDL_KEYDOWN:
387  if (viewOnly)
388  break;
389  SendKeyEvent(cl, SDL_key2rfbKeySym(&e->key),
390  e->type == SDL_KEYDOWN ? TRUE : FALSE);
391  if (e->key.keysym.sym == SDLK_RALT)
392  rightAltKeyDown = e->type == SDL_KEYDOWN;
393  if (e->key.keysym.sym == SDLK_LALT)
394  leftAltKeyDown = e->type == SDL_KEYDOWN;
395  break;
396  case SDL_TEXTINPUT:
397  if (viewOnly)
398  break;
399  rfbKeySym sym = utf8char2rfbKeySym(e->text.text);
400  SendKeyEvent(cl, sym, TRUE);
401  SendKeyEvent(cl, sym, FALSE);
402  break;
403  case SDL_QUIT:
404  if(listenLoop)
405  {
406  cleanup(cl);
407  return FALSE;
408  }
409  else
410  {
411  rfbClientCleanup(cl);
412  exit(0);
413  }
414  default:
415  rfbClientLog("ignore SDL event: 0x%x\n", e->type);
416  }
417  return TRUE;
418 }
419 
420 static void got_selection(rfbClient *cl, const char *text, int len)
421 {
422  rfbClientLog("received clipboard text '%s'\n", text);
423  if(SDL_SetClipboardText(text) != 0)
424  rfbClientErr("could not set received clipboard text: %s\n", SDL_GetError());
425 }
426 
427 
428 static rfbCredential* get_credential(rfbClient* cl, int credentialType){
429  rfbCredential *c = malloc(sizeof(rfbCredential));
430  c->userCredential.username = malloc(RFB_BUF_SIZE);
431  c->userCredential.password = malloc(RFB_BUF_SIZE);
432 
433  if(credentialType != rfbCredentialTypeUser) {
434  rfbClientErr("something else than username and password required for authentication\n");
435  return NULL;
436  }
437 
438  rfbClientLog("username and password required for authentication!\n");
439  printf("user: ");
440  fgets(c->userCredential.username, RFB_BUF_SIZE, stdin);
441  printf("pass: ");
442  fgets(c->userCredential.password, RFB_BUF_SIZE, stdin);
443 
444  /* remove trailing newlines */
445  c->userCredential.username[strcspn(c->userCredential.username, "\n")] = 0;
446  c->userCredential.password[strcspn(c->userCredential.password, "\n")] = 0;
447 
448  return c;
449 }
450 
451 
452 #ifdef mac
453 #define main SDLmain
454 #endif
455 
456 int main(int argc,char** argv) {
457  rfbClient* cl;
458  int i, j;
459  SDL_Event e;
460 
461 #ifdef LOG_TO_FILE
462  rfbClientLog=rfbClientErr=log_to_file;
463 #endif
464 
465  for (i = 1, j = 1; i < argc; i++)
466  if (!strcmp(argv[i], "-viewonly"))
467  viewOnly = 1;
468  else if (!strcmp(argv[i], "-resizable"))
469  enableResizable = 1;
470  else if (!strcmp(argv[i], "-no-resizable"))
471  enableResizable = 0;
472  else if (!strcmp(argv[i], "-listen")) {
473  listenLoop = 1;
474  argv[i] = "-listennofork";
475  ++j;
476  }
477  else {
478  if (i != j)
479  argv[j] = argv[i];
480  j++;
481  }
482  argc = j;
483 
484  SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
485  atexit(SDL_Quit);
486  signal(SIGINT, exit);
487 
488  do {
489  /* 16-bit: cl=rfbGetClient(5,3,2); */
490  cl=rfbGetClient(8,3,4);
491  cl->MallocFrameBuffer=resize;
492  cl->canHandleNewFBSize = TRUE;
493  cl->GotFrameBufferUpdate=update;
494  cl->HandleKeyboardLedState=kbd_leds;
495  cl->HandleTextChat=text_chat;
496  cl->GotXCutText = got_selection;
497  cl->GetCredential = get_credential;
500  if(!rfbInitClient(cl,&argc,argv))
501  {
502  cl = NULL; /* rfbInitClient has already freed the client struct */
503  cleanup(cl);
504  break;
505  }
506 
507  while(1) {
508  if(SDL_PollEvent(&e)) {
509  /*
510  handleSDLEvent() return 0 if user requested window close.
511  In this case, handleSDLEvent() will have called cleanup().
512  */
513  if(!handleSDLEvent(cl, &e))
514  break;
515  }
516  else {
517  i=WaitForMessage(cl,500);
518  if(i<0)
519  {
520  cleanup(cl);
521  break;
522  }
523  if(i)
524  if(!HandleRFBServerMessage(cl))
525  {
526  cleanup(cl);
527  break;
528  }
529  }
530  }
531  }
532  while(listenLoop);
533 
534  return 0;
535 }
536 
#define XK_Left
Definition: keysym.h:170
int x
Definition: SDLvncviewer.c:34
int listen6Port
Definition: rfbclient.h:414
int rfb
Definition: SDLvncviewer.c:10
#define XK_Page_Down
Definition: keysym.h:177
#define XK_Num_Lock
Definition: keysym.h:197
#define XK_KP_Equal
Definition: keysym.h:221
int bits_stored
Definition: SDLvncviewer.c:19
rfbClient * client
Definition: vnc2mpg.c:357
#define XK_Down
Definition: keysym.h:173
#define TRUE
Definition: rfbproto.h:112
SDL_Texture * sdlTexture
Definition: SDLvncviewer.c:30
char * password
Definition: rfbclient.h:157
#define XK_KP_Add
Definition: keysym.h:223
uint16_t redMax
Definition: rfbproto.h:173
#define XK_KP_2
Definition: keysym.h:231
#define XK_F15
Definition: keysym.h:267
int sdlFlags
Definition: SDLvncviewer.c:29
#define XK_KP_5
Definition: keysym.h:234
int8_t rfbBool
Definition: rfbproto.h:108
#define XK_Shift_R
Definition: keysym.h:313
#define rfbTextChatFinished
Definition: rfbproto.h:1103
#define XK_F7
Definition: keysym.h:255
char mask
Definition: SDLvncviewer.c:19
#define LISTEN_PORT_OFFSET
Definition: rfbclient.h:84
#define rfbButton4Mask
Definition: rfbproto.h:1409
#define XK_Page_Up
Definition: keysym.h:175
GetCredentialProc GetCredential
To support security types that requires user input (except VNC password authentication), for example VeNCrypt and MSLogon, this callback function must be set before the authentication.
Definition: rfbclient.h:389
#define XK_Control_L
Definition: keysym.h:314
#define XK_KP_Decimal
Definition: keysym.h:226
#define XK_Escape
Definition: keysym.h:131
#define XK_End
Definition: keysym.h:178
#define height
Definition: vncev.c:19
#define XK_F9
Definition: keysym.h:257
uint8_t blueShift
Definition: rfbproto.h:195
#define XK_Print
Definition: keysym.h:185
uint8_t greenShift
Definition: rfbproto.h:193
#define XK_F5
Definition: keysym.h:253
uint32_t rfbKeySym
Definition: rfbproto.h:115
char * username
Definition: rfbclient.h:156
#define XK_KP_Multiply
Definition: keysym.h:222
#define XK_Caps_Lock
Definition: keysym.h:316
rfbClientLogProc rfbClientLog
Definition: rfbproto.c:98
#define XK_F4
Definition: keysym.h:252
rfbBool SendClientCutText(rfbClient *client, char *str, int len)
Places a string on the server&#39;s clipboard.
Definition: rfbproto.c:1594
#define RFB_BUF_SIZE
Definition: rfbclient.h:277
rfbBool SendPointerEvent(rfbClient *client, int x, int y, int buttonMask)
Sends a pointer event to the server.
Definition: rfbproto.c:1553
#define XK_F10
Definition: keysym.h:258
#define XK_Super_R
Definition: keysym.h:324
#define XK_F6
Definition: keysym.h:254
#define XK_Scroll_Lock
Definition: keysym.h:129
int height
Definition: rfbclient.h:243
#define XK_F12
Definition: keysym.h:261
#define XK_Alt_R
Definition: keysym.h:322
#define rfbButton2Mask
Definition: rfbproto.h:1407
#define XK_KP_Divide
Definition: keysym.h:227
char * desktopName
Definition: rfbclient.h:272
#define XK_F2
Definition: keysym.h:250
int width
Definition: rfbclient.h:243
uint8_t bitsPerPixel
Definition: rfbproto.h:156
#define XK_KP_3
Definition: keysym.h:232
rfbBool rfbInitClient(rfbClient *client, int *argc, char **argv)
Initializes the client.
Definition: vncviewer.c:427
int main(int argc, char **argv)
Definition: SDLvncviewer.c:456
#define rfbTextChatClose
Definition: rfbproto.h:1102
int y
Definition: SDLvncviewer.c:34
#define XK_Control_R
Definition: keysym.h:315
struct rfbCredential::@3 userCredential
Plain (VeNCrypt), MSLogon (UltraVNC)
int WaitForMessage(rfbClient *client, unsigned int usecs)
Waits for an RFB message to arrive from the server.
Definition: sockets.c:898
#define XK_Shift_L
Definition: keysym.h:312
#define XK_F14
Definition: keysym.h:265
#define XK_Delete
Definition: keysym.h:132
#define XK_F1
Definition: keysym.h:249
#define XK_KP_Enter
Definition: keysym.h:203
rfbBool rfbEnableClientLogging
Definition: rfbproto.c:74
void rfbClientCleanup(rfbClient *client)
Cleans up the client structure and releases the memory allocated for it.
Definition: vncviewer.c:508
#define XK_KP_9
Definition: keysym.h:238
#define XK_Pause
Definition: keysym.h:128
#define XK_Super_L
Definition: keysym.h:323
int listenPort
Definition: rfbclient.h:253
rfbClient * rfbGetClient(int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
Allocates and returns a pointer to an rfbClient structure.
Definition: vncviewer.c:250
#define XK_KP_4
Definition: keysym.h:233
#define XK_Alt_L
Definition: keysym.h:321
struct @12 utf8Mapping[]
rfbPixelFormat format
Definition: rfbclient.h:273
uint8_t redShift
Definition: rfbproto.h:181
For GetCredentialProc callback function to return.
Definition: rfbclient.h:142
struct rfbClient::@4 updateRect
#define XK_Insert
Definition: keysym.h:187
SDL_Renderer * sdlRenderer
Definition: SDLvncviewer.c:31
#define XK_Home
Definition: keysym.h:169
rfbBool SendKeyEvent(rfbClient *client, uint32_t key, rfbBool down)
Sends a key event to the server.
Definition: rfbproto.c:1575
#define XK_KP_8
Definition: keysym.h:237
MallocFrameBufferProc MallocFrameBuffer
Definition: rfbclient.h:357
void * rfbClientGetClientData(rfbClient *client, void *tag)
Returns a pointer to the client data associated with the given tag.
Definition: rfbproto.c:130
rfbBool SetFormatAndEncodings(rfbClient *client)
Sends format and encoding parameters to the server.
Definition: rfbproto.c:1157
HandleTextChatProc HandleTextChat
Definition: rfbclient.h:349
#define XK_Clear
Definition: keysym.h:126
#define XK_KP_6
Definition: keysym.h:235
uint16_t blueMax
Definition: rfbproto.h:179
#define XK_F8
Definition: keysym.h:256
#define XK_KP_7
Definition: keysym.h:236
uint16_t greenMax
Definition: rfbproto.h:177
#define rfbButton1Mask
Definition: rfbproto.h:1406
#define rfbButton3Mask
Definition: rfbproto.h:1408
GotFrameBufferUpdateProc GotFrameBufferUpdate
Definition: rfbclient.h:354
#define XK_KP_Subtract
Definition: keysym.h:225
uint8_t * frameBuffer
Definition: rfbclient.h:242
struct @11 buttonMapping[]
#define XK_Up
Definition: keysym.h:171
#define XK_F13
Definition: keysym.h:263
#define FALSE
Definition: rfbproto.h:110
int sdl
Definition: SDLvncviewer.c:10
#define rfbButton5Mask
Definition: rfbproto.h:1410
#define XK_Tab
Definition: keysym.h:124
SDL_Window * sdlWindow
Definition: SDLvncviewer.c:32
#define width
Definition: vncev.c:18
#define XK_Mode_switch
Definition: keysym.h:195
int canHandleNewFBSize
Definition: rfbclient.h:346
#define XK_Sys_Req
Definition: keysym.h:130
rfbBool HandleRFBServerMessage(rfbClient *client)
Handles messages from the RFB server.
Definition: rfbproto.c:1614
#define XK_F11
Definition: keysym.h:259
GotXCutTextProc GotXCutText
Definition: rfbclient.h:358
rfbBool TextChatOpen(rfbClient *client)
Opens a text chat window on the server.
Definition: rfbproto.c:1465
#define XK_F3
Definition: keysym.h:251
#define rfbTextChatOpen
Definition: rfbproto.h:1101
rfbClientLogProc rfbClientErr
Definition: rfbproto.c:99
#define XK_KP_0
Definition: keysym.h:229
void rfbClientSetClientData(rfbClient *client, void *tag, void *data)
Associates a client data tag with the given pointer.
Definition: rfbproto.c:113
#define XK_Return
Definition: keysym.h:127
#define XK_Help
Definition: keysym.h:193
rfbBool SendFramebufferUpdateRequest(rfbClient *client, int x, int y, int w, int h, rfbBool incremental)
Sends a framebuffer update request to the server.
Definition: rfbproto.c:1390
#define XK_BackSpace
Definition: keysym.h:123
#define rfbCredentialTypeUser
Definition: rfbclient.h:162
#define XK_Right
Definition: keysym.h:172
HandleKeyboardLedStateProc HandleKeyboardLedState
Definition: rfbclient.h:350
#define XK_KP_1
Definition: keysym.h:230