From a6e207782375c6f4c3ba5c77868486baefc96160 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 15 Apr 2011 11:10:52 +0000 Subject: [PATCH] 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 --- vncviewer/Viewport.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 6525b7c6..8150b04b 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -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); -- 2.39.5