Hello

Here's an easy way to reproduce the bugs solved by the patch:

Use Unix (in my case: Linux).

Resize your desktop to 1024x768:
xrandr --output something --mode 1024x768

Start a vncserver with weird geometry:
vncserver -geometry 600x1500 :1
(or use 1500x600 for similar result with inverted axis)

Start the client:
vncviewer :1

Notice that you can't t see part of the screen because of the
scrollbar. It is covering a column/line of 15 pixels from your vnc
desktop. Two problems:
1 - you can't resize the window to see that part (well... at least I
can't with kwin)
2 - there's no scrollbar that you can use to see that part (because
when the first scrollbar was added, vncviewer didn't realize if would
cover a space that was previously uncovered)

There are 2 patches attached. 0001 solves problem "1", 0002 solves problem "2".

Do they look fine?

Cheers,
Paulo

-- 
Paulo Zanoni
From f1dfc5dda4fceb646d211ef1f5e97285da8e5c8e Mon Sep 17 00:00:00 2001
From: Paulo Zanoni <pzan...@mandriva.com>
Date: Wed, 15 Dec 2010 21:11:22 -0200
Subject: [PATCH] TXViewport: set the window max width/height considering the scrollbars

If we add a vertical scrollbar it will consume horizontal space and
vice-versa. When we add scrollbars, we don't resize the window, so
they usually occupy space that was previously used to show the user
content. Let the user resize the window so he can see the space that
was consumed by the scrollbar.
---
 unix/tx/TXViewport.cxx |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/unix/tx/TXViewport.cxx b/unix/tx/TXViewport.cxx
index 2ee2336..7a1e95b 100644
--- a/unix/tx/TXViewport.cxx
+++ b/unix/tx/TXViewport.cxx
@@ -118,11 +118,22 @@ bool TXViewport::handleTimeout(rfb::Timer* timer) {
 
 void TXViewport::resizeNotify()
 {
+  int winMaxWidth, winMaxHeight;
+
+  winMaxWidth = child->width();
+  winMaxHeight = child->height();
+
   needXScrollbar = (!bumpScroll && width() < child->width() &&
 		    height() > scrollbarSize && width() > scrollbarSize);
   needYScrollbar = (!bumpScroll && height() < child->height() &&
 		    height() > scrollbarSize && width() > scrollbarSize);
 
+  if (needXScrollbar)
+    winMaxHeight += scrollbarSize;
+  if (needYScrollbar)
+    winMaxWidth += scrollbarSize;
+  setMaxSize(winMaxWidth, winMaxHeight);
+
   if (needXScrollbar && needYScrollbar) {
     clipper->resize(width()-scrollbarSize, height()-scrollbarSize);
     hScrollbar->map();
-- 
1.7.3.3

From a8edb9ed813b908e3ed2ce75fe6fb13e1c2dbb2b Mon Sep 17 00:00:00 2001
From: Paulo Zanoni <pzan...@mandriva.com>
Date: Wed, 15 Dec 2010 22:11:04 -0200
Subject: [PATCH 2/2] TXViewport: check if we need another scrollbar after adding one

Adding an horizontal scrollbar occupies space, which might cause the
need to add a vertical scrollbar, and vice-versa. These additional
checks should solve this problem.
---
 unix/tx/TXViewport.cxx |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/unix/tx/TXViewport.cxx b/unix/tx/TXViewport.cxx
index 7a1e95b..6064893 100644
--- a/unix/tx/TXViewport.cxx
+++ b/unix/tx/TXViewport.cxx
@@ -123,10 +123,19 @@ void TXViewport::resizeNotify()
   winMaxWidth = child->width();
   winMaxHeight = child->height();
 
-  needXScrollbar = (!bumpScroll && width() < child->width() &&
-		    height() > scrollbarSize && width() > scrollbarSize);
-  needYScrollbar = (!bumpScroll && height() < child->height() &&
-		    height() > scrollbarSize && width() > scrollbarSize);
+  needXScrollbar = false;
+  needYScrollbar = false;
+  if (!bumpScroll && height() > scrollbarSize && width() > scrollbarSize) {
+    needXScrollbar = (width() < child->width());
+    needYScrollbar = (height() < child->height());
+    // Adding an horizontal scrollbar occupies space, which might cause the
+    // need to add a vertical scrollbar, and vice-versa. These additional
+    // checks should solve this problem
+    if (needXScrollbar && (height() - scrollbarSize < child->height()))
+	needYScrollbar = true;
+    if (needYScrollbar && (width() - scrollbarSize < child->width()))
+	needXScrollbar = true;
+  }
 
   if (needXScrollbar)
     winMaxHeight += scrollbarSize;
-- 
1.7.3.3

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to