summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authorrunge <runge>2005-05-31 03:26:04 +0000
committerrunge <runge>2005-05-31 03:26:04 +0000
commit4effb62e99925e19f2b4b14041d57574f3763f23 (patch)
tree184574c05c1fe806fd5ada6252501bdf92a3be63 /libvncserver
parent813f4211ee483f2e6ef32265970cfe4d67b84491 (diff)
downloadlibtdevnc-4effb62e99925e19f2b4b14041d57574f3763f23.tar.gz
libtdevnc-4effb62e99925e19f2b4b14041d57574f3763f23.zip
main.c: fix copyRect for non-cursor-shape-aware clients.
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/main.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index bf1f211..e4d1ea7 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -130,6 +130,49 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
sraRgnAnd(modifiedRegionBackup,cl->copyRegion);
sraRgnOr(cl->modifiedRegion,modifiedRegionBackup);
sraRgnDestroy(modifiedRegionBackup);
+
+ if(!cl->enableCursorShapeUpdates) {
+ /*
+ * n.b. (dx, dy) is the vector pointing in the direction the
+ * copyrect displacement will take place. copyRegion is the
+ * destination rectangle (say), not the source rectangle.
+ */
+ sraRegionPtr cursorRegion;
+ int x = cl->cursorX - cl->screen->cursor->xhot;
+ int y = cl->cursorY - cl->screen->cursor->yhot;
+ int w = cl->screen->cursor->width;
+ int h = cl->screen->cursor->height;
+
+ cursorRegion = sraRgnCreateRect(x, y, x + w, y + h);
+ sraRgnAnd(cursorRegion, cl->copyRegion);
+ if(!sraRgnEmpty(cursorRegion)) {
+ /*
+ * current cursor rect overlaps with the copy region *dest*,
+ * so remove it from the copy-rect treatment, and mark it as
+ * modified since we won't copy-rect stuff to it.
+ */
+ sraRgnSubtract(cl->copyRegion, cursorRegion);
+ sraRgnOr(cl->modifiedRegion, cursorRegion);
+ }
+ sraRgnDestroy(cursorRegion);
+
+ cursorRegion = sraRgnCreateRect(x, y, x + w, y + h);
+ /* displace it to check for overlap with copy region source: */
+ sraRgnOffset(cursorRegion, dx, dy);
+ sraRgnAnd(cursorRegion, cl->copyRegion);
+ if(!sraRgnEmpty(cursorRegion)) {
+ /*
+ * current cursor rect overlaps with the copy region *source*,
+ * so remove it from the copy-rect treatment, and mark the
+ * *displaced* cursorRegion as modified since we won't copyrect
+ * stuff to it.
+ */
+ sraRgnSubtract(cl->copyRegion, cursorRegion);
+ sraRgnOr(cl->modifiedRegion, cursorRegion);
+ }
+ sraRgnDestroy(cursorRegion);
+ }
+
} else {
sraRgnOr(cl->modifiedRegion,copyRegion);
}