summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorAdam Tkac <atkac@redhat.com>2011-01-17 10:35:46 +0000
committerAdam Tkac <atkac@redhat.com>2011-01-17 10:35:46 +0000
commitbb443662bd5ec4d9a13a81a3113c8b129067f447 (patch)
treee908c36fea2213d479e3923cd3a6af490cca4d46 /unix
parentf818725c00436ec21be2a9b871c15ce224be0b65 (diff)
downloadtigervnc-bb443662bd5ec4d9a13a81a3113c8b129067f447.tar.gz
tigervnc-bb443662bd5ec4d9a13a81a3113c8b129067f447.zip
[Bugfix] TXViewport: check if we need another scrollbar after adding one
Thanks to Paulo Zanoni for the patch. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4234 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix')
-rw-r--r--unix/tx/TXViewport.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/unix/tx/TXViewport.cxx b/unix/tx/TXViewport.cxx
index 7a1e95b7..60648933 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;