summaryrefslogtreecommitdiffstats
path: root/libvncserver/main.c
diff options
context:
space:
mode:
authordscho <dscho>2005-01-18 23:18:04 +0000
committerdscho <dscho>2005-01-18 23:18:04 +0000
commita84b3d072a89e05c5aa5f702d223cfe304379293 (patch)
tree6e8b11537f0fe91e5a62b2dc559521ce8c9a9a13 /libvncserver/main.c
parentdd923e866021418379ee88b8a927597f616fbc84 (diff)
downloadlibtdevnc-a84b3d072a89e05c5aa5f702d223cfe304379293.tar.gz
libtdevnc-a84b3d072a89e05c5aa5f702d223cfe304379293.zip
pointerClient was still static.
do not make requestedRegion empty without reason. the cursor handling for clients which don't handle CursorShape updates was completely broken. It originally was very complicated for performance reasons, however, in most cases it made performance even worse, because at idle times there was way too much checking going on, and furthermore, sometimes unnecessary updates were inevitable. The code now is much more elegant: the ClientRec structure knows exactly where it last painted the cursor, and the ScreenInfo structure knows where the cursor shall be. As a consequence there is no more rfbDrawCursor()/rfbUndrawCursor(), no more dontSendFramebufferUpdate, and no more isCursorDrawn. It is now possible to have clients which understand CursorShape updates and clients which don't at the same time. rfbSetCursor no longer has the option freeOld; this is obsolete, as the cursor structure knows what to free and what not.
Diffstat (limited to 'libvncserver/main.c')
-rw-r--r--libvncserver/main.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index 9340073..102cebb 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -50,6 +50,9 @@ char rfbEndianTest = -1;
void rfbIncrClientRef(rfbClientPtr cl);
void rfbDecrClientRef(rfbClientPtr cl);
+/* cursor.c */
+void rfbRedrawAfterHideCursor(rfbClientPtr cl);
+
void rfbLogEnable(int enabled) {
rfbEnableLogging=enabled;
}
@@ -95,8 +98,6 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
rfbClientIteratorPtr iterator;
rfbClientPtr cl;
- rfbUndrawCursor(rfbScreen);
-
iterator=rfbGetClientIterator(rfbScreen);
while((cl=rfbClientIteratorNext(iterator))) {
LOCK(cl->updateMutex);
@@ -132,23 +133,6 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
sraRgnAnd(modifiedRegionBackup,cl->copyRegion);
sraRgnOr(cl->modifiedRegion,modifiedRegionBackup);
sraRgnDestroy(modifiedRegionBackup);
-
-#if 0
- /* TODO: is this needed? Or does it mess up deferring? */
- /* while(!sraRgnEmpty(cl->copyRegion)) */ {
-#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
- if(!cl->screen->backgroundLoop)
-#endif
- {
- sraRegionPtr updateRegion = sraRgnCreateRgn(cl->modifiedRegion);
- sraRgnOr(updateRegion,cl->copyRegion);
- UNLOCK(cl->updateMutex);
- rfbSendFramebufferUpdate(cl,updateRegion);
- sraRgnDestroy(updateRegion);
- continue;
- }
- }
-#endif
} else {
sraRgnOr(cl->modifiedRegion,copyRegion);
}
@@ -167,8 +151,6 @@ void rfbDoCopyRegion(rfbScreenInfoPtr screen,sraRegionPtr copyRegion,int dx,int
rowstride=screen->paddedWidthInBytes;
char *in,*out;
- rfbUndrawCursor(screen);
-
/* copy it, really */
i = sraRgnGetReverseIterator(copyRegion,dx<0,dy<0);
while(sraRgnIteratorNext(i,&rect)) {
@@ -372,23 +354,21 @@ rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
{
rfbClientIteratorPtr iterator;
rfbClientPtr other_client;
+ rfbScreenInfoPtr s = cl->screen;
+ rfbCursorPtr c = s->cursor;
- if (x != cl->screen->cursorX || y != cl->screen->cursorY) {
- if (cl->screen->cursorIsDrawn)
- rfbUndrawCursor(cl->screen);
- LOCK(cl->screen->cursorMutex);
- if (!cl->screen->cursorIsDrawn) {
- cl->screen->cursorX = x;
- cl->screen->cursorY = y;
- }
- UNLOCK(cl->screen->cursorMutex);
+ if (x != s->cursorX || y != s->cursorY) {
+ LOCK(s->cursorMutex);
+ s->cursorX = x;
+ s->cursorY = y;
+ UNLOCK(s->cursorMutex);
/* The cursor was moved by this client, so don't send CursorPos. */
if (cl->enableCursorPosUpdates)
cl->cursorWasMoved = FALSE;
/* But inform all remaining clients about this cursor movement. */
- iterator = rfbGetClientIterator(cl->screen);
+ iterator = rfbGetClientIterator(s);
while ((other_client = rfbClientIteratorNext(iterator)) != NULL) {
if (other_client != cl && other_client->enableCursorPosUpdates) {
other_client->cursorWasMoved = TRUE;
@@ -562,6 +542,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->autoPort=FALSE;
screen->clientHead=0;
+ screen->pointerClient=0;
screen->port=5900;
screen->socketInitDone=FALSE;
@@ -623,8 +604,6 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
/* cursor */
- screen->cursorIsDrawn = FALSE;
- screen->dontSendFramebufferUpdate = FALSE;
screen->cursorX=screen->cursorY=screen->underCursorBufferLen=0;
screen->underCursorBuffer=NULL;
screen->dontConvertRichCursorToXCursor = FALSE;
@@ -672,10 +651,6 @@ void rfbNewFramebuffer(rfbScreenInfoPtr screen, char *framebuffer,
rfbClientIteratorPtr iterator;
rfbClientPtr cl;
- /* Remove the pointer */
-
- rfbUndrawCursor(screen);
-
/* Update information in the screenInfo structure */
old_format = screen->serverFormat;