diff -up vnc-4_1_2-unixsrc/unix/tx/TXViewport.h.scrollbars vnc-4_1_2-unixsrc/unix/tx/TXViewport.h --- vnc-4_1_2-unixsrc/unix/tx/TXViewport.h.scrollbars 2008-03-14 12:44:19.000000000 +0100 +++ vnc-4_1_2-unixsrc/unix/tx/TXViewport.h 2008-03-14 12:44:19.000000000 +0100 @@ -77,7 +77,8 @@ private: int xOff, yOff; rfb::Timer bumpScrollTimer; bool bumpScroll; - bool needScrollbars; + bool needXScrollbar; + bool needYScrollbar; int bumpScrollX, bumpScrollY; }; #endif diff -up vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx.scrollbars vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx --- vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx.scrollbars 2008-03-14 12:44:19.000000000 +0100 +++ vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx 2008-03-14 13:08:30.000000000 +0100 @@ -25,7 +25,8 @@ TXViewport::TXViewport(Display* dpy_, int w, int h, TXWindow* parent_) : TXWindow(dpy_, w, h, parent_), child(0), hScrollbar(0), vScrollbar(0), scrollbarSize(15), xOff(0), yOff(0), bumpScrollTimer(this), - bumpScroll(false), needScrollbars(false), bumpScrollX(0), bumpScrollY(0) + bumpScroll(false), needXScrollbar(false), needYScrollbar(false), + bumpScrollX(0), bumpScrollY(0) { clipper = new TXWindow(dpy, width()-scrollbarSize, height()-scrollbarSize, this); @@ -132,13 +133,23 @@ bool TXViewport::handleTimeout(rfb::Time void TXViewport::resizeNotify() { - needScrollbars = (!bumpScroll && - (width() < child->width() || height() < child->height()) && - (width() > scrollbarSize && height() > scrollbarSize)); - if (needScrollbars) { + needXScrollbar = (!bumpScroll && width() < child->width() && + height() > scrollbarSize && width() > scrollbarSize); + needYScrollbar = (!bumpScroll && height() < child->height() && + height() > scrollbarSize && width() > scrollbarSize); + + if (needXScrollbar && needYScrollbar) { clipper->resize(width()-scrollbarSize, height()-scrollbarSize); hScrollbar->map(); vScrollbar->map(); + } else if (needXScrollbar) { + clipper->resize(width(), height()-scrollbarSize); + hScrollbar->map(); + vScrollbar->unmap(); + } else if (needYScrollbar) { + clipper->resize(width()-scrollbarSize, height()); + hScrollbar->unmap(); + vScrollbar->map(); } else { clipper->resize(width(), height()); hScrollbar->unmap(); @@ -147,10 +158,13 @@ void TXViewport::resizeNotify() setOffset(xOff, yOff); - if (needScrollbars) { + if (needXScrollbar) { hScrollbar->move(0, height()-scrollbarSize); hScrollbar->resize(width()-scrollbarSize, scrollbarSize); hScrollbar->set(child->width(), -xOff, width()-scrollbarSize); + } + + if (needYScrollbar) { vScrollbar->move(width()-scrollbarSize, 0); vScrollbar->resize(scrollbarSize, height()-scrollbarSize); vScrollbar->set(child->height(), -yOff, height()-scrollbarSize);