Commit 338301c1 authored by runge's avatar runge

x11vnc: -xrefresh, .DCOPserver bug, -unixpw_unsafe ignores SSH tunnel.

parent 0f162f1f
2007-08-03 Karl Runge <runge@karlrunge.com>
* x11vnc: add -xrefresh option, fix KDE .DCOPserver parse bug,
make sure UNIXPW_DISABLE_LOCALHOST/-unixpw_unsafe ignore
any SSH tunnel that would imply -localhost.
2007-07-04 Karl Runge <runge@karlrunge.com>
* x11vnc: -debug_ncache, fix big fonts in tkx11vnc.
......
This diff is collapsed.
......@@ -2786,6 +2786,12 @@ void print_help(int mode) {
" For special purpose usage where a low frame rate is\n"
" acceptable and desirable, but you want the user input\n"
" processed at the normal rate so you cannot use -wait.\n"
"-xrefresh time Floating point time in seconds to indicate how often to\n"
" do the equivalent of xrefresh(1) to force all windows\n"
" (in the viewable area if -id, -sid, or -clip is used)\n"
" to repaint themselves. Use this only if applications\n"
" misbehave by not repainting themselves properly.\n"
" See also -noxdamage.\n"
"-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On\n"
" slow links that take a long time to paint the first\n"
" screen libvncserver may hit the timeout and drop the\n"
......@@ -3719,6 +3725,7 @@ void print_help(int mode) {
" wait_bog disable -nowait_bog mode.\n"
" nowait_bog enable -nowait_bog mode.\n"
" slow_fb:f set -slow_fb to f seconds.\n"
" xrefresh:f set -xrefresh to f seconds.\n"
" readtimeout:n set read timeout to n seconds.\n"
" nap enable -nap mode.\n"
" nonap disable -nap mode.\n"
......@@ -3868,15 +3875,15 @@ void print_help(int mode) {
" nowf wireframelocal wfl nowireframelocal nowfl\n"
" wirecopyrect wcr nowirecopyrect nowcr scr_area\n"
" scr_skip scr_inc scr_keys scr_term scr_keyrepeat\n"
" scr_parms scrollcopyrect scr noscrollcopyrect\n"
" noscr fixscreen noxrecord xrecord reset_record\n"
" pointer_mode pm input_skip allinput noallinput input\n"
" grabkbd nograbkbd grabptr nograbptr grabalways\n"
" nograbalways client_input ssltimeout 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 nonap\n"
" sb screen_blank fbpm nofbpm dpms nodpms clientdpms\n"
" scr_parms scrollcopyrect scr noscrollcopyrect noscr\n"
" fixscreen noxrecord xrecord reset_record pointer_mode\n"
" pm input_skip allinput noallinput input grabkbd\n"
" nograbkbd grabptr nograbptr grabalways nograbalways\n"
" client_input ssltimeout speeds wmdt debug_pointer dp\n"
" nodebug_pointer nodp debug_keyboard dk nodebug_keyboard\n"
" nodk deferupdate defer wait_ui wait_bog nowait_bog\n"
" slow_fb xrefresh wait readtimeout nap nonap sb\n"
" screen_blank fbpm nofbpm dpms nodpms clientdpms\n"
" noclientdpms forcedpms noforcedpms noserverdpms\n"
" serverdpms noultraext ultraext fs gaps grow fuzz snapfb\n"
" nosnapfb rawfb uinput_accel uinput_thresh uinput_reset\n"
......
......@@ -345,6 +345,7 @@ int flip_byte_order = 0; /* sometimes needed when using_shm = 0 */
int waitms = 20;
double wait_ui = 2.0;
double slow_fb = 0.0;
double xrefresh = 0.0;
int wait_bog = 1;
int defer_update = 20; /* deferUpdateTime ms to wait before sends. */
int got_defer = 0;
......
......@@ -250,6 +250,7 @@ extern int flip_byte_order;
extern int waitms;
extern double wait_ui;
extern double slow_fb;
extern double xrefresh;
extern int wait_bog;
extern int defer_update;
extern int got_defer;
......
......@@ -3598,6 +3598,20 @@ char *process_remote_cmd(char *cmd, int stringonly) {
slow_fb, w);
slow_fb = w;
} else if (strstr(p, "xrefresh") == p) {
double w;
COLON_CHECK("xrefresh:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%.2f", p, co, xrefresh);
goto qry;
}
p += strlen("xrefresh:");
w = atof(p);
if (w <= 0) w = 0.0;
rfbLog("remote_cmd: setting xrefresh delay %.2f -> %.2f\n",
xrefresh, w);
xrefresh = w;
} else if (strstr(p, "wait") == p) {
int w;
COLON_CHECK("wait:")
......
......@@ -620,6 +620,7 @@ static char *dcop_session(void) {
int len;
char *cmd, *host, *user = NULL;
char *out, *p, *ds, *dsn = NULL, *sess = NULL, *sess2 = NULL;
int db = 0;
RAWFB_RET(empty);
......@@ -650,6 +651,9 @@ static char *dcop_session(void) {
ds = ":0";
}
ds = strdup(ds);
p = strrchr(ds, '.');
if (p) *p = '\0';
dsn = strchr(ds, ':');
if (dsn) {
*dsn = '_';
......@@ -658,17 +662,31 @@ static char *dcop_session(void) {
ds = strdup("_0");
dsn = ds;
}
if (db) fprintf(stderr, "ds: %s\n", ds);
if (db) fprintf(stderr, "dsn: %s\n", dsn);
host = this_host();
if (host) {
char *h2 = (char *) malloc(strlen(host) + 2 + 1);
sprintf(h2, "_%s_", host);
free(host);
host = h2;
} else {
host = strdup("");
}
if (db) fprintf(stderr, "host: %s\n", host);
p = strtok(out, "\n");
while (p) {
if (db) fprintf(stderr, "p: %s\n", p);
char *q = strstr(p, ".DCOP");
if (q == NULL) {
;
} else if (host) {
if (strstr(q, host)) {
if(strstr(p, dsn)) {
char *r = strstr(p, dsn);
int n = strlen(dsn);
if(r && !isalnum((int) *(r+n))) {
sess = strdup(q);
break;
} else {
......@@ -679,7 +697,9 @@ static char *dcop_session(void) {
}
}
} else {
if(strstr(p, dsn)) {
char *r = strstr(p, dsn);
int n = strlen(dsn);
if(r && !isalnum((int) *(r+n))) {
sess = strdup(q);
break;
}
......@@ -688,6 +708,7 @@ static char *dcop_session(void) {
}
free(ds);
free(out);
free(host);
if (!sess && sess2) {
sess = sess2;
}
......
......@@ -400,6 +400,8 @@ Tuning
fuzz:
wait_ui:
nowait_bog
slow_fb:
xrefresh:
readtimeout:
snapfb
threads
......
......@@ -411,6 +411,8 @@ char gui_code[] = "";
" fuzz:\n"
" wait_ui:\n"
" nowait_bog\n"
" slow_fb:\n"
" xrefresh:\n"
" readtimeout:\n"
" snapfb\n"
" threads\n"
......
.\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "July 2007" "x11vnc " "User Commands"
.TH X11VNC "1" "August 2007" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.3, lastmod: 2007-07-03
version: 0.9.3, lastmod: 2007-08-03
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -3257,6 +3257,17 @@ For special purpose usage where a low frame rate is
acceptable and desirable, but you want the user input
processed at the normal rate so you cannot use \fB-wait.\fR
.PP
\fB-xrefresh\fR \fItime\fR
.IP
Floating point time in seconds to indicate how often to
do the equivalent of
.IR xrefresh (1)
to force all windows
(in the viewable area if \fB-id,\fR \fB-sid,\fR or \fB-clip\fR is used)
to repaint themselves. Use this only if applications
misbehave by not repainting themselves properly.
See also \fB-noxdamage.\fR
.PP
\fB-readtimeout\fR \fIn\fR
.IP
Set libvncserver rfbMaxClientWait to n seconds. On
......@@ -4489,6 +4500,8 @@ nowait_bog enable \fB-nowait_bog\fR mode.
.IP
slow_fb:f set \fB-slow_fb\fR to f seconds.
.IP
xrefresh:f set \fB-xrefresh\fR to f seconds.
.IP
readtimeout:n set read timeout to n seconds.
.IP
nap enable \fB-nap\fR mode.
......@@ -4728,15 +4741,15 @@ nodebug_ncache wireframe_mode wireframe wf nowireframe
nowf wireframelocal wfl nowireframelocal nowfl
wirecopyrect wcr nowirecopyrect nowcr scr_area
scr_skip scr_inc scr_keys scr_term scr_keyrepeat
scr_parms scrollcopyrect scr noscrollcopyrect
noscr fixscreen noxrecord xrecord reset_record
pointer_mode pm input_skip allinput noallinput input
grabkbd nograbkbd grabptr nograbptr grabalways
nograbalways client_input ssltimeout 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 dpms nodpms clientdpms
scr_parms scrollcopyrect scr noscrollcopyrect noscr
fixscreen noxrecord xrecord reset_record pointer_mode
pm input_skip allinput noallinput input grabkbd
nograbkbd grabptr nograbptr grabalways nograbalways
client_input ssltimeout speeds wmdt debug_pointer dp
nodebug_pointer nodp debug_keyboard dk nodebug_keyboard
nodk deferupdate defer wait_ui wait_bog nowait_bog
slow_fb xrefresh wait readtimeout nap nonap sb
screen_blank fbpm nofbpm dpms nodpms clientdpms
noclientdpms forcedpms noforcedpms noserverdpms
serverdpms noultraext ultraext fs gaps grow fuzz snapfb
nosnapfb rawfb uinput_accel uinput_thresh uinput_reset
......
......@@ -1278,6 +1278,7 @@ static void print_settings(int try_http, int bg, char *gui_str) {
fprintf(stderr, " wait_ui: %.2f\n", wait_ui);
fprintf(stderr, " nowait_bog: %d\n", !wait_bog);
fprintf(stderr, " slow_fb: %.2f\n", slow_fb);
fprintf(stderr, " xrefresh: %.2f\n", xrefresh);
fprintf(stderr, " readtimeout: %d\n", rfbMaxClientWait/1000);
fprintf(stderr, " take_naps: %d\n", take_naps);
fprintf(stderr, " sb: %d\n", screen_blank);
......@@ -2431,6 +2432,9 @@ int main(int argc, char* argv[]) {
} else if (!strcmp(arg, "-slow_fb")) {
CHECK_ARGC
slow_fb = atof(argv[++i]);
} else if (!strcmp(arg, "-xrefresh")) {
CHECK_ARGC
xrefresh = atof(argv[++i]);
} else if (!strcmp(arg, "-readtimeout")) {
CHECK_ARGC
rfbMaxClientWait = atoi(argv[++i]) * 1000;
......@@ -3010,7 +3014,11 @@ int main(int argc, char* argv[]) {
use_stunnel = 0;
}
if (! use_stunnel && ! use_openssl) {
if (have_ssh_env()) {
if (getenv("UNIXPW_DISABLE_LOCALHOST")) {
rfbLog("Skipping -ssl/-stunnel requirement"
" due to\n");
rfbLog("UNIXPW_DISABLE_LOCALHOST setting.\n");
} else if (have_ssh_env()) {
char *s = getenv("SSH_CONNECTION");
if (! s) s = getenv("SSH_CLIENT");
if (! s) s = "SSH_CONNECTION";
......@@ -3027,10 +3035,6 @@ int main(int argc, char* argv[]) {
if (! nopw) {
usleep(2000*1000);
}
} else if (getenv("UNIXPW_DISABLE_SSL")) {
rfbLog("Skipping -ssl/-stunnel requirement"
" due to\n");
rfbLog("UNIXPW_DISABLE_SSL setting.\n");
} else {
if (openssl_present()) {
rfbLog("set -ssl in -unixpw mode.\n");
......@@ -3175,6 +3179,10 @@ int main(int argc, char* argv[]) {
ncache = 0;
ncache_msg = 0;
}
if (subwin) {
ncache = 0;
ncache_msg = 0;
}
}
if (raw_fb_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.9.3 lastmod: 2007-07-03";
char lastmod[] = "0.9.3 lastmod: 2007-08-03";
/* X display info */
......
......@@ -792,6 +792,7 @@ void check_xevents(int reset) {
static time_t last_time_sync = 0;
time_t now = time(NULL);
static double last_request = 0.0;
static double last_xrefresh = 0.0;
XErrorHandler old_handler;
if (unixpw_in_progress) return;
......@@ -836,6 +837,31 @@ void check_xevents(int reset) {
}
}
if (have_clients && xrefresh > 0.0 && dnow() > last_xrefresh + xrefresh) {
XSetWindowAttributes swa;
Visual visual;
Window xrf;
unsigned long mask;
swa.override_redirect = True;
swa.backing_store = NotUseful;
swa.save_under = False;
swa.background_pixmap = None;
visual.visualid = CopyFromParent;
mask = (CWOverrideRedirect|CWBackingStore|CWSaveUnder|CWBackPixmap);
xrf = XCreateWindow(dpy, window, coff_x, coff_y, dpy_x, dpy_y, 0, CopyFromParent,
InputOutput, &visual, mask, &swa);
if (xrf != None) {
if (0) fprintf(stderr, "XCreateWindow(%d, %d, %d, %d) 0x%lx\n", coff_x, coff_y, dpy_x, dpy_y, xrf);
XMapWindow(dpy, xrf);
XFlush_wr(dpy);
XDestroyWindow(dpy, xrf);
XFlush_wr(dpy);
}
last_xrefresh = dnow();
}
if (now > last_call+1) {
/* we only check these once a second or so. */
int n = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment