[Libreoffice-commits] core.git: include/vcl vcl/source
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 23 04:48:43 UTC 2019
include/vcl/scrbar.hxx | 1 +
vcl/source/control/scrbar.cxx | 27 +++++++++++++++------------
2 files changed, 16 insertions(+), 12 deletions(-)
New commits:
commit a71c960754152fb7e8094cdf6190783e609c2b58
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed May 22 15:57:48 2019 +0200
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu May 23 06:47:43 2019 +0200
Fix moving / orientation-changing ScrollBar
Just implements Move the same way then Resize. More importantly
the patch correctly resets the Thumb and Page rectangles to
position (0,0) instead of just Empty, which ImplCalc is based on.
Otherwise this results in broken scroll bars, when the StarMath
elements window is docked in in the bottom or top area and
switches the scrolling orientation on undock.
Change-Id: I32b0507cdd6551cc7f42655a730faf8ef25b747b
Reviewed-on: https://gerrit.libreoffice.org/72794
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx
index 8a2fffac0321..fb08f37405b6 100644
--- a/include/vcl/scrbar.hxx
+++ b/include/vcl/scrbar.hxx
@@ -94,6 +94,7 @@ public:
virtual void KeyInput(const KeyEvent& rKEvt) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual void Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags) override;
+ virtual void Move() override;
virtual void Resize() override;
virtual void StateChanged(StateChangedType nType) override;
virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 8c12b9f5ec2d..19db246006b7 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -243,6 +243,11 @@ void ScrollBar::ImplCalc( bool bUpdate )
const tools::Rectangle aControlRegion( Point(0,0), aSize );
tools::Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion;
+ // reset rectangles to empty *and* (0,0) position
+ maThumbRect = tools::Rectangle();
+ maPage1Rect = tools::Rectangle();
+ maPage2Rect = tools::Rectangle();
+
if ( GetStyle() & WB_HORZ )
{
if ( GetNativeControlRegion( ControlType::Scrollbar, IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft,
@@ -278,13 +283,9 @@ void ScrollBar::ImplCalc( bool bUpdate )
maThumbRect.SetBottom( maTrackRect.Bottom() );
}
else
- {
mnThumbPixRange = 0;
- maPage1Rect.SetEmpty();
- maPage2Rect.SetEmpty();
- }
}
- else
+ else // WB_VERT
{
if ( GetNativeControlRegion( ControlType::Scrollbar, ControlPart::ButtonUp,
aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn1Region ) &&
@@ -319,16 +320,9 @@ void ScrollBar::ImplCalc( bool bUpdate )
maThumbRect.SetRight( maTrackRect.Right() );
}
else
- {
mnThumbPixRange = 0;
- maPage1Rect.SetEmpty();
- maPage2Rect.SetEmpty();
- }
}
- if ( !mnThumbPixRange )
- maThumbRect.SetEmpty();
-
mbCalcSize = false;
Size aNewSize = getCurrentCalcSize();
@@ -1092,6 +1086,15 @@ void ScrollBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
ImplDraw(rRenderContext);
}
+void ScrollBar::Move()
+{
+ Control::Move();
+ mbCalcSize = true;
+ if (IsReallyVisible())
+ ImplCalc(false);
+ Invalidate();
+}
+
void ScrollBar::Resize()
{
Control::Resize();
More information about the Libreoffice-commits
mailing list