From f44f6c02db249af0c579dcf5e59cbed2f549e2b7 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 20 Jul 2012 12:39:27 +0000 Subject: [PATCH] Screen layout is relative our viewport, not the local machine's 0,0. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4946 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- vncviewer/DesktopWindow.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 32e202a8..829d3dbe 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -453,10 +453,11 @@ void DesktopWindow::remoteResize() } #ifdef HAVE_FLTK_FULLSCREEN - if (!fullscreen_active()) { + if (!fullscreen_active() || (width > w()) || (height > h())) { #endif - // In windowed mode we just report a single virtual screen that - // covers the entire framebuffer. + // In windowed mode (or the framebuffer is so large that we need + // to scroll) we just report a single virtual screen that covers + // the entire framebuffer. layout = cc->cp.screenLayout; @@ -489,11 +490,12 @@ void DesktopWindow::remoteResize() int i; rdr::U32 id; int sx, sy, sw, sh; - Rect fb_rect, screen_rect; + Rect viewport_rect, screen_rect; // In full screen we report all screens that are fully covered. - fb_rect.setXYWH(x + , 0, width, height); + viewport_rect.setXYWH(x() + (w() - width)/2, y() + (h() - height)/2, + width, height); // If we can find a matching screen in the existing set, we use // that, otherwise we create a brand new screen. @@ -506,9 +508,13 @@ void DesktopWindow::remoteResize() // Check that the screen is fully inside the framebuffer screen_rect.setXYWH(sx, sy, sw, sh); - if (!screen_rect.enclosed_by(fb_rect)) + if (!screen_rect.enclosed_by(viewport_rect)) continue; + // Adjust the coordinates so they are relative to our viewport + sx -= viewport_rect.tl.x; + sy -= viewport_rect.tl.y; + // Look for perfectly matching existing screen... for (iter = cc->cp.screenLayout.begin(); iter != cc->cp.screenLayout.end(); ++iter) { -- 2.39.5