From 8539dfdac26aea04445995b6f897d86bcadbdfd2 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 6 Jul 2020 21:40:51 -0400 Subject: [PATCH] BScrollBar: Use the minimum as the preferred size in the alternate axis. This was the behavior before the commit yesterday that unified the two methods of computing the preferred size. It seems some applications expect this to be callable without a window lock, so this works when the other method does not. Fixes #16372. --- src/kits/interface/ScrollBar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index ed26de53d0..34a58b5aa9 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -999,10 +999,10 @@ BScrollBar::GetPreferredSize(float* _width, float* _height) *_width = B_V_SCROLL_BAR_WIDTH * scale; if (_height) - *_height = Bounds().Height(); + *_height = _MinSize().Height(); } else if (fOrientation == B_HORIZONTAL) { if (_width) - *_width = Bounds().Width(); + *_width = _MinSize().Width(); if (_height) *_height = B_H_SCROLL_BAR_HEIGHT * scale; @@ -1228,7 +1228,7 @@ BScrollBar::_UpdateThumbFrame() thumbSize = floorf(thumbSize + 0.5); thumbSize--; - // the thumb can be scrolled within the remaining area "maxSize - thumbSize - 1.0" + // the thumb can be scrolled within the remaining area "maxSize - thumbSize - 1.0" float offset = 0.0; if (fMax > fMin) { offset = floorf(((fValue - fMin) / (fMax - fMin))