diff options
Diffstat (limited to 'unix/tx')
-rw-r--r-- | 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 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; |