Home | History | Annotate | Download | only in examples
      1 #include <stdio.h>
      2 #include <rfb/rfb.h>
      3 #include <rfb/keysym.h>
      4 
      5 #define CONCAT2(a,b) a##b
      6 #define CONCAT2E(a,b) CONCAT2(a,b)
      7 #define CONCAT3(a,b,c) a##b##c
      8 #define CONCAT3E(a,b,c) CONCAT3(a,b,c)
      9 
     10 #define FUNCNAME rfbRotate
     11 #define FUNC(i, j) (h - 1 - j + i * h)
     12 #define SWAPDIMENSIONS
     13 #define OUTBITS 8
     14 #include "rotatetemplate.c"
     15 #define OUTBITS 16
     16 #include "rotatetemplate.c"
     17 #define OUTBITS 32
     18 #include "rotatetemplate.c"
     19 #undef FUNCNAME
     20 #undef FUNC
     21 
     22 #define FUNCNAME rfbRotateCounterClockwise
     23 #define FUNC(i, j) (j + (w - 1 - i) * h)
     24 #define OUTBITS 8
     25 #include "rotatetemplate.c"
     26 #define OUTBITS 16
     27 #include "rotatetemplate.c"
     28 #define OUTBITS 32
     29 #include "rotatetemplate.c"
     30 #undef FUNCNAME
     31 #undef FUNC
     32 #undef SWAPDIMENSIONS
     33 
     34 #define FUNCNAME rfbFlipHorizontally
     35 #define FUNC(i, j) ((w - 1 - i) + j * w)
     36 #define OUTBITS 8
     37 #include "rotatetemplate.c"
     38 #define OUTBITS 16
     39 #include "rotatetemplate.c"
     40 #define OUTBITS 32
     41 #include "rotatetemplate.c"
     42 #undef FUNCNAME
     43 #undef FUNC
     44 
     45 #define FUNCNAME rfbFlipVertically
     46 #define FUNC(i, j) (i + (h - 1 - j) * w)
     47 #define OUTBITS 8
     48 #include "rotatetemplate.c"
     49 #define OUTBITS 16
     50 #include "rotatetemplate.c"
     51 #define OUTBITS 32
     52 #include "rotatetemplate.c"
     53 #undef FUNCNAME
     54 #undef FUNC
     55 
     56 #define FUNCNAME rfbRotateHundredAndEighty
     57 #define FUNC(i, j) ((w - 1 - i) + (h - 1 - j) * w)
     58 #define OUTBITS 8
     59 #include "rotatetemplate.c"
     60 #define OUTBITS 16
     61 #include "rotatetemplate.c"
     62 #define OUTBITS 32
     63 #include "rotatetemplate.c"
     64 #undef FUNCNAME
     65 #undef FUNC
     66 
     67 static void HandleKey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
     68 {
     69 	if(down) {
     70 		if (key==XK_Escape || key=='q' || key=='Q')
     71 			rfbCloseClient(cl);
     72 		else if (key == 'r')
     73 			rfbRotate(cl->screen);
     74 		else if (key == 'R')
     75 			rfbRotateCounterClockwise(cl->screen);
     76 		else if (key == 'f')
     77 			rfbFlipHorizontally(cl->screen);
     78 		else if (key == 'F')
     79 			rfbFlipVertically(cl->screen);
     80 	}
     81 }
     82 
     83 #define HAVE_HANDLEKEY
     84 #include "pnmshow.c"
     85 
     86