From 8aa6fb9523957c7f4a3f14fb2c90ea9f9292a41f Mon Sep 17 00:00:00 2001 From: runge Date: Sun, 17 Dec 2006 23:34:25 +0000 Subject: x11vnc: first pass at client-side caching, -ncache option. --- x11vnc/remote.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'x11vnc/remote.c') diff --git a/x11vnc/remote.c b/x11vnc/remote.c index 736c8f9..df3b86d 100644 --- a/x11vnc/remote.c +++ b/x11vnc/remote.c @@ -25,6 +25,7 @@ #include "selection.h" #include "unixpw.h" #include "uinput.h" +#include "userinput.h" int send_remote_cmd(char *cmd, int query, int wait); int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync, @@ -335,6 +336,13 @@ int check_httpdir(void) { } else { snprintf(httpdir, len, "%s/../share/x11vnc/classes", prog); } + if (stat(httpdir, &sbuf) != 0) { + if (use_openssl || use_stunnel || http_ssl) { + snprintf(httpdir, len, "%s/../classes/ssl", prog); + } else { + snprintf(httpdir, len, "%s/../classes", prog); + } + } free(prog); if (stat(httpdir, &sbuf) == 0) { @@ -749,7 +757,35 @@ char *process_remote_cmd(char *cmd, int stringonly) { /* * Maybe add: passwdfile logfile bg rfbauth passwd... */ - if (!strcmp(p, "stop") || !strcmp(p, "quit") || + if (strstr(p, "CR:") == p) { /* skip-cmd-list */ + /* CR:WxH+X+Y,dx,dy */ + int w, h, x, y, dx, dy; + NOTAPP + if (sscanf(p+3, "%dx%d+%d+%d,%d,%d", &w, &h, &x, &y, &dx, &dy) == 6) { + sraRegionPtr r; + rfbLog("rfbDoCopyRect(screen, %d, %d, %d, %d, %d, %d)\n", x, y, x+w, y+h, dx, dy); + r = sraRgnCreateRect(x, y, x+w, y+h); + do_copyregion(r, dx, dy); + fb_push(); + sraRgnDestroy(r); + rfbLog("did\n"); + } else { + rfbLog("remote_cmd: bad CR string: %s\n", p); + } + } else if (strstr(p, "ncache") == p) { /* skip-cmd-list */ + COLON_CHECK("ncache:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%d", p, co, ncache); + goto qry; + } + p += strlen("ncache:"); + ncache = atoi(p); + if (ncache % 2 != 0) { + ncache++; + } + rfbLog("remote_cmd: set -ncache %d\n", ncache); + + } else if (!strcmp(p, "stop") || !strcmp(p, "quit") || !strcmp(p, "exit") || !strcmp(p, "shutdown")) { NOTAPP if (client_connect_file) { -- cgit v1.2.1