summaryrefslogtreecommitdiffstats
path: root/rfbserver.c
diff options
context:
space:
mode:
Diffstat (limited to 'rfbserver.c')
-rw-r--r--rfbserver.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/rfbserver.c b/rfbserver.c
index ef7eced..2695170 100644
--- a/rfbserver.c
+++ b/rfbserver.c
@@ -73,6 +73,7 @@ void
rfbClientListInit(rfbScreenInfoPtr rfbScreen)
{
rfbScreen->rfbClientHead = NULL;
+ INIT_MUTEX(rfbClientListMutex);
}
rfbClientIteratorPtr
@@ -657,10 +658,12 @@ rfbProcessClientNormalMessage(cl)
}
break;
case rfbEncodingXCursor:
- rfbLog("Enabling X-style cursor updates for client %s\n",
- cl->host);
- cl->enableCursorShapeUpdates = TRUE;
- cl->cursorWasChanged = TRUE;
+ if(!cl->screen->dontConvertRichCursorToXCursor) {
+ rfbLog("Enabling X-style cursor updates for client %s\n",
+ cl->host);
+ cl->enableCursorShapeUpdates = TRUE;
+ cl->cursorWasChanged = TRUE;
+ }
break;
case rfbEncodingRichCursor:
rfbLog("Enabling full-color cursor updates for client "
@@ -729,6 +732,7 @@ rfbProcessClientNormalMessage(cl)
if (!cl->format.trueColour) {
if (!rfbSetClientColourMap(cl, 0, 0)) {
sraRgnDestroy(tmpRegion);
+ UNLOCK(cl->updateMutex);
return;
}
}
@@ -740,10 +744,7 @@ rfbProcessClientNormalMessage(cl)
}
SIGNAL(cl->updateCond);
UNLOCK(cl->updateMutex);
-
- if(cl->sock>=0 && FB_UPDATE_PENDING(cl)) {
- rfbSendFramebufferUpdate(cl,cl->modifiedRegion);
- }
+
sraRgnDestroy(tmpRegion);
return;
@@ -847,16 +848,12 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
sraRegionPtr updateRegion,updateCopyRegion;
int dx, dy;
Bool sendCursorShape = FALSE;
- Bool cursorWasDrawn = FALSE;
-
/*
* If this client understands cursor shape updates, cursor should be
* removed from the framebuffer. Otherwise, make sure it's put up.
*/
- cursorWasDrawn = cl->screen->cursorIsDrawn;
-
if (cl->enableCursorShapeUpdates) {
if (cl->screen->cursorIsDrawn) {
rfbUndrawCursor(cl);
@@ -869,7 +866,9 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
rfbDrawCursor(cl);
}
}
-
+
+ LOCK(cl->updateMutex);
+
/*
* The modifiedRegion may overlap the destination copyRegion. We remove
* any overlapping bits from the copyRegion (since they'd only be
@@ -889,6 +888,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
sraRgnOr(updateRegion,cl->copyRegion);
if(!sraRgnAnd(updateRegion,cl->requestedRegion) && !sendCursorShape) {
sraRgnDestroy(updateRegion);
+ UNLOCK(cl->updateMutex);
return TRUE;
}
@@ -927,12 +927,14 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
sraRgnOr(cl->modifiedRegion,cl->copyRegion);
sraRgnSubtract(cl->modifiedRegion,updateRegion);
sraRgnSubtract(cl->modifiedRegion,updateCopyRegion);
-
+
sraRgnMakeEmpty(cl->requestedRegion);
sraRgnMakeEmpty(cl->copyRegion);
cl->copyDX = 0;
cl->copyDY = 0;
+ UNLOCK(cl->updateMutex);
+
/*
* Now send the update.
*/
@@ -1066,13 +1068,6 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
return FALSE;
}
- if(cursorWasDrawn != cl->screen->cursorIsDrawn) {
- if(cursorWasDrawn)
- rfbDrawCursor(cl);
- else
- rfbUndrawCursor(cl);
- }
-
sraRgnDestroy(updateRegion);
return TRUE;
}