Make sure the viewport widget can be moved around (i.e. don't assume we're
always at (0,0)).


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4372 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 6525b7c..8150b04 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -127,7 +127,7 @@
   Fl::remove_timeout(handleUpdateTimeout, this);
 
   r = damage.get_bounding_rect();
-  Fl_Widget::damage(FL_DAMAGE_USER1, r.tl.x, r.tl.y, r.width(), r.height());
+  Fl_Widget::damage(FL_DAMAGE_USER1, r.tl.x + x(), r.tl.y + y(), r.width(), r.height());
 
   damage.clear();
 }
@@ -141,15 +141,15 @@
   const uchar *buf_start;
 
   // Check what actually needs updating
-  fl_clip_box(0, 0, w(), h(), X, Y, W, H);
+  fl_clip_box(x(), y(), w(), h(), X, Y, W, H);
   if ((W == 0) || (H == 0))
     return;
 
   pixel_bytes = frameBuffer->getPF().bpp/8;
   stride_bytes = pixel_bytes * frameBuffer->getStride();
   buf_start = frameBuffer->data +
-              pixel_bytes * X +
-              stride_bytes * Y;
+              pixel_bytes * (X - x()) +
+              stride_bytes * (Y - y());
 
   // FIXME: Check how efficient this thing really is
   fl_draw_image(buf_start, X, Y, W, H, pixel_bytes, stride_bytes);