summaryrefslogtreecommitdiffstats
path: root/x11vnc/userinput.c
diff options
context:
space:
mode:
authorrunge <runge>2006-07-28 20:28:16 +0000
committerrunge <runge>2006-07-28 20:28:16 +0000
commit521f0338af52506e079a5075fbe9350904a67269 (patch)
tree42e67d78a1826f9c24520d52bcde91a9aaec2a2e /x11vnc/userinput.c
parent901729e3e04d13d0d7e701c6a6c014f4adc42ce6 (diff)
downloadlibtdevnc-521f0338.tar.gz
libtdevnc-521f0338.zip
x11vnc: -rotate option
Diffstat (limited to 'x11vnc/userinput.c')
-rw-r--r--x11vnc/userinput.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/x11vnc/userinput.c b/x11vnc/userinput.c
index 5405432..a0edb9a 100644
--- a/x11vnc/userinput.c
+++ b/x11vnc/userinput.c
@@ -1760,7 +1760,7 @@ static void do_copyregion(sraRegionPtr region, int dx, int dy) {
last_copyrect = dnow();
- if (rfb_fb == main_fb) {
+ if (rfb_fb == main_fb && ! rotating) {
/* normal case, no -scale or -8to24 */
get_client_regions(&req, &mod, &cpy, &ncli);
if (debug_scroll > 1) fprintf(stderr, "<<<-rfbDoCopyRect req: %d mod: %d cpy: %d\n", req, mod, cpy);
@@ -1777,7 +1777,7 @@ if (debug_scroll > 1) fprintf(stderr, ">>>-rfbDoCopyRect req: %d mod: %d cpy: %d
iter = sraRgnGetReverseIterator(region, dx < 0, dy < 0);
while(sraRgnIteratorNext(iter, &rect)) {
- int j, c;
+ int j, c, t;
x1 = rect.x1;
y1 = rect.y1;
@@ -1825,6 +1825,7 @@ if (debug_scroll > 1) fprintf(stderr, ">>>-rfbDoCopyRect req: %d mod: %d cpy: %d
}
}
+
if (scaling) {
sx1 = ((double) x1 / dpy_x) * scaled_x;
sy1 = ((double) y1 / dpy_y) * scaled_y;
@@ -1840,6 +1841,46 @@ if (debug_scroll > 1) fprintf(stderr, ">>>-rfbDoCopyRect req: %d mod: %d cpy: %d
sdx = dx;
sdy = dy;
}
+if (0) fprintf(stderr, "s... %d %d %d %d %d %d\n", sx1, sy1, sx2, sy2, sdx, sdy);
+ if (rotating) {
+ rotate_coords(sx1, sy1, &sx1, &sy1, -1, -1);
+ rotate_coords(sx2, sy2, &sx2, &sy2, -1, -1);
+ if (rotating == ROTATE_X) {
+ sdx = -sdx;
+ } else if (rotating == ROTATE_Y) {
+ sdy = -sdy;
+ } else if (rotating == ROTATE_XY) {
+ sdx = -sdx;
+ sdy = -sdy;
+ } else if (rotating == ROTATE_90) {
+ t = sdx;
+ sdx = -sdy;
+ sdy = t;
+ } else if (rotating == ROTATE_90X) {
+ t = sdx;
+ sdx = sdy;
+ sdy = t;
+ } else if (rotating == ROTATE_90Y) {
+ t = sdx;
+ sdx = -sdy;
+ sdy = -t;
+ } else if (rotating == ROTATE_270) {
+ t = sdx;
+ sdx = sdy;
+ sdy = -t;
+ }
+ }
+ if (sx2 < sx1) {
+ t = sx1;
+ sx1 = sx2;
+ sx2 = t;
+ }
+ if (sy2 < sy1) {
+ t = sy1;
+ sy1 = sy2;
+ sy2 = t;
+ }
+if (0) fprintf(stderr, "s... %d %d %d %d %d %d\n", sx1, sy1, sx2, sy2, sdx, sdy);
rfbDoCopyRect(screen, sx1, sy1, sx2, sy2, sdx, sdy);
}