summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <dscho>2005-01-14 14:35:52 +0000
committerdscho <dscho>2005-01-14 14:35:52 +0000
commit2cd3c824c6422ae9cfc9dd8fcdbd5601c3edd9c0 (patch)
tree08de53ab0c9c36357828adbd189574773d6e6a1b
parentb9a8f19bb493c1070d6f7b355f3265782971d2d0 (diff)
downloadlibtdevnc-2cd3c824c6422ae9cfc9dd8fcdbd5601c3edd9c0.tar.gz
libtdevnc-2cd3c824c6422ae9cfc9dd8fcdbd5601c3edd9c0.zip
return value of rfbProcessEvents tells if an update was pending
-rw-r--r--libvncserver/main.c10
-rw-r--r--rfb/rfb.h5
2 files changed, 11 insertions, 4 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index 0c87d8e..7c29680 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -791,12 +791,13 @@ void gettimeofday(struct timeval* tv,char* dummy)
/* defined in rfbserver.c, but kind of "private" */
rfbClientPtr rfbClientIteratorHead(rfbClientIteratorPtr i);
-void
+rfbBool
rfbProcessEvents(rfbScreenInfoPtr screen,long usec)
{
rfbClientIteratorPtr i;
rfbClientPtr cl,clPrev;
struct timeval tv;
+ rfbBool result=FALSE;
if(usec<0)
usec=screen->deferUpdateTime*1000;
@@ -812,6 +813,7 @@ rfbProcessEvents(rfbScreenInfoPtr screen,long usec)
while(cl) {
if (cl->sock >= 0 && !cl->onHold && FB_UPDATE_PENDING(cl) &&
!sraRgnEmpty(cl->requestedRegion)) {
+ result=TRUE;
if(screen->deferUpdateTime == 0) {
rfbSendFramebufferUpdate(cl,cl->modifiedRegion);
} else if(cl->startDeferring.tv_usec == 0) {
@@ -831,10 +833,14 @@ rfbProcessEvents(rfbScreenInfoPtr screen,long usec)
}
clPrev=cl;
cl=rfbClientIteratorNext(i);
- if(clPrev->sock==-1)
+ if(clPrev->sock==-1) {
rfbClientConnectionGone(clPrev);
+ result=TRUE;
+ }
}
rfbReleaseClientIterator(i);
+
+ return result;
}
void rfbRunEventLoop(rfbScreenInfoPtr screen, long usec, rfbBool runInBackground)
diff --git a/rfb/rfb.h b/rfb/rfb.h
index dd61660..9364e8a 100644
--- a/rfb/rfb.h
+++ b/rfb/rfb.h
@@ -789,10 +789,11 @@ extern void rfbRefuseOnHoldClient(rfbClientPtr cl);
/* call one of these two functions to service the vnc clients.
usec are the microseconds the select on the fds waits.
if you are using the event loop, set this to some value > 0, so the
- server doesn't get a high load just by listening. */
+ server doesn't get a high load just by listening.
+ rfbProcessEvents() returns TRUE if an update was pending. */
extern void rfbRunEventLoop(rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground);
-extern void rfbProcessEvents(rfbScreenInfoPtr screenInfo,long usec);
+extern rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo,long usec);
#endif