diff options
author | runge <runge> | 2007-03-13 23:06:38 +0000 |
---|---|---|
committer | runge <runge> | 2007-03-13 23:06:38 +0000 |
commit | 15f792bc2185d9317b0a35855b15759520877ee9 (patch) | |
tree | 0435ffea43b1208ba1b53fba92f503e2d7a950f1 /x11vnc/x11vnc.c | |
parent | 0d4870c0a0da2680d60cd2b91b0541af2558d640 (diff) | |
download | libtdevnc-15f792bc2185d9317b0a35855b15759520877ee9.tar.gz libtdevnc-15f792bc2185d9317b0a35855b15759520877ee9.zip |
x11vnc: fix crash for kde dcop. limit ncache beta tester to 96MB viewers.
Diffstat (limited to 'x11vnc/x11vnc.c')
-rw-r--r-- | x11vnc/x11vnc.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 0b292ba..5c0dc02 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -75,7 +75,7 @@ * extensions exists that allow drawing the mouse into the framebuffer) * * The current *position* of the remote X mouse pointer is shown with - * the -cursor option. Further, if -cursorX or -X is used, a trick + * the -cursor option. Further, if -cursor X is used, a trick * is done to at least show the root window cursor vs non-root cursor. * (perhaps some heuristic can be done to further distinguish cases..., * currently "-cursor some" is a first hack at this) @@ -3266,6 +3266,23 @@ int main(int argc, char* argv[]) { scr = DefaultScreen(dpy); rootwin = RootWindow(dpy, scr); + if (ncache_beta_tester) { + int h = DisplayHeight(dpy, scr); + int w = DisplayWidth(dpy, scr); + int mem = (w * h * 4) / (1000 * 1000), MEM = 96; + if (mem < 1) mem = 1; + + /* limit poor, unsuspecting beta tester's viewer to 96 MB */ + if ( (ncache+2) * mem > MEM ) { + int n = (MEM/mem) - 2; + if (n < 0) n = 0; + n = 2 * (n / 2); + if (n < ncache) { + ncache = n; + } + } + } + if (grab_always) { Window save = window; window = rootwin; @@ -3533,7 +3550,7 @@ int main(int argc, char* argv[]) { rfbLog(" iconifying/deiconifying windows, moving and raising\n"); rfbLog(" windows, and reposting menus. In the simple CopyRect\n"); rfbLog(" encoding scheme used (no compression) a huge amount\n"); - rfbLog(" of extra memory (20-80MB) is used on both the server and\n"); + rfbLog(" of extra memory (20-100MB) is used on both the server and\n"); rfbLog(" client sides. This mode works with any VNC viewer.\n"); rfbLog(" However, in most you can actually see the cached pixel\n"); rfbLog(" data by scrolling down, so you need to re-adjust its size.\n"); |