From: Vadim Zeitlin Date: Sun, 16 Apr 2006 01:14:28 +0000 (+0000) Subject: set up scrollbars correctly when we don't need them (fixes the problems reported... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/760f0fc2f4b875beb06e5ecd6d69b891d8360efe set up scrollbars correctly when we don't need them (fixes the problems reported by the patches 1460482 and 1456060) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38751 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index 001017f731..0ca01db247 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -81,7 +81,7 @@ void wxScrollHelperNative::DoAdjustScrollbar(GtkAdjustment *adj, int *lines, int *linesPerPage) { - if ( pixelsPerLine == 0 ) + if ( pixelsPerLine == 0 || winSize >= virtSize ) { adj->upper = 1.0; adj->page_increment = 1.0; @@ -89,19 +89,15 @@ void wxScrollHelperNative::DoAdjustScrollbar(GtkAdjustment *adj, } else // we do have scrollbar { + // round because we need to show all the items adj->upper = (virtSize + pixelsPerLine - 1) / pixelsPerLine; - adj->page_size = winSize / pixelsPerLine; - adj->page_increment = winSize / pixelsPerLine; - - // Special case. When client and virtual size are very close but - // the client is big enough, kill scrollbar. - if ((adj->page_size < adj->upper) && (winSize >= virtSize)) - adj->page_size += 1.0; + // truncate here as we want to show visible lines entirely + adj->page_size = + adj->page_increment = winSize / pixelsPerLine; // If the scrollbar hits the right side, move the window // right to keep it from over extending. - if ( !wxIsNullDouble(adj->value) && (adj->value + adj->page_size > adj->upper) ) {