summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authordscho <dscho>2005-12-19 19:45:51 +0000
committerdscho <dscho>2005-12-19 19:45:51 +0000
commit1c26789eff7b22518fcfb942e3d5a36758fdca19 (patch)
tree0891f60a4ca30fe031ae6c7090251c1d750e970a /libvncserver
parent1b81e342cbed1b620dec7065b1c06b47df0b6d92 (diff)
downloadlibtdevnc-1c26789eff7b22518fcfb942e3d5a36758fdca19.tar.gz
libtdevnc-1c26789eff7b22518fcfb942e3d5a36758fdca19.zip
introduce -deferptrupdate (thanks Dave)
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/cargs.c8
-rw-r--r--libvncserver/main.c21
-rw-r--r--libvncserver/rfbserver.c18
3 files changed, 43 insertions, 4 deletions
diff --git a/libvncserver/cargs.c b/libvncserver/cargs.c
index 96b9f84..26f03d6 100644
--- a/libvncserver/cargs.c
+++ b/libvncserver/cargs.c
@@ -29,6 +29,8 @@ rfbUsage(void)
" (use plain-password as password, USE AT YOUR RISK)\n");
fprintf(stderr, "-deferupdate time time in ms to defer updates "
"(default 40)\n");
+ fprintf(stderr, "-deferptrupdate time time in ms to defer pointer updates"
+ " (default none)\n");
fprintf(stderr, "-desktop name VNC desktop name (default \"LibVNCServer\")\n");
fprintf(stderr, "-alwaysshared always treat new clients as shared\n");
fprintf(stderr, "-nevershared never treat new clients as shared\n");
@@ -104,6 +106,12 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
return FALSE;
}
rfbScreen->deferUpdateTime = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-deferptrupdate") == 0) { /* -deferptrupdate milliseconds */
+ if (i + 1 >= *argc) {
+ rfbUsage();
+ return FALSE;
+ }
+ rfbScreen->deferPtrUpdateTime = atoi(argv[++i]);
} else if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */
if (i + 1 >= *argc) {
rfbUsage();
diff --git a/libvncserver/main.c b/libvncserver/main.c
index cdf2bfc..41d70ea 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -931,6 +931,27 @@ rfbProcessEvents(rfbScreenInfoPtr screen,long usec)
}
}
}
+
+ if (!cl->viewOnly && cl->lastPtrX >= 0) {
+ if(cl->startPtrDeferring.tv_usec == 0) {
+ gettimeofday(&cl->startPtrDeferring,NULL);
+ if(cl->startPtrDeferring.tv_usec == 0)
+ cl->startPtrDeferring.tv_usec++;
+ } else {
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ if(tv.tv_sec < cl->startPtrDeferring.tv_sec /* at midnight */
+ || ((tv.tv_sec-cl->startPtrDeferring.tv_sec)*1000
+ +(tv.tv_usec-cl->startPtrDeferring.tv_usec)/1000)
+ > cl->screen->deferPtrUpdateTime) {
+ cl->startPtrDeferring.tv_usec = 0;
+ cl->screen->ptrAddEvent(cl->lastPtrButtons,
+ cl->lastPtrX,
+ cl->lastPtrY, cl);
+ cl->lastPtrX = -1;
+ }
+ }
+ }
clPrev=cl;
cl=rfbClientIteratorNext(i);
if(clPrev->sock==-1) {
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index 2b61375..e60aadc 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -353,6 +353,8 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen,
cl->extensions = NULL;
+ cl->lastPtrX = -1;
+
sprintf(pv,rfbProtocolVersionFormat,rfbProtocolMajorVersion,
rfbProtocolMinorVersion);
@@ -1071,11 +1073,19 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
cl->screen->pointerClient = cl;
if(!cl->viewOnly) {
- cl->screen->ptrAddEvent(msg.pe.buttonMask,
- Swap16IfLE(msg.pe.x), Swap16IfLE(msg.pe.y), cl);
- }
+ if (msg.pe.buttonMask != cl->lastPtrButtons ||
+ cl->screen->deferPtrUpdateTime == 0) {
+ cl->screen->ptrAddEvent(msg.pe.buttonMask,
+ Swap16IfLE(msg.pe.x), Swap16IfLE(msg.pe.y), cl);
+ cl->lastPtrButtons = msg.pe.buttonMask;
+ } else {
+ cl->lastPtrX = Swap16IfLE(msg.pe.x);
+ cl->lastPtrY = Swap16IfLE(msg.pe.y);
+ cl->lastPtrButtons = msg.pe.buttonMask;
+ }
+ }
+ return;
- return;
case rfbClientCutText: