]> source.dussan.org Git - tigervnc.git/commitdiff
Make sure the viewport widget can be moved around (i.e. don't assume we're
authorPierre Ossman <ossman@cendio.se>
Fri, 15 Apr 2011 11:10:52 +0000 (11:10 +0000)
committerPierre Ossman <ossman@cendio.se>
Fri, 15 Apr 2011 11:10:52 +0000 (11:10 +0000)
always at (0,0)).

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4372 3789f03b-4d11-0410-bbf8-ca57d06f2519

vncviewer/Viewport.cxx

index 6525b7c6648dbd5a41411d367cc8c2be3bcbcc86..8150b04b43e27ba369d96a5a84536e73059b1475 100644 (file)
@@ -127,7 +127,7 @@ void Viewport::updateWindow()
   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 @@ void Viewport::draw()
   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);