x11vnc: -rotate option

pull/1/head
runge 19 years ago
parent 901729e3e0
commit 521f0338af

@ -30,9 +30,19 @@
# to reach the VNC server (e.g. your firewall requires a proxy).
# For the "double proxy" case use -proxy host1:port1,host2:port2
#
# A couple other args (not related to certs):
#
# -alpha turn on cursor alphablending hack if you are using the
# enhanced tightvnc vncviewer.
#
# -grab turn on XGrabServer hack if you are using the enhanced tightvnc
# vncviewer (e.g. for fullscreen mode in some windowmanagers like
# fvwm that do not otherwise work in fullscreen mode)
#
#
# set VNCVIEWERCMD to whatever vncviewer command you want to use:
#
VNCIPCMD=${VNCVIEWERCMD:-vncip}
VNCVIEWERCMD=${VNCVIEWERCMD:-vncviewer}
#
# Same for STUNNEL, e.g. /path/to/stunnel or stunnel4, etc.
@ -53,6 +63,8 @@ help() {
head -39 $0 | tail +2
}
gotalpha=""
# grab our cmdline options:
while [ "X$1" != "X" ]
do
@ -63,6 +75,10 @@ do
;;
"-proxy") shift; proxy="$1"
;;
"-alpha") gotalpha=1
;;
"-grab") VNCVIEWER_GRAB_SERVER=1; export VNCVIEWER_GRAB_SERVER
;;
"-h"*) help; exit 0
;;
*) break
@ -71,16 +87,26 @@ do
shift
done
if [ "X$gotalpha" != "X1" ]; then
NO_ALPHABLEND=1
export NO_ALPHABLEND
fi
orig="$1"
shift
# play around with host:display port:
if ! echo "$orig" | grep ':' > /dev/null; then
if echo "$orig" | grep ':' > /dev/null; then
:
else
orig="$orig:0"
fi
host=`echo "$orig" | awk -F: '{print $1}'`
disp=`echo "$orig" | awk -F: '{print $2}'`
if [ "X$host" = "X" ]; then
host=localhost
fi
if [ $disp -lt 200 ]; then
port=`expr $disp + 5900`
else
@ -99,7 +125,9 @@ if [ "x$inuse" != "x" ]; then
try=5920
while [ $try -lt 6000 ]
do
if ! echo "$inuse" | grep -w $try > /dev/null; then
if echo "$inuse" | grep -w $try > /dev/null; then
:
else
use=$try
break
fi
@ -305,7 +333,7 @@ fi
if echo "$0" | grep vncip > /dev/null; then
# hack for runge's special wrapper script vncip.
vncip "$@" localhost:$n
$VNCIPCMD "$@" localhost:$n
else
$VNCVIEWERCMD "$@" localhost:$n
fi

@ -1,3 +1,7 @@
2006-07-28 Karl Runge <runge@karlrunge.com>
* ssl_vncviewer: remove some bashisms.
* x11vnc: -rotate option (e.g. handheld), fix FPE on tru64.
2006-07-17 Karl Runge <runge@karlrunge.com>
* x11vnc: enable --without-x builds for -rawfb only (NO_X11)

File diff suppressed because it is too large Load Diff

@ -82,6 +82,19 @@ static void curs_copy(cursor_info_t *dest, cursor_info_t *src) {
dest->sy = src->sy;
dest->reverse = src->reverse;
dest->rfb = src->rfb;
if (rotating && rotating_cursors && dest->data != NULL) {
int tx, ty;
rotate_curs(dest->data, src->data, src->wx, src->wy, 1);
rotate_curs(dest->mask, src->mask, src->wx, src->wy, 1);
rotate_coords(dest->sx, dest->sy, &tx, &ty, src->wx, src->wy);
dest->sx = tx;
dest->sy = ty;
if (! rotating_same) {
dest->wx = src->wy;
dest->wy = src->wx;
}
}
}
/* empty cursor */
@ -1317,6 +1330,27 @@ static int get_xfixes_cursor(int init) {
cursors[use]->rfb = NULL;
}
if (rotating && rotating_cursors) {
char *dst;
int tx, ty;
int w = xfc->width;
int h = xfc->height;
dst = (char *) malloc(w * h * 4);
rotate_curs(dst, (char *) xfc->pixels, w, h, 4);
memcpy(xfc->pixels, dst, w * h * 4);
free(dst);
rotate_coords(xfc->xhot, xfc->yhot, &tx, &ty, w, h);
xfc->xhot = tx;
xfc->yhot = ty;
if (! rotating_same) {
xfc->width = h;
xfc->height = w;
}
}
/* place cursor into our collection */
cursors[use]->rfb = pixels2curs(xfc->pixels, xfc->width,
xfc->height, xfc->xhot, xfc->yhot, bpp/8);

@ -326,7 +326,7 @@ void print_help(int mode) {
" to the program location and in standard locations\n"
" (/usr/local/share/x11vnc/classes, etc). Under -ssl or\n"
" -stunnel the ssl classes subdirectory is sought.\n"
#ifndef REL8x
#ifndef NO_SSL_OR_UNIXPW
"-http_ssl As -http, but force lookup for ssl classes subdir.\n"
#endif
"\n"
@ -458,7 +458,7 @@ void print_help(int mode) {
" and last line be \"__BEGIN_VIEWONLY__\" to have 2\n"
" full-access passwords)\n"
"\n"
#ifndef REL8x
#ifndef NO_SSL_OR_UNIXPW
"-unixpw [list] Use Unix username and password authentication. x11vnc\n"
" uses the su(1) program to verify the user's password.\n"
" [list] is an optional comma separated list of allowed\n"
@ -615,7 +615,7 @@ void print_help(int mode) {
" of the form XAUTHORITY=<file> or raw xauthority data for\n"
" the display (e.g. \"xauth extract - $DISPLAY\" output).\n"
"\n"
#ifndef REL8x
#ifndef NO_SSL_OR_UNIXPW
" In the case of -unixpw (but not -unixpw_nis), then the\n"
" above command is run as the user who just authenticated\n"
" via the login and password prompt.\n"
@ -624,8 +624,8 @@ void print_help(int mode) {
" can place a colon at the end of his username and\n"
" supply a few options: scale=, scale_cursor= (or sc=),\n"
" solid (or so), id=, clear_mods (or cm), clear_keys\n"
" (or ck), repeat, speeds= (or sp=), or readtimeout=\n"
" (or rd=) separated by commas if there is more than one.\n"
" (or ck), repeat, speeds= (or sp=), readtimeout=\n"
" (or rd=), or rotate= (or ro=) separated by commas if there is more than one.\n"
" After the user logs in successfully, these options will\n"
" be applied to the VNC screen. For example,\n"
"\n"
@ -682,7 +682,7 @@ void print_help(int mode) {
" the VNC client first attaches to since some VNC viewers\n"
" will not automatically adjust to a new framebuffer size.\n"
"\n"
#ifndef REL8x
#ifndef NO_SSL_OR_UNIXPW
"-ssl [pem] Use the openssl library (www.openssl.org) to provide a\n"
" built-in encrypted SSL tunnel between VNC viewers and\n"
" x11vnc. This requires libssl support to be compiled\n"
@ -1450,6 +1450,38 @@ void print_help(int mode) {
" encoding, and then resize the framebuffer. \"exit\"\n"
" means disconnect all viewer clients, and then terminate\n"
" x11vnc.\n"
"\n"
"-rotate string Rotate and/or flip the framebuffer view exported by VNC.\n"
" This transformation is independent of XRANDR and is\n"
" done in software in main memory and so may be slower.\n"
" This mode could be useful on a handheld with portrait or\n"
" landscape modes that do not correspond to the scanline\n"
" order of the actual framebuffer. \"string\" can be:\n"
"\n"
" x flip along x-axis\n"
" y flip along y-axis\n"
" xy flip along x- and y-axes\n"
" +90 rotate 90 degrees clockwise\n"
" -90 rotate 90 degrees counter-clockwise\n"
" +90x rotate 90 degrees CW, then flip along x\n"
" +90y rotate 90 degrees CW, then flip along y\n"
"\n"
" these give all possible rotations and reflections.\n"
"\n"
" Aliases: same as xy: yx, +180, -180, 180\n"
" same as -90: +270, 270\n"
" same as +90: 90, (ditto for 90x, 90y)\n"
"\n"
" Like -scale, this transformation is applied at the very\n"
" end of any chain of framebuffer transformations and so\n"
" any options with geometries, e.g. -blackout, -clip, etc.\n"
" are relative to the original X (or -rawfb) framebuffer,\n"
" not the final one sent to VNC viewers.\n"
"\n"
" If you do not want the cursor shape to be rotated\n"
" prefix \"string\" with \"nc:\", e.g. \"nc:+90\",\n"
" \"nc:xy\", etc.\n"
"\n"
"-padgeom WxH Whenever a new vncviewer connects, the framebuffer is\n"
" replaced with a fake, solid black one of geometry WxH.\n"
" Shortly afterwards the framebuffer is replaced with the\n"
@ -2565,7 +2597,7 @@ void print_help(int mode) {
"\n"
" If you do not want x11vnc to guess the framebuffer's\n"
" WxHxB and masks automatically (sometimes the kernel\n"
" given inaccurate information), specify them with a\n"
" gives inaccurate information), specify them with a\n"
" @WxHxB at the end of the string.\n"
"\n"
" Examples:\n"
@ -2923,6 +2955,7 @@ void print_help(int mode) {
" xrandr enable -xrandr mode. (if applicable)\n"
" noxrandr disable -xrandr mode.\n"
" xrandr_mode:mode set the -xrandr mode to \"mode\".\n"
" rotate:mode set the -rotate mode to \"mode\".\n"
" padgeom:WxH set -padgeom to WxH (empty to disable)\n"
" If WxH is \"force\" or \"do\" the padded\n"
" geometry fb is immediately applied.\n"
@ -3126,7 +3159,7 @@ void print_help(int mode) {
" listen lookup nolookup accept afteraccept gone shm\n"
" noshm flipbyteorder noflipbyteorder onetile noonetile\n"
" solid_color solid nosolid blackout xinerama noxinerama\n"
" xtrap noxtrap xrandr noxrandr xrandr_mode padgeom\n"
" xtrap noxtrap xrandr noxrandr xrandr_mode rotate padgeom\n"
" quiet q noquiet modtweak nomodtweak xkb noxkb capslock\n"
" nocapslock skip_lockkeys noskip_lockkeys skip_keycodes\n"
" sloppy_keys nosloppy_keys skip_dups noskip_dups\n"
@ -3149,9 +3182,9 @@ void print_help(int mode) {
" nograbkbd grabptr nograbptr client_input speeds wmdt\n"
" debug_pointer dp nodebug_pointer nodp debug_keyboard\n"
" dk nodebug_keyboard nodk deferupdate defer wait_ui\n"
" wait_bog nowait_bog slow_fb wait readtimeout nap\n"
" nonap sb screen_blank fbpm nofbpm fs gaps grow\n"
" fuzz snapfb nosnapfb rawfb uinput_accel uinput_reset\n"
" wait_bog nowait_bog slow_fb wait readtimeout nap nonap\n"
" sb screen_blank fbpm nofbpm fs gaps grow fuzz snapfb\n"
" nosnapfb rawfb uinput_accel uinput_thresh uinput_reset\n"
" uinput_always progressive rfbport http nohttp httpport\n"
" httpdir enablehttpproxy noenablehttpproxy alwaysshared\n"
" noalwaysshared nevershared noalwaysshared dontdisconnect\n"

@ -42,4 +42,13 @@
#define MAX_BUTTONS 5
#define ROTATE_NONE 0
#define ROTATE_X 1
#define ROTATE_Y 2
#define ROTATE_XY 3
#define ROTATE_90 4
#define ROTATE_90X 5
#define ROTATE_90Y 6
#define ROTATE_270 7
#endif /* _X11VNC_PARAMS_H */

@ -646,6 +646,10 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
return;
}
if (rotating) {
rotate_coords_inverse(x, y, &x, &y, -1, -1);
}
if (scaling) {
/* map from rfb size to X11 size: */
x = ((double) x / scaled_x) * dpy_x;

@ -536,7 +536,7 @@ if (db) fprintf(stderr, "dt3 calc: num rects req: %d/%d mod: %d/%d "
} else if (got_t3 == 2) {
dt3 = dts[1];
} else {
if (dts[2] >= 0.0) {
if (dts[2] > 0.0) {
double rat = dts[1]/dts[2];
if (rat > 0.5 && rat < 2.0) {
dt3 = dts[1]+dts[2];

@ -1897,6 +1897,20 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("remote_cmd: XRANDR ext. not present.\n");
}
} else if (strstr(p, "rotate") == p) {
COLON_CHECK("rotate:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%s", p, co,
NONUL(rotating_str));
goto qry;
}
p += strlen("rotate:");
if (rotating_str) free(rotating_str);
rotating_str = strdup(p);
rfbLog("remote_cmd: set rotate to \"%s\"\n", rotating_str);
do_new_fb(0);
} else if (strstr(p, "padgeom") == p) {
COLON_CHECK("padgeom:")
if (query) {
@ -4035,7 +4049,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
snprintf(buf, bufn, "aro=%s:%d", p, no_external_cmds);
} else if (!strcmp(p, "passwdfile")) {
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(passwdfile));
#ifndef REL8x
#ifndef NO_SSL_OR_UNIXPW
} else if (!strcmp(p, "unixpw")) {
snprintf(buf, bufn, "aro=%s:%d", p, unixpw);
} else if (!strcmp(p, "unixpw_nis")) {

@ -1181,9 +1181,78 @@ void scale_rect(double factor, int blend, int interpolate, int Bpp,
}
}
/*
Framebuffers data flow:
General case:
-------- -------- -------- --------
----- |8to24_fb| |main_fb | |snap_fb | | X |
|rfbfb| <== | | <== | | <== | | <== | Server |
----- -------- -------- -------- --------
(to vnc) (optional) (usu = rfbfb) (optional) (read only)
8to24_fb mode will create side fbs: poll24_fb and poll8_fb for
bookkeepping the different regions (merged into 8to24_fb).
Normal case:
-------- --------
|main_fb | | X |
|= rfb_fb| <== | Server |
-------- --------
Scaling case:
-------- --------
----- |main_fb | | X |
|rfbfb| <== | | <== | Server |
----- -------- --------
Webcam/video case:
-------- -------- --------
|main_fb | |snap_fb | | Video |
| | <== | | <== | device |
-------- -------- --------
If we ever do a -rr rotation/reflection tran, it probably should
be done after any scaling (need a rr_fb for intermediate results)
-rr option: transformation:
none x -> x;
y -> y;
x x -> w - x - 1;
y -> y;
y x -> x;
x -> h - y - 1;
xy x -> w - x - 1;
y -> h - y - 1;
+90 x -> h - y - 1;
y -> x;
+90x x -> y;
y -> x;
+90y x -> h - y - 1;
y -> w - x - 1;
-90 x -> y;
y -> w - x - 1;
some aliases:
xy: yx, +180, -180, 180
+90: 90
+90x: 90x
+90y: 90y
-90: +270, 270
*/
void scale_and_mark_rect(int X1, int Y1, int X2, int Y2) {
char *src_fb = main_fb;
int Bpp = bpp/8, fac = 1;
char *dst_fb, *src_fb = main_fb;
int dst_bpl, Bpp = bpp/8, fac = 1;
if (!screen || !rfb_fb || !main_fb) {
return;
@ -1213,10 +1282,309 @@ void scale_and_mark_rect(int X1, int Y1, int X2, int Y2) {
fac = 4;
}
}
dst_fb = rfb_fb;
dst_bpl = rfb_bytes_per_line;
scale_rect(scale_fac, scaling_blend, scaling_interpolate, fac * Bpp,
src_fb, fac * main_bytes_per_line, rfb_fb, rfb_bytes_per_line,
dpy_x, dpy_y, scaled_x, scaled_y, X1, Y1, X2, Y2, 1);
src_fb, fac * main_bytes_per_line, dst_fb, dst_bpl, dpy_x, dpy_y,
scaled_x, scaled_y, X1, Y1, X2, Y2, 1);
}
void rotate_coords(int x, int y, int *xo, int *yo, int dxi, int dyi) {
int xi = x, yi = y;
int Dx, Dy;
if (dxi >= 0) {
Dx = dxi;
Dy = dyi;
} else if (scaling) {
Dx = scaled_x;
Dy = scaled_y;
} else {
Dx = dpy_x;
Dy = dpy_y;
}
if (rotating == ROTATE_NONE) {
*xo = xi;
*yo = yi;
} else if (rotating == ROTATE_X) {
*xo = Dx - xi - 1;
*yo = yi;
} else if (rotating == ROTATE_Y) {
*xo = xi;
*yo = Dy - yi - 1;
} else if (rotating == ROTATE_XY) {
*xo = Dx - xi - 1;
*yo = Dy - yi - 1;
} else if (rotating == ROTATE_90) {
*xo = Dy - yi - 1;
*yo = xi;
} else if (rotating == ROTATE_90X) {
*xo = yi;
*yo = xi;
} else if (rotating == ROTATE_90Y) {
*xo = Dy - yi - 1;
*yo = Dx - xi - 1;
} else if (rotating == ROTATE_270) {
*xo = yi;
*yo = Dx - xi - 1;
}
}
void rotate_coords_inverse(int x, int y, int *xo, int *yo, int dxi, int dyi) {
int xi = x, yi = y;
int Dx, Dy;
if (dxi >= 0) {
Dx = dxi;
Dy = dyi;
} else if (scaling) {
Dx = scaled_x;
Dy = scaled_y;
} else {
Dx = dpy_x;
Dy = dpy_y;
}
if (! rotating_same) {
int t = Dx;
Dx = Dy;
Dy = t;
}
if (rotating == ROTATE_NONE) {
*xo = xi;
*yo = yi;
} else if (rotating == ROTATE_X) {
*xo = Dx - xi - 1;
*yo = yi;
} else if (rotating == ROTATE_Y) {
*xo = xi;
*yo = Dy - yi - 1;
} else if (rotating == ROTATE_XY) {
*xo = Dx - xi - 1;
*yo = Dy - yi - 1;
} else if (rotating == ROTATE_90) {
*xo = yi;
*yo = Dx - xi - 1;
} else if (rotating == ROTATE_90X) {
*xo = yi;
*yo = xi;
} else if (rotating == ROTATE_90Y) {
*xo = Dy - yi - 1;
*yo = Dx - xi - 1;
} else if (rotating == ROTATE_270) {
*xo = Dy - yi - 1;
*yo = xi;
}
}
/* unroll the Bpp loop to be used in each case: */
#define ROT_COPY \
src = src_0 + fbl*y + Bpp*x; \
dst = dst_0 + rbl*yn + Bpp*xn; \
if (Bpp == 1) { \
*(dst) = *(src); \
} else if (Bpp == 2) { \
*(dst+0) = *(src+0); \
*(dst+1) = *(src+1); \
} else if (Bpp == 3) { \
*(dst+0) = *(src+0); \
*(dst+1) = *(src+1); \
*(dst+2) = *(src+2); \
} else if (Bpp == 4) { \
*(dst+0) = *(src+0); \
*(dst+1) = *(src+1); \
*(dst+2) = *(src+2); \
*(dst+3) = *(src+3); \
}
void rotate_fb(int x1, int y1, int x2, int y2) {
int x, y, xn, yn, r_x1, r_y1, r_x2, r_y2, Bpp = bpp/8;
int fbl = rfb_bytes_per_line;
int rbl = rot_bytes_per_line;
int Dx, Dy;
char *src, *dst;
char *src_0 = rfb_fb;
char *dst_0 = rot_fb;
if (! rotating || ! rot_fb) {
return;
}
if (scaling) {
Dx = scaled_x;
Dy = scaled_y;
} else {
Dx = dpy_x;
Dy = dpy_y;
}
rotate_coords(x1, y1, &r_x1, &r_y1, -1, -1);
rotate_coords(x2, y2, &r_x2, &r_y2, -1, -1);
dst = rot_fb;
if (rotating == ROTATE_X) {
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
xn = Dx - x - 1;
yn = y;
ROT_COPY
}
}
} else if (rotating == ROTATE_Y) {
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
xn = x;
yn = Dy - y - 1;
ROT_COPY
}
}
} else if (rotating == ROTATE_XY) {
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
xn = Dx - x - 1;
yn = Dy - y - 1;
ROT_COPY
}
}
} else if (rotating == ROTATE_90) {
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
xn = Dy - y - 1;
yn = x;
ROT_COPY
}
}
} else if (rotating == ROTATE_90X) {
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
xn = y;
yn = x;
ROT_COPY
}
}
} else if (rotating == ROTATE_90Y) {
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
xn = Dy - y - 1;
yn = Dx - x - 1;
ROT_COPY
}
}
} else if (rotating == ROTATE_270) {
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
xn = y;
yn = Dx - x - 1;
ROT_COPY
}
}
}
}
void rotate_curs(char *dst_0, char *src_0, int Dx, int Dy, int Bpp) {
int x, y, xn, yn;
char *src, *dst;
int fbl, rbl;
if (! rotating) {
return;
}
fbl = Dx * Bpp;
if (rotating_same) {
rbl = Dx * Bpp;
} else {
rbl = Dy * Bpp;
}
if (rotating == ROTATE_X) {
for (y = 0; y < Dy; y++) {
for (x = 0; x < Dx; x++) {
xn = Dx - x - 1;
yn = y;
ROT_COPY
if (0) fprintf(stderr, "rcurs: %d %d %d %d\n", x, y, xn, yn);
}
}
} else if (rotating == ROTATE_Y) {
for (y = 0; y < Dy; y++) {
for (x = 0; x < Dx; x++) {
xn = x;
yn = Dy - y - 1;
ROT_COPY
}
}
} else if (rotating == ROTATE_XY) {
for (y = 0; y < Dy; y++) {
for (x = 0; x < Dx; x++) {
xn = Dx - x - 1;
yn = Dy - y - 1;
ROT_COPY
}
}
} else if (rotating == ROTATE_90) {
for (y = 0; y < Dy; y++) {
for (x = 0; x < Dx; x++) {
xn = Dy - y - 1;
yn = x;
ROT_COPY
}
}
} else if (rotating == ROTATE_90X) {
for (y = 0; y < Dy; y++) {
for (x = 0; x < Dx; x++) {
xn = y;
yn = x;
ROT_COPY
}
}
} else if (rotating == ROTATE_90Y) {
for (y = 0; y < Dy; y++) {
for (x = 0; x < Dx; x++) {
xn = Dy - y - 1;
yn = Dx - x - 1;
ROT_COPY
}
}
} else if (rotating == ROTATE_270) {
for (y = 0; y < Dy; y++) {
for (x = 0; x < Dx; x++) {
xn = y;
yn = Dx - x - 1;
ROT_COPY
}
}
}
}
void mark_wrapper(int x1, int y1, int x2, int y2) {
int t, r_x1 = x1, r_y1 = y1, r_x2 = x2, r_y2 = y2;
if (rotating) {
/* well we hope rot_fb will always be the last one... */
rotate_coords(x1, y1, &r_x1, &r_y1, -1, -1);
rotate_coords(x2, y2, &r_x2, &r_y2, -1, -1);
rotate_fb(x1, y1, x2, y2);
if (r_x1 > r_x2) {
t = r_x1;
r_x1 = r_x2;
r_x2 = t;
}
if (r_y1 > r_y2) {
t = r_y1;
r_y1 = r_y2;
r_y2 = t;
}
/* painting errors */
r_x1--;
r_x2++;
r_y1--;
r_y2++;
}
rfbMarkRectAsModified(screen, r_x1, r_y1, r_x2, r_y2);
}
void mark_rect_as_modified(int x1, int y1, int x2, int y2, int force) {
@ -1243,8 +1611,9 @@ void mark_rect_as_modified(int x1, int y1, int x2, int y2, int force) {
}
}
if (rfb_fb == main_fb || force) {
rfbMarkRectAsModified(screen, x1, y1, x2, y2);
mark_wrapper(x1, y1, x2, y2);
return;
}
@ -1255,7 +1624,7 @@ void mark_rect_as_modified(int x1, int y1, int x2, int y2, int force) {
if (scaling) {
scale_and_mark_rect(x1, y1, x2, y2);
} else {
rfbMarkRectAsModified(screen, x1, y1, x2, y2);
mark_wrapper(x1, y1, x2, y2);
}
}

@ -29,12 +29,13 @@ void set_colormap(int reset);
void set_nofb_params(int restore);
void set_raw_fb_params(int restore);
void do_new_fb(int reset_mem);
void free_old_fb(char *old_main, char *old_rfb, char *old_8to24, char *old_snap_fb);
void free_old_fb(void);
void check_padded_fb(void);
void install_padded_fb(char *geom);
XImage *initialize_xdisplay_fb(void);
void parse_scale_string(char *str, double *factor, int *scaling, int *blend,
int *nomult4, int *pad, int *interpolate, int *numer, int *denom);
int parse_rotate_string(char *str, int *mode);
int scale_round(int len, double fac);
void initialize_screen(int *argc, char **argv, XImage *fb);
void set_vnc_desktop_name(void);
@ -657,24 +658,34 @@ static void nofb_hook(rfbClientPtr cl) {
screen->displayHook = NULL;
}
void free_old_fb(char *old_main, char *old_rfb, char *old_8to24, char *old_snap_fb) {
if (old_main) {
free(old_main);
}
if (old_rfb) {
if (old_rfb != old_main) {
free(old_rfb);
void free_old_fb(void) {
char *fbs[16];
int i, j, nfb = 0, db = 0;
fbs[nfb++] = main_fb; main_fb = NULL;
fbs[nfb++] = rfb_fb; rfb_fb = NULL;
fbs[nfb++] = cmap8to24_fb; cmap8to24_fb = NULL;
fbs[nfb++] = snap_fb; snap_fb = NULL;
fbs[nfb++] = rot_fb; rot_fb = NULL;
fbs[nfb++] = raw_fb; raw_fb = NULL;
for (i=0; i < nfb; i++) {
char *fb = fbs[i];
int freeit = 1;
if (! fb || fb < (char *) 0x10) {
continue;
}
}
if (old_8to24) {
if (old_8to24 != old_main && old_8to24 != old_rfb) {
free(old_8to24);
for (j=0; j < i; j++) {
if (fb == fbs[j]) {
freeit = 0;
break;
}
}
}
if (old_snap_fb) {
if (old_snap_fb != old_main && old_snap_fb != old_rfb &&
old_snap_fb != old_8to24) {
free(old_snap_fb);
if (freeit) {
if (db) fprintf(stderr, "free: %i %p\n", i, fb);
free(fb);
} else {
if (db) fprintf(stderr, "skip: %i %p\n", i, fb);
}
}
}
@ -694,15 +705,7 @@ void do_new_fb(int reset_mem) {
free_tiles();
}
free_old_fb(main_fb, rfb_fb, cmap8to24_fb, snap_fb);
if (raw_fb == main_fb || raw_fb == rfb_fb) {
raw_fb = NULL;
}
main_fb = NULL;
rfb_fb = NULL;
cmap8to24_fb = NULL;
snap_fb = NULL;
free_old_fb();
fb = initialize_xdisplay_fb();
@ -1766,6 +1769,35 @@ void parse_scale_string(char *str, double *factor, int *scaling, int *blend,
free(tstr);
}
int parse_rotate_string(char *str, int *mode) {
int m = ROTATE_NONE;
if (str == NULL || !strcmp(str, "") || !strcmp(str, "0")) {
m = ROTATE_NONE;
} else if (!strcmp(str, "x")) {
m = ROTATE_X;
} else if (!strcmp(str, "y")) {
m = ROTATE_Y;
} else if (!strcmp(str, "xy") || !strcmp(str, "yx") ||
!strcmp(str,"+180") || !strcmp(str,"-180") || !strcmp(str,"180")) {
m = ROTATE_XY;
} else if (!strcmp(str, "+90") || !strcmp(str, "90")) {
m = ROTATE_90;
} else if (!strcmp(str, "+90x") || !strcmp(str, "90x")) {
m = ROTATE_90X;
} else if (!strcmp(str, "+90y") || !strcmp(str, "90y")) {
m = ROTATE_90Y;
} else if (!strcmp(str, "-90") || !strcmp(str, "270") ||
!strcmp(str, "+270")) {
m = ROTATE_270;
} else {
rfbLog("invalid -rotate mode: %s\n", str);
}
if (mode) {
*mode = m;
}
return m;
}
int scale_round(int len, double fac) {
double eps = 0.000001;
@ -1837,6 +1869,28 @@ static void setup_scaling(int *width_in, int *height_in) {
}
}
static void setup_rotating(void) {
char *rs = rotating_str;
rotating_cursors = 1;
if (rs && strstr(rs, "nc:") == rs) {
rs += strlen("nc:");
rotating_cursors = 0;
}
rotating = parse_rotate_string(rs, NULL);
if (! rotating) {
rotating_cursors = 0;
}
if (rotating == ROTATE_90 || rotating == ROTATE_90X ||
rotating == ROTATE_90Y || rotating == ROTATE_270) {
rotating_same = 0;
} else {
rotating_same = 1;
}
}
/*
* initialize the rfb framebuffer/screen
*/
@ -1892,8 +1946,27 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
rfb_bytes_per_line = main_bytes_per_line;
}
setup_rotating();
if (rotating) {
if (! rotating_same) {
int t, b = main_bytes_per_line / fb->width;
if (scaling) {
rot_bytes_per_line = b * height;
} else {
rot_bytes_per_line = b * fb->height;
}
t = width;
width = height; /* The big swap... */
height = t;
} else {
rot_bytes_per_line = rfb_bytes_per_line;
}
}
if (cmap8to24 && depth == 8) {
rfb_bytes_per_line *= 4;
rot_bytes_per_line *= 4;
}
/*
@ -1965,7 +2038,11 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
}
/* set up format from scratch: */
screen->paddedWidthInBytes = rfb_bytes_per_line;
if (rotating && ! rotating_same) {
screen->paddedWidthInBytes = rot_bytes_per_line;
} else {
screen->paddedWidthInBytes = rfb_bytes_per_line;
}
screen->serverFormat.bitsPerPixel = fb_bpp;
screen->serverFormat.depth = fb_depth;
screen->serverFormat.trueColour = TRUE;
@ -2155,6 +2232,8 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
main_bytes_per_line);
fprintf(stderr, " rfb_fb_bytes_per_line: %d\n",
rfb_bytes_per_line);
fprintf(stderr, " rot_fb_bytes_per_line: %d\n",
rot_bytes_per_line);
switch(fb->format) {
case XYBitmap:
fprintf(stderr, " format: XYBitmap\n"); break;
@ -2201,11 +2280,13 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
main_fb = NULL;
rfb_fb = main_fb;
cmap8to24_fb = NULL;
rot_fb = NULL;
screen->displayHook = nofb_hook;
} else {
main_fb = fb->data;
rfb_fb = NULL;
cmap8to24_fb = NULL;
rot_fb = NULL;
if (cmap8to24) {
int n = main_bytes_per_line * fb->height;
@ -2215,20 +2296,39 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
cmap8to24_fb = (char *) malloc(n);
memset(cmap8to24_fb, 0, n);
}
if (rotating) {
int n = rot_bytes_per_line * height;
rot_fb = (char *) malloc(n);
memset(rot_fb, 0, n);
}
if (scaling) {
rfb_fb = (char *) malloc(rfb_bytes_per_line * height);
memset(rfb_fb, 0, rfb_bytes_per_line * height);
int n = rfb_bytes_per_line * height;
if (rotating && ! rotating_same) {
n = rot_bytes_per_line * height;
}
rfb_fb = (char *) malloc(n);
memset(rfb_fb, 0, n);
} else if (cmap8to24) {
rfb_fb = cmap8to24_fb;
} else {
rfb_fb = main_fb;
}
}
screen->frameBuffer = rfb_fb;
if (rot_fb) {
screen->frameBuffer = rot_fb;
} else {
screen->frameBuffer = rfb_fb;
}
if (!quiet) {
fprintf(stderr, " rfb_fb: %p\n", rfb_fb);
fprintf(stderr, " main_fb: %p\n", main_fb);
fprintf(stderr, " 8to24_fb: %p\n", cmap8to24_fb);
fprintf(stderr, " rot_fb: %p\n", rot_fb);
fprintf(stderr, " snap_fb: %p\n", snap_fb);
fprintf(stderr, " raw_fb: %p\n", raw_fb);
fprintf(stderr, " fake_fb: %p\n", fake_fb);
@ -2241,7 +2341,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
setup_cursors_and_push();
if (scaling || cmap8to24) {
if (scaling || rotating || cmap8to24) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}

@ -10,13 +10,14 @@ extern void set_colormap(int reset);
extern void set_nofb_params(int restore);
extern void set_raw_fb_params(int restore);
extern void do_new_fb(int reset_mem);
extern void free_old_fb(char *old_main, char *old_rfb, char *old_8to24, char *old_snap_fb);
extern void free_old_fb(void);
extern void check_padded_fb(void);
extern void install_padded_fb(char *geom);
extern XImage *initialize_xdisplay_fb(void);
extern XImage *initialize_raw_fb(int);
extern void parse_scale_string(char *str, double *factor, int *scaling, int *blend,
int *nomult4, int *pad, int *interpolate, int *numer, int *denom);
extern int parse_rotate_string(char *str, int *mode);
extern int scale_round(int len, double fac);
extern void initialize_screen(int *argc, char **argv, XImage *fb);
extern void set_vnc_desktop_name(void);

@ -673,7 +673,13 @@ char *guess_desktop(void) {
if (prop != None) return "gnome";
prop = XInternAtom(dpy, "KWIN_RUNNING", True);
if (prop != None) return "kde";
if (prop != None) {
prop = XInternAtom(dpy, "_KDE_RUNNING", True);
if (prop != None) {
prop = XInternAtom(dpy, "KDE_DESKTOP_WINDOW", True);
if (prop != None) return "kde";
}
}
prop = XInternAtom(dpy, "_MOTIF_WM_INFO", True);
if (prop != None) {

@ -15,7 +15,7 @@
#endif
#endif
#ifdef REL8x
#ifdef NO_SSL_OR_UNIXPW
#undef SSLCMDS
#endif

@ -20,7 +20,7 @@
#endif
#endif
#ifdef REL8x
#ifdef NO_SSL_OR_UNIXPW
#undef FORK_OK
#undef LIBVNCSERVER_HAVE_LIBSSL
#define LIBVNCSERVER_HAVE_LIBSSL 0
@ -923,14 +923,7 @@ static void lose_ram(void) {
* without doing exec(). we really should re-exec, but a pain
* to redo all SSL ctx.
*/
free_old_fb(main_fb, rfb_fb, cmap8to24_fb, snap_fb);
if (raw_fb == main_fb || raw_fb == rfb_fb) {
raw_fb = NULL;
}
main_fb = NULL;
rfb_fb = NULL;
cmap8to24_fb = NULL;
snap_fb = NULL;
free_old_fb();
free_tiles();
}
@ -1406,6 +1399,8 @@ void accept_openssl(int mode) {
int f_in = fileno(stdin);
int f_out = fileno(stdout);
if (db) fprintf(stderr, "helper pid in: %d %d %d %d\n", f_in, f_out, sock, listen);
/* reset all handlers to default (no interrupted() calls) */
unset_signals();
@ -1442,6 +1437,7 @@ void accept_openssl(int mode) {
" back to: %d\n", getpid(), cport);
exit(1);
}
if (db) fprintf(stderr, "vncsock %d\n", vncsock);
/* try to initialize SSL with the remote client */
@ -2370,10 +2366,9 @@ static void init_prng(void) {
void raw_xfer(int csock, int s_in, int s_out) {
char buf[8192];
int sz = 8192, n, m, status;
int sz = 8192, n, m, status, db = 1;
#ifdef FORK_OK
pid_t pid = fork();
int db = 1;
/* this is for testing, no SSL just socket redir */
if (pid < 0) {
@ -2389,7 +2384,7 @@ void raw_xfer(int csock, int s_in, int s_out) {
} else if (n > 0) {
int len = n;
char *src = buf;
if (db > 1) write(2, buf, n);
if (db > 1) write(2, buf, n);
while (len > 0) {
m = write(s_out, src, len);
if (m > 0) {
@ -2400,7 +2395,7 @@ if (db > 1) write(2, buf, n);
if (m < 0 && (errno == EINTR || errno == EAGAIN)) {
continue;
}
if (db) fprintf(stderr, "raw_xfer bad write: %d -> %d | %d/%d errno=%d\n", csock, s_out, m, n, errno);
if (db) fprintf(stderr, "raw_xfer bad write: %d -> %d | %d/%d errno=%d\n", csock, s_out, m, n, errno);
break;
}
}
@ -2419,7 +2414,7 @@ if (db > 1) write(2, buf, n);
} else if (n > 0) {
int len = n;
char *src = buf;
if (db > 1) write(2, buf, n);
if (db > 1) write(2, buf, n);
while (len > 0) {
m = write(csock, src, len);
if (m > 0) {
@ -2441,6 +2436,6 @@ if (db > 1) write(2, buf, n);
close(csock);
close(s_in);
close(s_out);
#endif
#endif /* FORK_OK */
}

@ -166,6 +166,7 @@ Screen
=GAL ResizeRotate::
= xrandr
=-C:resize,newfbsize,exit xrandr_mode:
rotate:
padgeom:
=GAL LOFF
=GAL Clipping::

@ -177,6 +177,7 @@ char gui_code[] = "";
" =GAL ResizeRotate::\n"
" = xrandr\n"
" =-C:resize,newfbsize,exit xrandr_mode:\n"
" rotate:\n"
" padgeom:\n"
" =GAL LOFF\n"
" =GAL Clipping::\n"

@ -51,7 +51,7 @@ extern char *crypt(const char*, const char *);
#define IS_BSD
#endif
#ifdef REL8x
#ifdef NO_SSL_OR_UNIXPW
#undef UNIXPW_SU
#undef UNIXPW_CRYPT
#endif
@ -117,6 +117,9 @@ static int text_y(void) {
return char_y + char_row * char_h;
}
static rfbScreenInfo fscreen;
static rfbScreenInfoPtr pscreen;
void unixpw_screen(int init) {
if (unixpw_nis) {
#ifndef UNIXPW_CRYPT
@ -143,9 +146,20 @@ void unixpw_screen(int init) {
if (scaling) {
x = (int) (x * scale_fac);
y = (int) (y * scale_fac);
x = nfix(x, scaled_x);
y = nfix(y, scaled_y);
}
if (rotating) {
fscreen.serverFormat.bitsPerPixel = bpp;
fscreen.paddedWidthInBytes = rfb_bytes_per_line;
fscreen.frameBuffer = rfb_fb;
pscreen = &fscreen;
} else {
pscreen = screen;
}
rfbDrawString(screen, &default8x16Font, x, y, log, white());
rfbDrawString(pscreen, &default8x16Font, x, y, log, white());
char_x = x;
char_y = y;
@ -156,7 +170,7 @@ void unixpw_screen(int init) {
}
if (scaling) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 1);
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
@ -895,18 +909,18 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
x = text_x();
y = text_y();
rfbDrawString(screen, &default8x16Font, x, y, li, white());
rfbDrawString(pscreen, &default8x16Font, x, y, li, white());
char_row += 2;
x = text_x();
y = text_y();
rfbDrawString(screen, &default8x16Font, x, y, log, white());
rfbDrawString(pscreen, &default8x16Font, x, y, log, white());
char_col = strlen(log);
if (scaling) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 1);
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
@ -927,7 +941,7 @@ static void set_db(void) {
void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
int x, y, i, nmax = 100;
static char user[100], pass[100];
static char user_r[100], user[100], pass[100];
static int u_cnt = 0, p_cnt = 0, first = 1;
char keystr[100];
char *str;
@ -935,6 +949,9 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
if (first) {
set_db();
first = 0;
for (i=0; i < nmax; i++) {
user_r[i] = '\0';
}
}
if (init) {
@ -1006,6 +1023,9 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
int w2 = char_w / scale_fac;
int h2 = char_h / scale_fac;
x2 = nfix(x2, dpy_x);
y2 = nfix(y2, dpy_y);
zero_fb(x2 - w2, y2 - h2, x2, y2);
mark_rect_as_modified(x2 - w2,
y2 - h2, x2, y2, 0);
@ -1038,17 +1058,42 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
x = text_x();
y = text_y();
rfbDrawString(screen, &default8x16Font, x, y, pw,
rfbDrawString(pscreen, &default8x16Font, x, y, pw,
white());
char_col = strlen(pw);
if (scaling) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 1);
mark_rect_as_modified(0, 0, scaled_x,
scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
return;
}
if (u_cnt == 0 && keysym == XK_Up) {
/*
* Allow user to hit Up arrow at beginning to
* regain their username plus any options.
*/
int i;
for (i=0; i < nmax; i++) {
user[u_cnt++] = user_r[i];
if (user_r[i] == '\0') {
break;
}
keystr[0] = (char) user_r[i];
keystr[1] = '\0';
x = text_x();
y = text_y();
rfbDrawString(pscreen, &default8x16Font, x, y,
keystr, white());
mark_rect_as_modified(x, y-char_h, x+char_w,
y, scaling);
char_col++;
usleep(10*1000);
}
return;
}
if (keysym <= ' ' || keysym >= 0x7f) {
return;
}
@ -1066,6 +1111,9 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
user[u_cnt++] = keystr[0];
#else
user[u_cnt++] = (char) keysym;
for (i=0; i < nmax; i++) {
user_r[i] = user[i];
}
keystr[0] = (char) keysym;
#endif
@ -1075,13 +1123,9 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
if (db && db <= 2) fprintf(stderr, "u_cnt: %d %d/%d ks: 0x%x %s\n", u_cnt, x, y, keysym, keystr);
keystr[1] = '\0';
rfbDrawString(screen, &default8x16Font, x, y, keystr, white());
rfbDrawString(pscreen, &default8x16Font, x, y, keystr, white());
if (scaling) {
mark_rect_as_modified(x, y-char_h, x+char_w, y, 1);
} else {
mark_rect_as_modified(x, y-char_h, x+char_w, y, 0);
}
mark_rect_as_modified(x, y-char_h, x+char_w, y, scaling);
char_col++;
} else if (in_passwd) {
@ -1272,9 +1316,9 @@ void unixpw_deny(void) {
x = char_x + char_col * char_w;
y = char_y + char_row * char_h;
rfbDrawString(screen, &default8x16Font, x, y, pd, white());
rfbDrawString(pscreen, &default8x16Font, x, y, pd, white());
if (scaling) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 1);
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}
@ -1304,9 +1348,9 @@ void unixpw_msg(char *msg, int delay) {
x = char_x + char_col * char_w;
y = char_y + char_row * char_h;
rfbDrawString(screen, &default8x16Font, x, y, msg, white());
rfbDrawString(pscreen, &default8x16Font, x, y, msg, white());
if (scaling) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 1);
mark_rect_as_modified(0, 0, scaled_x, scaled_y, 1);
} else {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
}

@ -1041,6 +1041,7 @@ void user_supplied_opts(char *opts) {
"scale", "scale_cursor", "sc", "solid", "so", "id",
"clear_mods", "cm", "clear_keys", "ck", "repeat",
"speeds", "sp", "readtimeout", "rd",
"rotate", "ro",
NULL
};
@ -1089,6 +1090,11 @@ void user_supplied_opts(char *opts) {
if (scale_cursor_str) free(scale_cursor_str);
q = strchr(p, '=') + 1;
scale_cursor_str = strdup(q);
} else if (strstr(p, "rotate=") == p ||
strstr(p, "ro=") == p) {
if (rotating_str) free(rotating_str);
q = strchr(p, '=') + 1;
rotating_str = strdup(q);
} else if (!strcmp(p, "solid") || !strcmp(p, "so")) {
use_solid_bg = 1;
if (!solid_str) {

@ -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);
}

@ -2,7 +2,7 @@
.TH X11VNC "1" "July 2006" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.8.3, lastmod: 2006-07-17
version: 0.8.3, lastmod: 2006-07-28
.SH SYNOPSIS
.B x11vnc
[OPTION]...
@ -744,8 +744,8 @@ Also in the case of \fB-unixpw,\fR the user logging in
can place a colon at the end of his username and
supply a few options: scale=, scale_cursor= (or sc=),
solid (or so), id=, clear_mods (or cm), clear_keys
(or ck), repeat, speeds= (or sp=), or readtimeout=
(or rd=) separated by commas if there is more than one.
(or ck), repeat, speeds= (or sp=), readtimeout=
(or rd=), or rotate= (or ro=) separated by commas if there is more than one.
After the user logs in successfully, these options will
be applied to the VNC screen. For example,
.IP
@ -1666,6 +1666,39 @@ encoding, and then resize the framebuffer. "exit"
means disconnect all viewer clients, and then terminate
x11vnc.
.PP
\fB-rotate\fR \fIstring\fR
.IP
Rotate and/or flip the framebuffer view exported by VNC.
This transformation is independent of XRANDR and is
done in software in main memory and so may be slower.
This mode could be useful on a handheld with portrait or
landscape modes that do not correspond to the scanline
order of the actual framebuffer. \fIstring\fR can be:
.IP
x flip along x-axis
y flip along y-axis
xy flip along x- and y-axes
+90 rotate 90 degrees clockwise
\fB-90\fR rotate 90 degrees counter-clockwise
+90x rotate 90 degrees CW, then flip along x
+90y rotate 90 degrees CW, then flip along y
.IP
these give all possible rotations and reflections.
.IP
Aliases: same as xy: yx, +180, \fB-180,\fR 180
same as \fB-90:\fR +270, 270
same as +90: 90, (ditto for 90x, 90y)
.IP
Like \fB-scale,\fR this transformation is applied at the very
end of any chain of framebuffer transformations and so
any options with geometries, e.g. \fB-blackout,\fR \fB-clip,\fR etc.
are relative to the original X (or \fB-rawfb)\fR framebuffer,
not the final one sent to VNC viewers.
.IP
If you do not want the cursor shape to be rotated
prefix \fIstring\fR with "nc:", e.g. "nc:+90",
"nc:xy", etc.
.PP
\fB-padgeom\fR \fIWxH\fR
.IP
Whenever a new vncviewer connects, the framebuffer is
@ -3024,7 +3057,7 @@ nonstandard, use "console:/dev/foofb"
.IP
If you do not want x11vnc to guess the framebuffer's
WxHxB and masks automatically (sometimes the kernel
given inaccurate information), specify them with a
gives inaccurate information), specify them with a
@WxHxB at the end of the string.
.IP
Examples:
@ -3460,6 +3493,8 @@ noxrandr disable \fB-xrandr\fR mode.
.IP
xrandr_mode:mode set the \fB-xrandr\fR mode to "mode".
.IP
rotate:mode set the \fB-rotate\fR mode to "mode".
.IP
padgeom:WxH set \fB-padgeom\fR to WxH (empty to disable)
If WxH is "force" or "do" the padded
geometry fb is immediately applied.
@ -3823,7 +3858,7 @@ unlock connect allowonce allow localhost nolocalhost
listen lookup nolookup accept afteraccept gone shm
noshm flipbyteorder noflipbyteorder onetile noonetile
solid_color solid nosolid blackout xinerama noxinerama
xtrap noxtrap xrandr noxrandr xrandr_mode padgeom
xtrap noxtrap xrandr noxrandr xrandr_mode rotate padgeom
quiet q noquiet modtweak nomodtweak xkb noxkb capslock
nocapslock skip_lockkeys noskip_lockkeys skip_keycodes
sloppy_keys nosloppy_keys skip_dups noskip_dups
@ -3846,9 +3881,9 @@ pm input_skip allinput noallinput input grabkbd
nograbkbd grabptr nograbptr client_input speeds wmdt
debug_pointer dp nodebug_pointer nodp debug_keyboard
dk nodebug_keyboard nodk deferupdate defer wait_ui
wait_bog nowait_bog slow_fb wait readtimeout nap
nonap sb screen_blank fbpm nofbpm fs gaps grow
fuzz snapfb nosnapfb rawfb uinput_accel uinput_reset
wait_bog nowait_bog slow_fb wait readtimeout nap nonap
sb screen_blank fbpm nofbpm fs gaps grow fuzz snapfb
nosnapfb rawfb uinput_accel uinput_thresh uinput_reset
uinput_always progressive rfbport http nohttp httpport
httpdir enablehttpproxy noenablehttpproxy alwaysshared
noalwaysshared nevershared noalwaysshared dontdisconnect

@ -1642,7 +1642,7 @@ int main(int argc, char* argv[]) {
CHECK_ARGC
passwdfile = strdup(argv[++i]);
got_passwdfile = 1;
#ifndef REL8x
#ifndef NO_SSL_OR_UNIXPW
} else if (strstr(arg, "-unixpw") == arg) {
unixpw = 1;
if (strstr(arg, "-unixpw_nis")) {
@ -1826,6 +1826,9 @@ int main(int argc, char* argv[]) {
i++;
}
}
} else if (!strcmp(arg, "-rotate")) {
CHECK_ARGC
rotating_str = strdup(argv[++i]);
} else if (!strcmp(arg, "-padgeom")
|| !strcmp(arg, "-padgeometry")) {
CHECK_ARGC

@ -131,7 +131,7 @@
#define PASSWD_UNLESS_NOPW 0
#endif
#define noREL8x
#define xxNO_SSL_OR_UNIXPW
/*
* Beginning of support for small binary footprint build for embedded
@ -386,6 +386,7 @@ extern char *rfb_fb; /* same as main_fb unless transformation */
extern char *fake_fb; /* used under -padgeom */
extern char *snap_fb; /* used under -snapfb */
extern char *cmap8to24_fb; /* used under -8to24 */
extern char *rot_fb; /* used under -rotate */
extern char *raw_fb;
extern char *raw_fb_addr;
extern int raw_fb_offset;
@ -397,6 +398,7 @@ extern int raw_fb_back_to_X;
extern int rfb_bytes_per_line;
extern int main_bytes_per_line;
extern int rot_bytes_per_line;
extern unsigned long main_red_mask, main_green_mask, main_blue_mask;
extern unsigned short main_red_max, main_green_max, main_blue_max;
extern unsigned short main_red_shift, main_green_shift, main_blue_shift;
@ -411,6 +413,10 @@ extern int scaling_pad; /* pad out scaled sizes to fit denominator */
extern int scaling_interpolate; /* use interpolation scheme when shrinking */
extern int scaled_x, scaled_y; /* dimensions of scaled display */
extern int scale_numer, scale_denom; /* n/m */
extern char *rotating_str;
extern int rotating;
extern int rotating_same;
extern int rotating_cursors;
/* scale cursor */
extern char *scale_cursor_str;

@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8.3 lastmod: 2006-07-17";
char lastmod[] = "0.8.3 lastmod: 2006-07-28";
/* X display info */
@ -59,6 +59,7 @@ char *rfb_fb = NULL; /* same as main_fb unless transformation */
char *fake_fb = NULL; /* used under -padgeom */
char *snap_fb = NULL; /* used under -snapfb */
char *cmap8to24_fb = NULL; /* used under -8to24 */
char *rot_fb = NULL;
char *raw_fb = NULL; /* when used should be main_fb */
char *raw_fb_addr = NULL;
int raw_fb_offset = 0;
@ -70,6 +71,7 @@ int raw_fb_back_to_X = 0; /* kludge for testing rawfb -> X */
int rfb_bytes_per_line = 0;
int main_bytes_per_line = 0;
int rot_bytes_per_line = 0;
unsigned long main_red_mask = 0, main_green_mask = 0, main_blue_mask = 0;
unsigned short main_red_max = 0, main_green_max = 0, main_blue_max = 0;
unsigned short main_red_shift = 0, main_green_shift = 0, main_blue_shift = 0;
@ -84,6 +86,10 @@ int scaling_pad = 0; /* pad out scaled sizes to fit denominator */
int scaling_interpolate = 0; /* use interpolation scheme when shrinking */
int scaled_x = 0, scaled_y = 0; /* dimensions of scaled display */
int scale_numer = 0, scale_denom = 0; /* n/m */
char *rotating_str = NULL;
int rotating = 0;
int rotating_same = 0;
int rotating_cursors = 0;
/* scale cursor */
char *scale_cursor_str = NULL;

Loading…
Cancel
Save