[Libreoffice-commits] core.git: vcl/source

Prashant Pandey prashant3.yishu at gmail.com
Thu Sep 12 15:45:07 PDT 2013


 vcl/source/window/splitwin.cxx |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 16ea2dc1f572d698923c770a2a58f7ab402d1298
Author: Prashant Pandey <prashant3.yishu at gmail.com>
Date:   Sat Sep 7 23:53:02 2013 +0530

    Sidebar: Correcting anomalous mouse behaviour while resizing
    
    Currently, when the sidebar is showing, and we hold the handle to make
    it wider/narrower, if we move the mouse much to the left (so that it
    can't become any wider), and now move mouse pointer to the right (while
    still holding the handle), it immediately begins to shrink.
    
    Ideally how it should behave when we move the mouse much to the left is
    that- the sidebar should begin shrinking once we have the mouse pointer
    over the handle again and not immediately.
    
    Change-Id: Id17dc19e6e1ad02fb7879ace9a2e092ac0128693

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 2322189..e9286bd 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -2542,21 +2542,30 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt )
         {
             sal_Bool    bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? sal_True : sal_False;
             sal_Bool    bPropGreater = (mnMouseModifier & KEY_MOD1) ? sal_True : sal_False;
-            long    nDelta = mnMSplitPos-mnMStartPos;
 
             if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
             {
+                // nDelta corresponds to the direction to which user drags the mouse.
+                // If nDelta > 0, means user has dragged the handle towards the right and vice-versa
+                long nDelta = mnMSplitPos-mnMStartPos;
+
                 if ( (mpSplitSet == mpMainSet) && mbBottomRight )
                     nDelta *= -1;
                 ImplSetWindowSize( nDelta );
             }
             else
             {
-                long nNewSize = mpSplitSet->mpItems[mnSplitPos].mnPixSize;
+                long nNewSize( 0 );
+
+                // where is the sidebar is attached?
                 if ( (mpSplitSet == mpMainSet) && mbBottomRight )
-                    nNewSize -= nDelta;
+                    nNewSize = mnMaxSize - mnMStartPos; // right hand side of the screen
                 else
-                    nNewSize += nDelta;
+                    nNewSize = mnMStartPos; // left hand side of the screen
+
+                // do not make the sidebar wider than mnMaxSize
+                nNewSize = std::min(nNewSize, mpSplitSet->mpItems[mnSplitPos].mnMaxSize);
+
                 SplitItem( mpSplitSet->mpItems[mnSplitPos].mnId, nNewSize,
                            bPropSmaller, bPropGreater );
             }


More information about the Libreoffice-commits mailing list