Commit 4effb62e authored by runge's avatar runge

main.c: fix copyRect for non-cursor-shape-aware clients.

parent 813f4211
2005-05-30 Karl Runge <runge@karlrunge.com>
* libvncserver/main.c: fix copyRect for non-cursor-shape-aware clients.
2005-05-24 Karl Runge <runge@karlrunge.com>
* x11vnc: scrollcopyrect: GrabServer detection, autorepeat throttling..
* prepare_x11vnc_dist.sh: grep out new libvncserver-config line.
......
......@@ -130,6 +130,49 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
sraRgnAnd(modifiedRegionBackup,cl->copyRegion);
sraRgnOr(cl->modifiedRegion,modifiedRegionBackup);
sraRgnDestroy(modifiedRegionBackup);
if(!cl->enableCursorShapeUpdates) {
/*
* n.b. (dx, dy) is the vector pointing in the direction the
* copyrect displacement will take place. copyRegion is the
* destination rectangle (say), not the source rectangle.
*/
sraRegionPtr cursorRegion;
int x = cl->cursorX - cl->screen->cursor->xhot;
int y = cl->cursorY - cl->screen->cursor->yhot;
int w = cl->screen->cursor->width;
int h = cl->screen->cursor->height;
cursorRegion = sraRgnCreateRect(x, y, x + w, y + h);
sraRgnAnd(cursorRegion, cl->copyRegion);
if(!sraRgnEmpty(cursorRegion)) {
/*
* current cursor rect overlaps with the copy region *dest*,
* so remove it from the copy-rect treatment, and mark it as
* modified since we won't copy-rect stuff to it.
*/
sraRgnSubtract(cl->copyRegion, cursorRegion);
sraRgnOr(cl->modifiedRegion, cursorRegion);
}
sraRgnDestroy(cursorRegion);
cursorRegion = sraRgnCreateRect(x, y, x + w, y + h);
/* displace it to check for overlap with copy region source: */
sraRgnOffset(cursorRegion, dx, dy);
sraRgnAnd(cursorRegion, cl->copyRegion);
if(!sraRgnEmpty(cursorRegion)) {
/*
* current cursor rect overlaps with the copy region *source*,
* so remove it from the copy-rect treatment, and mark the
* *displaced* cursorRegion as modified since we won't copyrect
* stuff to it.
*/
sraRgnSubtract(cl->copyRegion, cursorRegion);
sraRgnOr(cl->modifiedRegion, cursorRegion);
}
sraRgnDestroy(cursorRegion);
}
} else {
sraRgnOr(cl->modifiedRegion,copyRegion);
}
......
2005-05-30 Karl Runge <runge@karlrunge.com>
* alter "magic cleanup key sequences" (N*Alt_L and N*Super_L)
* dial down check_xrecord_reset() reset times.
2005-05-24 Karl Runge <runge@karlrunge.com>
* more -scrollcopyrect: GrabServer detection, autorepeat throttling,
hack to clean screen 3,4,5 Alt_L in a row, mouse wheel detect.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "May 2005" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.7.2, lastmod: 2005-05-24
version: 0.7.2, lastmod: 2005-05-30
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -215,7 +215,8 @@ All VNC clients can only watch (default off).
.PP
\fB-shared\fR
.IP
VNC display is shared (default off).
VNC display is shared, i.e. more than one viewer can
connect at the same time (default off).
.PP
\fB-once\fR
.IP
......@@ -276,7 +277,8 @@ set to "host" or "host:port" establish a reverse
connection. Using
.IR xprop (1)
instead of vncconnect may
work (see the FAQ). Default: \fB-vncconnect\fR
work (see the FAQ). The \fB-remote\fR control mechanism also
uses this VNC_CONNECT channel. Default: \fB-vncconnect\fR
.PP
\fB-allow\fR \fIhost1[,host2..]\fR
.IP
......@@ -1097,7 +1099,8 @@ XCopyArea and XConfigureWindow X protocol requests).
Examples: Hitting <Return> in a terminal window when the
cursor was at the bottom, the text scrolls up one line.
Hitting <Down> arrow in a web browser window, the web
page scrolls up a small amount.
page scrolls up a small amount. Or scrolling with a
scrollbar or mouse wheel.
.IP
Shorter aliases: \fB-scr\fR [mode] and \fB-noscr\fR
.IP
......@@ -1113,6 +1116,17 @@ These are automatically repaired in a short period
of time. If this is unacceptable disable the feature
with \fB-noscrollcopyrect.\fR
.IP
Screen clearing kludges: for testing at least, there
are some "magic key sequences" (must be done in less
than 1 second) to aid repairing painting errors that
may be seen when using this mode:
.IP
3 Alt_L's in a row: resend whole screen,
4 Alt_L's in a row: reread and resend whole screen,
3 Super_L's in a row: mark whole screen for polling,
4 Super_L's in a row: reset RECORD context,
5 Super_L's in a row: try to push a black screen
.IP
"mode" can be "never" (same as \fB-noscrollcopyrect)\fR
to never try the copyrect, "keys" means to try it
in response to keystrokes only, "mouse" means to
......
......@@ -372,7 +372,7 @@ double xdamage_scheduled_mark = 0.0;
sraRegionPtr xdamage_scheduled_mark_region = NULL;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.7.2 lastmod: 2005-05-24";
char lastmod[] = "0.7.2 lastmod: 2005-05-30";
int hack_val = 0;
/* X display info */
......@@ -4232,9 +4232,9 @@ void shutdown_record_context(XRecordContext rc, int bequiet, int reopen) {
}
#endif
void check_xrecord_reset(void) {
void check_xrecord_reset(int force) {
static double last_reset = 0.0;
int reset_time = 120, reset_idle = 15;
int reset_time = 90, reset_idle = 10;
int reset_time2 = 600, reset_idle2 = 40;
double now;
XErrorHandler old_handler = NULL;
......@@ -4275,13 +4275,13 @@ void check_xrecord_reset(void) {
* try to wait for a break in input to reopen the displays
* this is only to avoid XGrabServer deadlock on the repopens.
*/
if (now < last_reset + reset_time) {
if (force) {
;
} else if (now < last_reset + reset_time) {
return;
}
if (now < last_pointer_click_time + reset_idle) {
} else if (now < last_pointer_click_time + reset_idle) {
return;
}
if (now < last_keyboard_time + reset_idle) {
} else if (now < last_keyboard_time + reset_idle) {
return;
}
X_LOCK;
......@@ -8973,7 +8973,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
char *str;
X_LOCK;
str = XKeysymToString(keysym);
rfbLog("keyboard(%s, 0x%x \"%s\") %.4f\n", down ? "down":"up",
rfbLog("# keyboard(%s, 0x%x \"%s\") %.4f\n", down ? "down":"up",
(int) keysym, str ? str : "null", tnow - x11vnc_start);
X_UNLOCK;
}
......@@ -9013,35 +9013,45 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
key_history[idx].down = down;
key_history[idx].time = tnow;
if (use_xdamage && down && skip_duplicate_key_events &&
if (down && skip_duplicate_key_events &&
(keysym == XK_Alt_L || keysym == XK_Super_L)) {
int i, k, run = 0;
double delay = 1.0;
KeySym ks;
for (i=0; i<16; i++) {
k = idx - i;
if (k < 0) k += KEY_HIST;
if (!key_history[k].down) {
continue;
}
ks = key_history[k].sym;
if (key_history[k].time < tnow - delay) {
break;
} else if (key_history[k].sym == XK_Alt_L) {
} else if (ks == keysym && ks == XK_Alt_L) {
run++;
} else if (key_history[k].sym == XK_Super_L) {
} else if (ks == keysym && ks == XK_Super_L) {
run++;
} else {
break;
}
}
if (run == 3) {
rfbLog("3*Alt_L, calling: set_xdamage_mark()\n");
set_xdamage_mark(0, 0, dpy_x, dpy_y);
} else if (run == 4) {
rfbLog("4*Alt_L, calling: refresh_screen(0)\n");
if (run == 3 && keysym == XK_Alt_L) {
rfbLog("3*Alt_L, calling: refresh_screen(0)\n");
refresh_screen(0);
} else if (run == 5) {
rfbLog("5*Alt_L, setting: do_copy_screen\n");
} else if (run == 4 && keysym == XK_Alt_L) {
rfbLog("4*Alt_L, setting: do_copy_screen\n");
do_copy_screen = 1;
} else if (run == 5 && keysym == XK_Alt_L) {
;
} else if (run == 3 && keysym == XK_Super_L) {
rfbLog("3*Super_L, calling: set_xdamage_mark()\n");
set_xdamage_mark(0, 0, dpy_x, dpy_y);
} else if (run == 4 && keysym == XK_Super_L) {
rfbLog("4*Super_L, calling: check_xrecord_reset()\n");
check_xrecord_reset(1);
} else if (run == 5 && keysym == XK_Super_L) {
rfbLog("5*Super_L, calling: push_black_screen(0)\n");
push_black_screen(0);
}
}
......@@ -9897,7 +9907,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
dt = tnow - last_pointer;
last_pointer = tnow;
if (show_motion) {
rfbLog("pointer(mask: 0x%x, x:%4d, y:%4d) "
rfbLog("# pointer(mask: 0x%x, x:%4d, y:%4d) "
"dx: %3d dy: %3d dt: %.4f t: %.4f\n", mask, x, y,
x - last_x, y - last_y, dt, tnow);
}
......@@ -25465,7 +25475,7 @@ if (db2) fprintf(stderr, " stack_work dt: %.4f\n", dt);
dtime0(&tm);
do_copyregion(shifted_region, dx, dy);
dt = dtime(&tm);
if (db2) fprintf(stderr, "do_copyregion: %d %d %d %d dx: %d dy: %d dt: %.4f\n",
if (0 || db2) fprintf(stderr, "do_copyregion: %d %d %d %d dx: %d dy: %d dt: %.4f\n",
tx1, ty1, tx2, ty2, dx, dy, dt);
sent_copyrect = 1;
}
......@@ -27470,7 +27480,7 @@ if (debug_scroll) fprintf(stderr, "watch_loop: LOOP-BACK: %d\n", ret);
check_connect_inputs();
check_padded_fb();
check_xdamage_state();
check_xrecord_reset();
check_xrecord_reset(0);
check_add_keysyms();
if (started_as_root) {
check_switched_user();
......@@ -27732,7 +27742,8 @@ static void print_help(int mode) {
" options apply here as well.\n"
"\n"
"-viewonly All VNC clients can only watch (default %s).\n"
"-shared VNC display is shared (default %s).\n"
"-shared VNC display is shared, i.e. more than one viewer can\n"
" connect at the same time (default %s).\n"
"-once Exit after the first successfully connected viewer\n"
" disconnects, opposite of -forever. This is the Default.\n"
"-forever Keep listening for more connections rather than exiting\n"
......@@ -27762,7 +27773,8 @@ static void print_help(int mode) {
"-novncconnect VNC program vncconnect(1). When the property is\n"
" set to \"host\" or \"host:port\" establish a reverse\n"
" connection. Using xprop(1) instead of vncconnect may\n"
" work (see the FAQ). Default: %s\n"
" work (see the FAQ). The -remote control mechanism also\n"
" uses this VNC_CONNECT channel. Default: %s\n"
"\n"
"-allow host1[,host2..] Only allow client connections from hosts matching\n"
" the comma separated list of hostnames or IP addresses.\n"
......@@ -28413,7 +28425,8 @@ static void print_help(int mode) {
" Examples: Hitting <Return> in a terminal window when the\n"
" cursor was at the bottom, the text scrolls up one line.\n"
" Hitting <Down> arrow in a web browser window, the web\n"
" page scrolls up a small amount.\n"
" page scrolls up a small amount. Or scrolling with a\n"
" scrollbar or mouse wheel.\n"
"\n"
" Shorter aliases: -scr [mode] and -noscr\n"
"\n"
......@@ -28429,6 +28442,17 @@ static void print_help(int mode) {
" of time. If this is unacceptable disable the feature\n"
" with -noscrollcopyrect.\n"
"\n"
" Screen clearing kludges: for testing at least, there\n"
" are some \"magic key sequences\" (must be done in less\n"
" than 1 second) to aid repairing painting errors that\n"
" may be seen when using this mode:\n"
"\n"
" 3 Alt_L's in a row: resend whole screen,\n"
" 4 Alt_L's in a row: reread and resend whole screen,\n"
" 3 Super_L's in a row: mark whole screen for polling,\n"
" 4 Super_L's in a row: reset RECORD context,\n"
" 5 Super_L's in a row: try to push a black screen\n"
"\n"
" \"mode\" can be \"never\" (same as -noscrollcopyrect)\n"
" to never try the copyrect, \"keys\" means to try it\n"
" in response to keystrokes only, \"mouse\" means to\n"
......
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