summaryrefslogtreecommitdiffstats
path: root/libvncserver/cursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvncserver/cursor.c')
-rw-r--r--libvncserver/cursor.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libvncserver/cursor.c b/libvncserver/cursor.c
index 4f290da..9f8f9d6 100644
--- a/libvncserver/cursor.c
+++ b/libvncserver/cursor.c
@@ -390,7 +390,7 @@ void rfbUndrawCursor(rfbScreenInfoPtr s)
int j,x1,x2,y1,y2,bpp=s->rfbServerFormat.bitsPerPixel/8,
rowstride=s->paddedWidthInBytes;
LOCK(s->cursorMutex);
- if(!s->cursorIsDrawn) {
+ if(!s->cursorIsDrawn || !c) {
UNLOCK(s->cursorMutex);
return;
}
@@ -421,6 +421,8 @@ void rfbUndrawCursor(rfbScreenInfoPtr s)
/* rfbMarkRectAsModified(s,x1,y1,x1+x2,y1+y2); */
s->cursorIsDrawn = FALSE;
+ s->oldCursorX=s->cursorX;
+ s->oldCursorY=s->cursorY;
UNLOCK(s->cursorMutex);
}
@@ -431,7 +433,7 @@ void rfbDrawCursor(rfbScreenInfoPtr s)
rowstride=s->paddedWidthInBytes,
bufSize,w;
rfbBool wasChanged=FALSE;
-
+
if(!c) return;
LOCK(s->cursorMutex);
if(s->cursorIsDrawn) {
@@ -439,6 +441,13 @@ void rfbDrawCursor(rfbScreenInfoPtr s)
UNLOCK(s->cursorMutex);
return;
}
+
+ if(s->cursor && s->underCursorBuffer &&
+ (s->cursorX!=s->oldCursorX || s->cursorY!=s->oldCursorY)) {
+ int x1=s->oldCursorX-s->cursor->xhot,x2=x1+s->cursor->width;
+ int y1=s->oldCursorY-s->cursor->yhot,y2=y1+s->cursor->height;
+ rfbMarkRectAsModified(s,x1,y1,x2,y2);
+ }
bufSize=c->width*c->height*bpp;
w=(c->width+7)/8;
if(s->underCursorBufferLen<bufSize) {
@@ -518,6 +527,9 @@ void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c,rfbBool freeOld)
LOCK(rfbScreen->cursorMutex);
}
+ free(rfbScreen->underCursorBuffer);
+ rfbScreen->underCursorBuffer=0;
+
if(rfbScreen->cursor && (freeOld || rfbScreen->cursor->cleanup))
rfbFreeCursor(rfbScreen->cursor);