some -ncache performance improvements, rootpixmap watching, gnome wm heuristics

pull/1/head
runge 17 years ago
parent 5b3e420c1f
commit 7717d245af

@ -1,5 +1,5 @@
x11vnc README file Date: Tue Jan 9 09:38:28 EST 2007
x11vnc README file Date: Wed Jan 10 12:06:50 EST 2007
The following information is taken from these URLs:
@ -1145,7 +1145,8 @@ make
[201]Q-62: How can I make x11vnc use MORE system resources?
[202]Q-63: I use x11vnc over a slow link with high latency (e.g.
dialup modem), is there anything I can do to speed things up?
dialup modem or broadband), is there anything I can do to speed things
up?
[203]Q-64: Does x11vnc support the X DAMAGE Xserver extension to find
modified regions of the screen quickly and efficiently?
@ -4070,7 +4071,7 @@ ied)
Q-63: I use x11vnc over a slow link with high latency (e.g. dialup
modem), is there anything I can do to speed things up?
modem or broadband), is there anything I can do to speed things up?
Some things you might want to experiment with (many of which will help
performance on faster links as well):
@ -9349,7 +9350,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2007-01-09
x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2007-01-10
x11vnc options:
-display disp -auth file -id windowid
@ -9396,33 +9397,34 @@ x11vnc options:
-nocursorpos -xwarppointer -noxwarppointer
-buttonmap string -nodragging -ncache n
-ncache_cr -ncache_no_moveraise -ncache_no_dtchange
-ncache_pad n -wireframe [str] -nowireframe
-nowireframelocal -wirecopyrect mode -nowirecopyrect
-debug_wireframe -scrollcopyrect mode -noscrollcopyrect
-scr_area n -scr_skip list -scr_inc list
-scr_keys list -scr_term list -scr_keyrepeat lo-hi
-scr_parms string -fixscreen string -debug_scroll
-noxrecord -grab_buster -nograb_buster
-debug_grabs -debug_sel -pointer_mode n
-input_skip n -allinput -speeds rd,bw,lat
-wmdt string -debug_pointer -debug_keyboard
-defer time -wait time -wait_ui factor
-nowait_bog -slow_fb time -readtimeout n
-nap -nonap -sb time
-nofbpm -fbpm -nodpms
-dpms -noxdamage -xd_area A
-xd_mem f -sigpipe string -threads
-nothreads -fs f -gaps n
-grow n -fuzz n -debug_tiles
-snapfb -rawfb string -freqtab file
-pipeinput cmd -macnodim -macnosleep
-macnosaver -macnowait -macwheel n
-macnoswap -macnoresize -maciconanim n
-macmenu -gui [gui-opts] -remote command
-query variable -QD variable -sync
-noremote -yesremote -unsafe
-safer -privremote -nocmds
-allowedcmds list -deny_all
-ncache_no_rootpixmap -ncache_pad n -wireframe [str]
-nowireframe -nowireframelocal -wirecopyrect mode
-nowirecopyrect -debug_wireframe -scrollcopyrect mode
-noscrollcopyrect -scr_area n -scr_skip list
-scr_inc list -scr_keys list -scr_term list
-scr_keyrepeat lo-hi -scr_parms string -fixscreen string
-debug_scroll -noxrecord -grab_buster
-nograb_buster -debug_grabs -debug_sel
-pointer_mode n -input_skip n -allinput
-speeds rd,bw,lat -wmdt string -debug_pointer
-debug_keyboard -defer time -wait time
-wait_ui factor -nowait_bog -slow_fb time
-readtimeout n -nap -nonap
-sb time -nofbpm -fbpm
-nodpms -dpms -noxdamage
-xd_area A -xd_mem f -sigpipe string
-threads -nothreads -fs f
-gaps n -grow n -fuzz n
-debug_tiles -snapfb -rawfb string
-freqtab file -pipeinput cmd -macnodim
-macnosleep -macnosaver -macnowait
-macwheel n -macnoswap -macnoresize
-maciconanim n -macmenu -gui [gui-opts]
-remote command -query variable -QD variable
-sync -noremote -yesremote
-unsafe -safer -privremote
-nocmds -allowedcmds list -deny_all
libvncserver options:
-rfbport port TCP port for RFB protocol
@ -9456,7 +9458,7 @@ libvncserver-tight-extension options:
% x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2007-01-09
x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2007-01-10
(type "x11vnc -opts" to just list the options.)
@ -11501,6 +11503,10 @@ Options:
workarea). The default is to try to guess and when
detected try to make the transistion more smoothly.
-ncache_no_rootpixmap In -ncache mode, do not try to snapshot the desktop
background to use in guessing or reconstructing window
save-unders..
-ncache_pad n In -ncache mode, pad each window with n pixels for the
caching rectangles. This can be used to try to improve
the situation with dropshadows or other compositing
@ -12758,8 +12764,13 @@ n
ncache_size:n set -ncache size to n.
ncache_cr enable -ncache_cr mode.
noncache_cr disable -ncache_cr mode.
ncache_no_moveraise enable no_moveraise mode.
noncache_no_moveraise disable no_moveraise mode.
ncache_no_moveraise enable no_moveraise mode.
noncache_no_moveraise disable no_moveraise mode.
ncache_no_dtchange enable ncache_no_dtchange mode.
noncache_no_dtchange disable ncache_no_dtchange mode.
ncache_no_rootpixmap enable ncache_no_rootpixmap.
noncache_no_rootpixmap disable ncache_no_rootpixmap.
ncache_reset_rootpixmap recheck the root pixmap
wireframe enable -wireframe mode. same as "wf"
nowireframe disable -wireframe mode. same as "nowf"
wireframe:str enable -wireframe mode string.
@ -12921,29 +12932,31 @@ n
bell nobell sel nosel primary noprimary setprimary
nosetprimary clipboard noclipboard setclipboard
nosetclipboard seldir cursorshape nocursorshape
cursorpos nocursorpos cursor_drag nocursor_drag
cursor show_cursor noshow_cursor nocursor arrow
xfixes noxfixes xdamage noxdamage xd_area xd_mem
alphacut alphafrac alpharemove noalpharemove alphablend
noalphablend xwarppointer xwarp noxwarppointer noxwarp
buttonmap dragging nodragging ncache_cr noncache_cr
ncache_no_moveraise noncache_no_moveraise ncache
noncache ncache_size 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 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 fs gaps grow fuzz snapfb nosnapfb rawfb
uinput_accel uinput_thresh uinput_reset uinput_always
progressive rfbport http nohttp httpport httpdir
enablehttpproxy noenablehttpproxy alwaysshared
cursorpos nocursorpos cursor_drag nocursor_drag cursor
show_cursor noshow_cursor nocursor arrow xfixes
noxfixes xdamage noxdamage xd_area xd_mem alphacut
alphafrac alpharemove noalpharemove alphablend
noalphablend xwarppointer xwarp noxwarppointer
noxwarp buttonmap dragging nodragging ncache_cr
noncache_cr ncache_no_moveraise noncache_no_moveraise
ncache_no_dtchange noncache_no_dtchange
ncache_no_rootpixmap noncache_no_rootpixmap
ncache_reset_rootpixmap ncache noncache ncache_size
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
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 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
nodontdisconnect desktop debug_xevents nodebug_xevents
debug_xevents debug_xdamage nodebug_xdamage

@ -2079,6 +2079,10 @@ void print_help(int mode) {
" workarea). The default is to try to guess and when\n"
" detected try to make the transistion more smoothly.\n"
"\n"
"-ncache_no_rootpixmap In -ncache mode, do not try to snapshot the desktop\n"
" background to use in guessing or reconstructing window\n"
" save-unders..\n"
"\n"
"-ncache_pad n In -ncache mode, pad each window with n pixels for the\n"
" caching rectangles. This can be used to try to improve\n"
" the situation with dropshadows or other compositing\n"
@ -3344,8 +3348,13 @@ void print_help(int mode) {
" ncache_size:n set -ncache size to n.\n"
" ncache_cr enable -ncache_cr mode.\n"
" noncache_cr disable -ncache_cr mode.\n"
" ncache_no_moveraise enable no_moveraise mode.\n"
" noncache_no_moveraise disable no_moveraise mode.\n"
" ncache_no_moveraise enable no_moveraise mode.\n"
" noncache_no_moveraise disable no_moveraise mode.\n"
" ncache_no_dtchange enable ncache_no_dtchange mode.\n"
" noncache_no_dtchange disable ncache_no_dtchange mode.\n"
" ncache_no_rootpixmap enable ncache_no_rootpixmap.\n"
" noncache_no_rootpixmap disable ncache_no_rootpixmap.\n"
" ncache_reset_rootpixmap recheck the root pixmap\n"
" wireframe enable -wireframe mode. same as \"wf\"\n"
" nowireframe disable -wireframe mode. same as \"nowf\"\n"
" wireframe:str enable -wireframe mode string.\n"
@ -3505,29 +3514,31 @@ void print_help(int mode) {
" bell nobell sel nosel primary noprimary setprimary\n"
" nosetprimary clipboard noclipboard setclipboard\n"
" nosetclipboard seldir cursorshape nocursorshape\n"
" cursorpos nocursorpos cursor_drag nocursor_drag\n"
" cursor show_cursor noshow_cursor nocursor arrow\n"
" xfixes noxfixes xdamage noxdamage xd_area xd_mem\n"
" alphacut alphafrac alpharemove noalpharemove alphablend\n"
" noalphablend xwarppointer xwarp noxwarppointer noxwarp\n"
" buttonmap dragging nodragging ncache_cr noncache_cr\n"
" ncache_no_moveraise noncache_no_moveraise ncache\n"
" noncache ncache_size wireframe_mode wireframe wf\n"
" nowireframe nowf wireframelocal wfl nowireframelocal\n"
" nowfl wirecopyrect wcr nowirecopyrect nowcr scr_area\n"
" scr_skip scr_inc scr_keys scr_term scr_keyrepeat\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 client_input ssltimeout\n"
" speeds wmdt debug_pointer dp nodebug_pointer nodp\n"
" debug_keyboard dk nodebug_keyboard nodk deferupdate\n"
" defer wait_ui wait_bog nowait_bog slow_fb wait\n"
" readtimeout nap nonap sb screen_blank fbpm nofbpm\n"
" dpms nodpms fs gaps grow fuzz snapfb nosnapfb rawfb\n"
" uinput_accel uinput_thresh uinput_reset uinput_always\n"
" progressive rfbport http nohttp httpport httpdir\n"
" enablehttpproxy noenablehttpproxy alwaysshared\n"
" cursorpos nocursorpos cursor_drag nocursor_drag cursor\n"
" show_cursor noshow_cursor nocursor arrow xfixes\n"
" noxfixes xdamage noxdamage xd_area xd_mem alphacut\n"
" alphafrac alpharemove noalpharemove alphablend\n"
" noalphablend xwarppointer xwarp noxwarppointer\n"
" noxwarp buttonmap dragging nodragging ncache_cr\n"
" noncache_cr ncache_no_moveraise noncache_no_moveraise\n"
" ncache_no_dtchange noncache_no_dtchange\n"
" ncache_no_rootpixmap noncache_no_rootpixmap\n"
" ncache_reset_rootpixmap ncache noncache ncache_size\n"
" wireframe_mode wireframe wf nowireframe nowf\n"
" wireframelocal wfl nowireframelocal nowfl wirecopyrect\n"
" wcr nowirecopyrect nowcr scr_area scr_skip scr_inc\n"
" scr_keys scr_term scr_keyrepeat scr_parms scrollcopyrect\n"
" scr noscrollcopyrect noscr fixscreen noxrecord xrecord\n"
" reset_record pointer_mode pm input_skip allinput\n"
" noallinput input grabkbd nograbkbd grabptr nograbptr\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 wait readtimeout nap nonap sb screen_blank\n"
" fbpm nofbpm dpms nodpms 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"
" nodontdisconnect desktop debug_xevents nodebug_xevents\n"
" debug_xevents debug_xdamage nodebug_xdamage\n"

@ -208,7 +208,10 @@ int ncache_pad = 24;
int ncache = NCACHE;
int ncache_pad = 0;
#endif
int ncache_xrootpmap = 1;
#ifndef NCACHE_XROOTPMAP
#define NCACHE_XROOTPMAP 1
#endif
int ncache_xrootpmap = NCACHE_XROOTPMAP;
int ncache0 = 0;
int ncache_copyrect = 0;
int ncache_wf_raises = 1;
@ -219,9 +222,11 @@ int ncache_beta_tester = 0;
Atom atom_NET_ACTIVE_WINDOW = None;
Atom atom_NET_CURRENT_DESKTOP = None;
Atom atom_NET_CLIENT_LIST_STACKING = None;
Atom atom_XROOTPMAP_ID = None;
double got_NET_ACTIVE_WINDOW = 0.0;
double got_NET_CURRENT_DESKTOP = 0.0;
double got_NET_CLIENT_LIST_STACKING = 0.0;
double got_XROOTPMAP_ID = 0.0;
/* T+B+L+R,tkey+presist_key,tmouse+persist_mouse */
char *scroll_copyrect_str = NULL;

@ -169,9 +169,11 @@ extern int ncache_beta_tester;
extern Atom atom_NET_ACTIVE_WINDOW;
extern Atom atom_NET_CURRENT_DESKTOP;
extern Atom atom_NET_CLIENT_LIST_STACKING;
extern Atom atom_XROOTPMAP_ID;
extern double got_NET_ACTIVE_WINDOW;
extern double got_NET_CURRENT_DESKTOP;
extern double got_NET_CLIENT_LIST_STACKING;
extern double got_XROOTPMAP_ID;
extern char *scroll_copyrect_str;
extern char *scroll_copyrect;

@ -2779,6 +2779,40 @@ char *process_remote_cmd(char *cmd, int stringonly) {
ncache_dt_change = 1;
rfbLog("remote_cmd: disabled -ncache_no_dt_change\n");
} else if (!strcmp(p, "ncache_no_rootpixmap")) {
int orig = ncache_xrootpmap;
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !ncache_xrootpmap);
goto qry;
}
ncache_xrootpmap = 0;
rfbLog("remote_cmd: set -ncache_no_rootpixmap\n");
if (orig != ncache_xrootpmap) {
do_new_fb(1);
}
} else if (!strcmp(p, "noncache_no_rootpixmap")) {
int orig = ncache_xrootpmap;
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, ncache_xrootpmap);
goto qry;
}
ncache_xrootpmap = 1;
rfbLog("remote_cmd: disabled -ncache_no_rootpixmap\n");
if (orig != ncache_xrootpmap) {
do_new_fb(1);
}
} else if (!strcmp(p, "ncache_reset_rootpixmap")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !ncache_xrootpmap);
goto qry;
}
if (ncache_xrootpmap) {
rfbLog("remote_cmd: resetting root pixmap.\n");
set_ncache_xrootpmap();
}
} else if (!strcmp(p, "ncache")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !!ncache);

@ -2846,11 +2846,15 @@ static int scan_display(int ystart, int rescan) {
y = ystart;
g_now = dnow();
if (! main_fb) {
rfbLog("scan_display: no main_fb!\n");
return 0;
}
X_LOCK;
while (y < dpy_y) {
if (use_xdamage) {
@ -2863,7 +2867,6 @@ static int scan_display(int ystart, int rescan) {
}
/* grab the horizontal scanline from the display: */
X_LOCK;
#ifndef NO_NCACHE
/* XXX Y test */
@ -2878,12 +2881,18 @@ if (ncache > 0) {
XEvent ev;
if (raw_fb_str) {
;
} else if (XEventsQueued(dpy, QueuedAlready) == 0) {
; /* XXX Y resp */
} else if (XCheckTypedEvent(dpy, MapNotify, &ev)) {
gotone = 1;
} else if (XCheckTypedEvent(dpy, UnmapNotify, &ev)) {
gotone = 2;
} else if (XCheckTypedEvent(dpy, CreateNotify, &ev)) {
gotone = 3;
} else if (XCheckTypedEvent(dpy, ConfigureNotify, &ev)) {
gotone = 4;
} else if (XCheckTypedEvent(dpy, VisibilityNotify, &ev)) {
gotone = 5;
}
if (gotone) {
XPutBackEvent(dpy, &ev);
@ -2909,7 +2918,6 @@ fprintf(stderr, "\n*** SCAN_DISPLAY CHECK_NCACHE/%d *** %d rescan=%d\n", gotone,
XRANDR_SET_TRAP_RET(-1, "scan_display-set");
copy_image(scanline, 0, y, 0, 0);
XRANDR_CHK_TRAP_RET(-1, "scan_display-chk");
X_UNLOCK;
/* for better memory i/o try the whole line at once */
src = scanline->data;
@ -2979,6 +2987,9 @@ fprintf(stderr, "\n*** SCAN_DISPLAY CHECK_NCACHE/%d *** %d rescan=%d\n", gotone,
}
y += NSCAN;
}
X_UNLOCK;
return tile_count;
}

@ -746,6 +746,9 @@ void do_new_fb(int reset_mem) {
initialize_blackouts_and_xinerama();
initialize_polling_images();
}
if (ncache) {
check_ncache(1, 0);
}
}
static void remove_fake_fb(void) {

@ -55,6 +55,8 @@ catch {rename send {}}
# 0 means to skip the item.
# -- means add a separator
#
# The =GAL ... =GAL LOFF stuff is to provide submenus.
#
global env started time_count
set started ""
@ -366,6 +368,8 @@ Tuning
ncache_cr
ncache_no_moveraise
ncache_no_dtchange
ncache_no_rootpixmap
=A ncache_reset_rootpixmap
=GAL LOFF
--
=GAL SharedMemory::

@ -66,6 +66,8 @@ char gui_code[] = "";
"# 0 means to skip the item.\n"
"# -- means add a separator\n"
"#\n"
"# The =GAL ... =GAL LOFF stuff is to provide submenus.\n"
"#\n"
"\n"
"global env started time_count\n"
"set started \"\"\n"
@ -377,6 +379,8 @@ char gui_code[] = "";
" ncache_cr\n"
" ncache_no_moveraise\n"
" ncache_no_dtchange\n"
" ncache_no_rootpixmap\n"
" =A ncache_reset_rootpixmap\n"
" =GAL LOFF\n"
" --\n"
" =GAL SharedMemory::\n"

@ -66,6 +66,8 @@ int bs_restore(int idx, int *nbatch, sraRegionPtr rmask, XWindowAttributes *attr
int try_to_fix_su(Window win, int idx, Window above, int *nbatch, char *mode);
int try_to_fix_resize_su(Window orig_frame, int orig_x, int orig_y, int orig_w, int orig_h,
int x, int y, int w, int h, int try_batch);
int lookup_win_index(Window);
void set_ncache_xrootpmap(void);
static void get_client_regions(int *req, int *mod, int *cpy, int *num) ;
static void parse_scroll_copyrect_str(char *scr);
@ -93,7 +95,6 @@ static void check_user_input3(double dt, double dtr, int tile_diffs);
static void check_user_input4(double dt, double dtr, int tile_diffs);
winattr_t *cache_list;
int lookup_win_index(Window);
/*
* For -wireframe: find the direct child of rootwin that has the
@ -1977,8 +1978,6 @@ void batch_copyregion(sraRegionPtr* region, int *dx, int *dy, int ncr, double de
int k, direct, mode, nrects = 0, bad = 0;
double start = dnow();
/* XXX Y */
for (k=0; k < ncr; k++) {
sraRectangleIterator *iter;
sraRect rect;
@ -2012,13 +2011,28 @@ void batch_copyregion(sraRegionPtr* region, int *dx, int *dy, int ncr, double de
}
fb_push_wait(delay, FB_COPY|FB_MOD);
#if 0
i = rfbGetClientIterator(screen);
while( (cl = rfbClientIteratorNext(i)) ) {
if (cl->ublen != 0) {
fprintf(stderr, "batch_copyregion: *** BAD ublen != 0: %d\n", cl->ublen);
bad++;
}
}
rfbReleaseClientIterator(i);
if (bad) {
return;
}
#endif
i = rfbGetClientIterator(screen);
while( (cl = rfbClientIteratorNext(i)) ) {
rfbFramebufferUpdateMsg *fu = (rfbFramebufferUpdateMsg *)cl->updateBuf;
fu->nRects = Swap16IfLE((uint16_t)(nrects));
fu->type = rfbFramebufferUpdate;
if (cl->ublen != 0) fprintf(stderr, "batch_copyregion: *** ublen != 0: %d\n", cl->ublen);
if (cl->ublen != 0) fprintf(stderr, "batch_copyregion: *** BAD ublen != 0: %d\n", cl->ublen);
cl->ublen = sz_rfbFramebufferUpdateMsg;
}
@ -2091,9 +2105,6 @@ void fb_push(void) {
rfbClientIteratorPtr i;
rfbClientPtr cl;
/* XXX Y */
db = 0;
if (db) get_client_regions(&req0, &mod0, &cpy0, &ncli);
i = rfbGetClientIterator(screen);
@ -5605,6 +5616,9 @@ int try_to_fix_resize_su(Window orig_frame, int orig_x, int orig_y, int orig_w,
if (!orig_frame || !orig_x || !orig_y || !orig_w || !orig_h || !x || !y || !w || !h || !try_batch) {}
return 0;
}
void set_ncache_xrootpmap(void) {
return;
}
#else
/* maybe ncache.c it if works */
@ -6673,7 +6687,7 @@ fprintf(stderr, "free_rect: bad index: %d\n", idx);
if (w * h > fac2 * (dpy_x * dpy_y)) {
big2 = 1;
}
/* XXX Y */
if (nobigs < 0) {
if (getenv("NOBIGS")) {
nobigs = 1;
@ -7965,12 +7979,38 @@ sraRegionPtr idx_create_rgn(sraRegionPtr r0, int idx) {
return rtmp;
}
void scale_mark_xrootpmap(void) {
char *dst_fb, *src_fb = main_fb;
int dst_bpl, Bpp = bpp/8, fac = 1;
int yn = (ncache+1) * dpy_y;
int yfac = (ncache+2);
int mark = 1;
if (!scaling || !rfb_fb || rfb_fb == main_fb) {
mark_rect_as_modified(0, yn, dpy_x, yn + dpy_y, 0);
return;
}
if (cmap8to24 && cmap8to24_fb) {
src_fb = cmap8to24_fb;
if (scaling && depth == 8) {
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, dst_fb, dst_bpl, dpy_x, yfac * dpy_y,
scaled_x, yfac * scaled_y, 0, yn, dpy_x, yn + dpy_y, mark);
}
void set_ncache_xrootpmap(void) {
Atom pmap, type;
int format;
unsigned long length, after;
XImage *image = NULL;
XErrorHandler old_handler;
RAWFB_RET_VOID
#if !NO_X11
@ -7978,6 +8018,8 @@ void set_ncache_xrootpmap(void) {
return;
}
X_LOCK;
old_handler = XSetErrorHandler(trap_xerror);
trapped_xerror = 0;
pmap = XInternAtom(dpy, "_XROOTPMAP_ID", True);
if (pmap != None) {
Pixmap pixmap;
@ -7992,6 +8034,12 @@ void set_ncache_xrootpmap(void) {
image = XGetImage(dpy, pixmap, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap);
}
}
if (!quiet) {
rfbLog("set_ncache_xrootpmap: loading background pixmap: 0x%lx\n", pixmap);
}
} else {
rfbLog("set_ncache_xrootpmap: trying root background\n");
}
if (image == NULL) {
image = solid_root((char *) 0x1);
@ -8011,10 +8059,12 @@ void set_ncache_xrootpmap(void) {
dst += main_bytes_per_line;
}
XDestroyImage(image);
scale_mark_xrootpmap();
} else {
int yn = (ncache+1) * dpy_y;
zero_fb(0, yn, dpy_x, yn + dpy_y);
}
XSetErrorHandler(old_handler);
X_UNLOCK;
#endif
}
@ -8229,7 +8279,7 @@ fprintf(stderr, "----- skip %s\n", Etype(type));
*n_in = n;
}
int try_to_synthesize_su(int force, int *nbatch) {
int try_to_synthesize_su(int force, int urgent, int *nbatch) {
int i, idx, idx2, n = 0;
sraRegionPtr r0, r1, r2;
Window win = None;
@ -8246,12 +8296,30 @@ int try_to_synthesize_su(int force, int *nbatch) {
X_LOCK;
for (i = old_stack_n - 1; i >= 0; i--) {
win = old_stack[i];
if (!valid_window(win, &attr, 1)) {
continue;
}
idx = lookup_win_index(win);
if (idx >= 0) {
STORE(idx, win, attr);
if (urgent) { /* XXX Y resp */
if (!valid_window(win, &attr, 1)) {
continue;
}
idx = lookup_win_index(win);
if (idx >= 0) {
STORE(idx, win, attr);
}
} else {
idx = lookup_win_index(win);
if (idx >= 0) {
attr.map_state = cache_list[idx].map_state;
attr.x = cache_list[idx].x;
attr.y = cache_list[idx].y;
attr.width = cache_list[idx].width;
attr.height = cache_list[idx].height;
} else {
attr.map_state = IsUnmapped;
attr.x = 0;
attr.y = 0;
attr.width = 0;
attr.height = 0;
}
}
if (attr.map_state != IsViewable) {
continue;
@ -8384,6 +8452,7 @@ static int saw_desktop_change = 0;
void check_sched(int try_batch, int *did_sched) {
static double last_root = 0.0;
static double last_pixmap = 0.0;
double refresh = 60.0;
int i, k, valid;
Window win;
@ -8504,10 +8573,12 @@ fprintf(stderr, "*SCHED LOOKUP FAIL: i=%d 0x%lx\n", i, win);
} else if (now > last_sched_vis + 3.0 && now > last_wireframe + 2.0) {
static double last_vis = 0.0;
int vis_now[32], top_now[32];
static int vis_prev[32];
static int vis_prev[32], freq = 0;
int diff, nv = 32, vis_now_n = 0;
Window win;
freq++;
for (i=0; i < cache_list_num; i++) {
int ok = 0;
int top_only = 1;
@ -8524,10 +8595,13 @@ fprintf(stderr, "*SCHED LOOKUP FAIL: i=%d 0x%lx\n", i, win);
if (win == None) {
continue;
}
if (!valid_window(win, &attr, 1)) {
continue;
/* XXX Y resp */
if (saw_desktop_change || freq % 5 == 0) {
if (!valid_window(win, &attr, 1)) {
continue;
}
STORE(i, win, attr);
}
STORE(i, win, attr);
if (!cache_list[i].valid) {
continue;
}
@ -8596,7 +8670,7 @@ fprintf(stderr, "*VIS BS_save: 0x%lx %d %d %d\n", win, cache_list[i].width, cac
saw_desktop_change = 0;
}
/* XXX Y */
try_to_synthesize_su(0, bat);
try_to_synthesize_su(0, 0, bat);
}
if (nr) {
@ -8604,6 +8678,19 @@ fprintf(stderr, "*VIS BS_save: 0x%lx %d %d %d\n", win, cache_list[i].width, cac
}
last_sched_bs = dnow();
}
#if !NO_X11
if (atom_XROOTPMAP_ID == None && now > last_pixmap + 5.0) {
atom_XROOTPMAP_ID = XInternAtom(dpy, "_XROOTPMAP_ID", True);
last_pixmap = now;
}
#endif
if (got_XROOTPMAP_ID > 0.0) {
fprintf(stderr, "got_XROOTPMAP_ID\n");
if (ncache_xrootpmap) {
set_ncache_xrootpmap();
}
got_XROOTPMAP_ID = 0.0;
}
}
int check_ncache(int reset, int mode) {
@ -8637,6 +8724,11 @@ int check_ncache(int reset, int mode) {
int skipwins_max = 256;
Window skipwins[256];
static char *dt_guess = NULL;
static double dt_last = 0.0;
int dt_gnome = 0, gnome_animation = 0;
int dt_kde = 0;
if (unixpw_in_progress) return -1;
#ifdef MACOSX
@ -8703,7 +8795,6 @@ if (c) fprintf(stderr, "check_ncache purged %d events\n", c);
rfbLog("check_ncache: resetting cache\n");
for (i=0; i < cache_list_num; i++) {
free_rect(i);
CLEAR(i);
}
for (n = 1; n <= ncache; n++) {
if (rect_reg[n] != NULL) {
@ -8807,6 +8898,19 @@ if (hack_val == 2) {
n = 0;
ttot = 0;
if (dt_guess == NULL || now > dt_last + 30) {
if (dt_guess) {
free(dt_guess);
}
dt_guess = strdup(guess_desktop());
dt_last = now;
}
if (dt_guess && !strcmp(dt_guess, "gnome")) {
dt_gnome = 1;
} else if (dt_guess && !strcmp(dt_guess, "kde")) {
dt_kde = 1;
}
ev_store(None, EV_RESET);
X_LOCK;
@ -9190,11 +9294,29 @@ fprintf(stderr, " CONF_IGNORE: Too many stacking changes: 0x%lx\n", win
}
}
if (ok) {
if (ev_lookup(ev.xconfigure.above, EV_UNMAP)) {
fprintf(stderr, " skip try_to_fix_su for GNOME deiconify #1\n");
if (dt_gnome) {
gnome_animation = 1;
}
ok = 0;
}
}
if (ok && dt_gnome) {
if (valid_window(ev.xconfigure.above, &attr, 1)) {
if (attr.map_state != IsViewable) {
fprintf(stderr, " skip try_to_fix_su for GNOME deiconify #2\n");
gnome_animation = 1;
ok = 0;
}
}
}
if (ok) {
int rc = try_to_fix_su(win, idx, ev.xconfigure.above, nbatch, NULL);
if (rc == 0 && su_fix_cnt == 0 && n_MN == 0 && n_UN == 0) {
X_UNLOCK;
try_to_synthesize_su(1, nbatch);
try_to_synthesize_su(1, 1, nbatch);
X_LOCK;
}
n_ST++;
@ -9232,6 +9354,37 @@ fprintf(stderr, "----%02d: VisibilityNotify 0x%lx %3d state: %s U/P %d/%d\n",
ok = 0;
} else if (ev_lookup(win, EV_DESTROY)) {
ok = 0;
} else if (gnome_animation) {
ok = 0;
} else {
/* this is for gnome iconify */
int i2;
for (i2=i+1; i2 < n; i2++) {
int idx2, ik2 = Ev_order[i2];
sraRegionPtr ro1, ro2;
Window win2 = Ev_unmap[ik2];
if (win2 == None) {
continue;
}
idx2 = lookup_win_index(win2);
if (idx2 < 0) {
continue;
}
ro1 = idx_create_rgn(r0, idx);
ro2 = idx_create_rgn(r0, idx2);
if (sraRgnAnd(ro1, ro2)) {
fprintf(stderr, " skip VisibilityUnobscured for GNOME iconify.\n");
ok = 0;
}
sraRgnDestroy(ro1);
sraRgnDestroy(ro2);
if (! ok) {
break;
}
}
}
if (ok) {
int x2, y2, w2, h2;

@ -39,5 +39,7 @@ extern void do_copyregion(sraRegionPtr region, int dx, int dy, int mode);
extern int check_ncache(int reset, int mode);
extern int find_rect(int idx, int x, int y, int w, int h);
extern int lookup_win_index(Window);
extern void set_ncache_xrootpmap(void);
#endif /* _X11VNC_USERINPUT_H */

@ -2,7 +2,7 @@
.TH X11VNC "1" "January 2007" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.8.4, lastmod: 2007-01-09
version: 0.8.4, lastmod: 2007-01-10
.SH SYNOPSIS
.B x11vnc
[OPTION]...
@ -2448,6 +2448,12 @@ In \fB-ncache\fR mode, do not try to guess when the desktop
workarea). The default is to try to guess and when
detected try to make the transistion more smoothly.
.PP
\fB-ncache_no_rootpixmap\fR
.IP
In \fB-ncache\fR mode, do not try to snapshot the desktop
background to use in guessing or reconstructing window
save-unders..
.PP
\fB-ncache_pad\fR \fIn\fR
.IP
In \fB-ncache\fR mode, pad each window with n pixels for the
@ -4020,9 +4026,19 @@ ncache_cr enable \fB-ncache_cr\fR mode.
.IP
noncache_cr disable \fB-ncache_cr\fR mode.
.IP
ncache_no_moveraise enable no_moveraise mode.
ncache_no_moveraise enable no_moveraise mode.
.IP
noncache_no_moveraise disable no_moveraise mode.
.IP
ncache_no_dtchange enable ncache_no_dtchange mode.
.IP
noncache_no_dtchange disable ncache_no_dtchange mode.
.IP
ncache_no_rootpixmap enable ncache_no_rootpixmap.
.IP
noncache_no_rootpixmap disable ncache_no_rootpixmap.
.IP
noncache_no_moveraise disable no_moveraise mode.
ncache_reset_rootpixmap recheck the root pixmap
.IP
wireframe enable \fB-wireframe\fR mode. same as "wf"
.IP
@ -4300,29 +4316,31 @@ clear_keys noclear_keys remap repeat norepeat fb nofb
bell nobell sel nosel primary noprimary setprimary
nosetprimary clipboard noclipboard setclipboard
nosetclipboard seldir cursorshape nocursorshape
cursorpos nocursorpos cursor_drag nocursor_drag
cursor show_cursor noshow_cursor nocursor arrow
xfixes noxfixes xdamage noxdamage xd_area xd_mem
alphacut alphafrac alpharemove noalpharemove alphablend
noalphablend xwarppointer xwarp noxwarppointer noxwarp
buttonmap dragging nodragging ncache_cr noncache_cr
ncache_no_moveraise noncache_no_moveraise ncache
noncache ncache_size 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 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 fs gaps grow fuzz snapfb nosnapfb rawfb
uinput_accel uinput_thresh uinput_reset uinput_always
progressive rfbport http nohttp httpport httpdir
enablehttpproxy noenablehttpproxy alwaysshared
cursorpos nocursorpos cursor_drag nocursor_drag cursor
show_cursor noshow_cursor nocursor arrow xfixes
noxfixes xdamage noxdamage xd_area xd_mem alphacut
alphafrac alpharemove noalpharemove alphablend
noalphablend xwarppointer xwarp noxwarppointer
noxwarp buttonmap dragging nodragging ncache_cr
noncache_cr ncache_no_moveraise noncache_no_moveraise
ncache_no_dtchange noncache_no_dtchange
ncache_no_rootpixmap noncache_no_rootpixmap
ncache_reset_rootpixmap ncache noncache ncache_size
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
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 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
nodontdisconnect desktop debug_xevents nodebug_xevents
debug_xevents debug_xdamage nodebug_xdamage

@ -2171,6 +2171,8 @@ int main(int argc, char* argv[]) {
ncache_wf_raises = 1;
} else if (!strcmp(arg, "-ncache_no_dtchange")) {
ncache_dt_change = 0;
} else if (!strcmp(arg, "-ncache_no_rootpixmap")) {
ncache_xrootpmap = 0;
} else if (!strcmp(arg, "-ncache_pad")) {
CHECK_ARGC
ncache_pad = atoi(argv[++i]);

@ -467,6 +467,7 @@ extern double last_copyrect_fix;
extern double last_wireframe;
extern double servertime_diff;
extern double x11vnc_start;
extern double g_now;
extern double last_get_wm_frame_time;
extern Window last_get_wm_frame;

@ -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.4 lastmod: 2007-01-09";
char lastmod[] = "0.8.4 lastmod: 2007-01-10";
/* X display info */
@ -131,6 +131,7 @@ double last_copyrect_fix = 0.0;
double last_wireframe = 0.0;
double servertime_diff = 0.0;
double x11vnc_start = 0.0;
double g_now = 0.0;
double last_get_wm_frame_time = 0.0;
Window last_get_wm_frame = None;

@ -542,6 +542,8 @@ if (0) XEventsQueued(dpy, QueuedAfterFlush);
int xdamage_hint_skip(int y) {
static sraRegionPtr scanline = NULL;
static sraRegionPtr tmpl_y = NULL;
int fast_tmpl = 1;
sraRegionPtr reg, tmpl;
int ret, i, n, nreg;
static int ncache_no_skip = 0;
@ -559,13 +561,16 @@ int xdamage_hint_skip(int y) {
/* keep it around to avoid malloc etc, recreate */
scanline = sraRgnCreate();
}
if (! tmpl_y) {
tmpl_y = sraRgnCreateRect(0, 0, dpy_x, 1);
}
nreg = (xdamage_memory * NSCAN) + 1;
#ifndef NO_NCACHE
if (ncache > 0) {
if (ncache_no_skip == 0) {
double now = dnow();
double now = g_now;
if (now > last_ncache_no_skip + 8.0) {
ncache_no_skip = 1;
} else if (now < last_bs_restore + 0.5) {
@ -595,7 +600,12 @@ int xdamage_hint_skip(int y) {
}
#endif
tmpl = sraRgnCreateRect(0, y, dpy_x, y+1);
if (fast_tmpl) {
sraRgnOffset(tmpl_y, 0, y);
tmpl = tmpl_y;
} else {
tmpl = sraRgnCreateRect(0, y, dpy_x, y+1);
}
ret = 1;
for (i=0; i<nreg; i++) {
@ -616,7 +626,11 @@ int xdamage_hint_skip(int y) {
break;
}
}
sraRgnDestroy(tmpl);
if (fast_tmpl) {
sraRgnOffset(tmpl_y, 0, -y);
} else {
sraRgnDestroy(tmpl);
}
if (0) fprintf(stderr, "xdamage_hint_skip: %d -> %d\n", y, ret);
return ret;

@ -602,13 +602,16 @@ void sync_tod_with_servertime(void) {
RAWFB_RET_VOID
if (atom_NET_ACTIVE_WINDOW == None) {
atom_NET_ACTIVE_WINDOW = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
atom_NET_ACTIVE_WINDOW = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", True);
}
if (atom_NET_CURRENT_DESKTOP == None) {
atom_NET_CURRENT_DESKTOP = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
atom_NET_CURRENT_DESKTOP = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", True);
}
if (atom_NET_CLIENT_LIST_STACKING == None) {
atom_NET_CLIENT_LIST_STACKING = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", False);
atom_NET_CLIENT_LIST_STACKING = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", True);
}
if (atom_XROOTPMAP_ID == None) {
atom_XROOTPMAP_ID = XInternAtom(dpy, "_XROOTPMAP_ID", True);
}
if (! ticker_atom) {
@ -755,6 +758,7 @@ void set_prop_atom(Atom atom) {
if (atom == atom_NET_ACTIVE_WINDOW) got_NET_ACTIVE_WINDOW = dnow();
if (atom == atom_NET_CURRENT_DESKTOP) got_NET_CURRENT_DESKTOP = dnow();
if (atom == atom_NET_CLIENT_LIST_STACKING) got_NET_CLIENT_LIST_STACKING = dnow();
if (atom == atom_XROOTPMAP_ID) got_XROOTPMAP_ID = dnow();
}
/*

@ -418,6 +418,9 @@ void zero_fb(int x1, int y1, int x2, int y2) {
#ifndef NO_NCACHE
if (ncache > 0) {
yfac = 1+ncache;
if (ncache_xrootpmap) {
yfac++;
}
}
#endif

@ -25,6 +25,7 @@ extern int known_xrandr_mode(char *s);
if (check_xrandr_event(y)) { \
trapped_getimage_xerror = 0; \
XSetErrorHandler(old_getimage_handler); \
X_UNLOCK; \
return(x); \
} \
}

Loading…
Cancel
Save