Blob Blame History Raw
From 65410a3cf918fc17bf92c1ad48574e17e79a62bc Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Mon, 23 Nov 2015 16:07:49 +0100
Subject: [PATCH 355/398] vcl lok: fix scrollbar to accept mouse events in
 twips

(cherry picked from commit 439765480695975e10c92f39aa6a4cb6f2ee7646)

Change-Id: Ieaedaa525d613f8ba55f336c613da163a09f7a33
---
 vcl/source/control/scrbar.cxx | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index a60595c2ee0d..e8004d13d177 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -897,7 +897,19 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
 
     if (rMEvt.IsLeft() || rMEvt.IsMiddle() || rMEvt.IsRight())
     {
-        const Point&        rMousePos = rMEvt.GetPosPixel();
+        Point aPosPixel;
+        if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP)
+        {
+            // rMEvt coordinates are in twips.
+            Push(PushFlags::MAPMODE);
+            EnableMapMode();
+            MapMode aMapMode = GetMapMode();
+            aMapMode.SetOrigin(Point(0, 0));
+            SetMapMode(aMapMode);
+            aPosPixel = LogicToPixel(rMEvt.GetPosPixel());
+            Pop();
+        }
+        const Point&        rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rMEvt.GetPosPixel() : aPosPixel);
         sal_uInt16          nTrackFlags = 0;
         bool                bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
         bool                bIsInside = false;
-- 
2.12.0