summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2010-12-21 16:06:36 +0000
committerPierre Ossman <ossman@cendio.se>2010-12-21 16:06:36 +0000
commit9d6e9c468b0ee758c7320e2017e6cca8998e2ba9 (patch)
tree71d6a875e51d1295ecac057000289cd337837754 /unix
parent201983a623a7af39aa69371d7a147788fb1d8bf2 (diff)
downloadtigervnc-9d6e9c468b0ee758c7320e2017e6cca8998e2ba9.tar.gz
tigervnc-9d6e9c468b0ee758c7320e2017e6cca8998e2ba9.zip
Sometimes we get copy requests that are partially or fully outside the
framebuffer. Not sure if this is a bug or not, but for now add some handling to deal with these gracefully. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4230 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix')
-rw-r--r--unix/xserver/hw/vnc/vncHooks.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/unix/xserver/hw/vnc/vncHooks.cc b/unix/xserver/hw/vnc/vncHooks.cc
index 52ef42ae..1bf61a38 100644
--- a/unix/xserver/hw/vnc/vncHooks.cc
+++ b/unix/xserver/hw/vnc/vncHooks.cc
@@ -400,12 +400,19 @@ static void vncHooksCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
int dx, dy;
RegionHelper copied(pScreen, pOldRegion);
+ BoxRec screen_box = {0, 0, pScreen->width, pScreen->height};
+ RegionHelper screen_rgn(pScreen, &screen_box, 1);
+
dx = pWin->drawable.x - ptOldOrg.x;
dy = pWin->drawable.y - ptOldOrg.y;
// RFB tracks copies in terms of destination rectangle, not source.
// We also need to copy with changes to the Window's clipping region.
+ // Finally, make sure we don't get copies to or from regions outside
+ // the framebuffer.
+ REGION_INTERSECT(pScreen, copied.reg, copied.reg, screen_rgn.reg);
REGION_TRANSLATE(pScreen, copied.reg, dx, dy);
+ REGION_INTERSECT(pScreen, copied.reg, copied.reg, screen_rgn.reg);
REGION_INTERSECT(pScreen, copied.reg, copied.reg, &pWin->borderClip);
(*pScreen->CopyWindow) (pWin, ptOldOrg, pOldRegion);