Ensure that scrollbar GtkRange page increment is set to a positive value

It should not be less than the step increment, which is always one.
See #18688
This commit is contained in:
Paul Cornett 2020-03-11 22:10:22 -07:00
parent 4a8a61f6d6
commit 81309f083d
3 changed files with 8 additions and 1 deletions

View File

@ -201,12 +201,15 @@ void wxScrollBar::SetThumbPosition( int viewStart )
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, bool)
{
if (range == 0)
if (range <= 0)
{
// GtkRange requires upper > lower
range =
pageSize =
thumbSize = 1;
}
else if (pageSize <= 0)
pageSize = 1;
g_signal_handlers_block_by_func(m_widget, (void*)gtk_value_changed, this);
GtkRange* widget = GTK_RANGE(m_widget);
GtkAdjustment* adj = gtk_range_get_adjustment(widget);

View File

@ -54,6 +54,8 @@ void wxScrollHelper::DoAdjustScrollbar(GtkRange* range,
{
upper = (virtSize + pixelsPerLine - 1) / pixelsPerLine;
page_size = winSize / pixelsPerLine;
if (page_size == 0)
page_size = 1;
*lines = upper;
*linesPerPage = page_size;
}

View File

@ -6011,6 +6011,8 @@ void wxWindowGTK::SetScrollbar(int orient,
range =
thumbVisible = 1;
}
else if (thumbVisible <= 0)
thumbVisible = 1;
g_signal_handlers_block_by_func(
sb, (void*)gtk_scrollbar_value_changed, this);