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

Stephan Bergmann sbergman at redhat.com
Fri Oct 9 06:09:10 PDT 2015


 vcl/source/window/brdwin.cxx                  |   72 ++++++++++----------------
 vcl/source/window/dlgctrl.cxx                 |    2 
 vcl/source/window/taskpanelist.cxx            |   22 ++-----
 vcl/unx/generic/app/saldisp.cxx               |    2 
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx      |    4 -
 vcl/unx/gtk/window/gtksalframe.cxx            |    1 
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |    4 -
 7 files changed, 38 insertions(+), 69 deletions(-)

New commits:
commit 3c64e4bbdb48942483d68a429d60ae9e57094ca6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 9 14:40:23 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I54691786167fd17b115460f3329573f0c2f023ed

diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 9a30ed6..1cf9c2e 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -323,12 +323,8 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
                                  "has-backward-stepper", &has_backward,
                                  "has-secondary-backward-stepper", &has_backward2, nullptr );
     gint magic = trough_border ? 1 : 0;
-    gint nFirst = 0;
     gint slider_side = slider_width + (trough_border * 2);
 
-    if ( has_backward )  nFirst  += 1;
-    if ( has_forward2 )  nFirst  += 1;
-
     if ( nPart == PART_DRAW_BACKGROUND_HORZ )
     {
         scrollbarRect.Move( 0, (scrollbarRect.GetHeight() - slider_side) / 2 );
commit c3bcd36d1081bca13ecc0ce5179fd31cc24b761a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 9 14:39:42 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I97db1e22a42e25186be0d7304b9f2a5204fc1c83

diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 23735f7..389f28b 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -2675,7 +2675,6 @@ dbus_uninhibit_gsm (guint cookie)
         if (error != NULL) {
                 g_debug ("Uninhibit problem : %s", error->message);
                 g_error_free (error);
-                cookie = -1;
         }
         g_object_unref (G_OBJECT (proxy));
 }
commit 215150c54a2d58337571f76d8b3c26676672f36c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 9 14:39:05 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I9329233a85df26dcfd83002e50604a6ea4fb50f9

diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 7ea4892..88f119f 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -2018,10 +2018,6 @@ bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
                                       "has-backward-stepper", &has_backward,
                                          "has-secondary-backward-stepper", &has_backward2, nullptr );
     gint magic = trough_border ? 1 : 0;
-    gint nFirst = 0;
-
-    if ( has_backward )  nFirst  += 1;
-    if ( has_forward2 )  nFirst  += 1;
 
     if ( nPart == PART_DRAW_BACKGROUND_HORZ )
     {
commit 987203a2794df1a9d21a548eade79893d2c9aa36
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 9 14:36:58 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: Ic3464a466302b87fae70a63f2723d1355eccab6f

diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index ee6a1b8..7510add 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -108,7 +108,7 @@ static int sal_Shift( Pixel nMask )
     if( nMask < 0x01000000 ) { nMask <<=  8; i -=  8; }
     if( nMask < 0x10000000 ) { nMask <<=  4; i -=  4; }
     if( nMask < 0x40000000 ) { nMask <<=  2; i -=  2; }
-    if( nMask < 0x80000000 ) { nMask <<=  1; i -=  1; }
+    if( nMask < 0x80000000 ) {               i -=  1; }
     return i;
 }
 
commit 4a0ad999d29ae63db61f80c1b9ed9e76104015e7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 9 14:29:08 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I11b99fca91b266bdf6c29dc142511bf01dbd4bed

diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index c9fcb88..081947c 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -162,7 +162,6 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent)
     if( aKeyCode.GetCode() == KEY_F6 && ! aKeyCode.IsMod2() ) // F6
     {
         bool bSplitterOnly;
-        bool bFocusInList = false;
 
         bSplitterOnly = aKeyCode.IsMod1() && aKeyCode.IsShift();
 
@@ -173,8 +172,6 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent)
             vcl::Window *pWin = *p;
             if( pWin->HasChildPathFocus( true ) )
             {
-                bFocusInList = true;
-
                 // Ctrl-F6 goes directly to the document
                 if( !pWin->IsDialog() && aKeyCode.IsMod1() && !aKeyCode.IsShift() )
                 {
@@ -214,18 +211,15 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent)
         }
 
         // the focus is not in the list: activate first float if F6 was pressed
-        if( !bFocusInList )
+        vcl::Window *pWin;
+        if( bSplitterOnly )
+            pWin = FindNextSplitter( NULL );
+        else
+            pWin = FindNextFloat( NULL, bForward );
+        if( pWin )
         {
-            vcl::Window *pWin;
-            if( bSplitterOnly )
-                pWin = FindNextSplitter( NULL );
-            else
-                pWin = FindNextFloat( NULL, bForward );
-            if( pWin )
-            {
-                ImplTaskPaneListGrabFocus( pWin, bForward );
-                return true;
-            }
+            ImplTaskPaneListGrabFocus( pWin, bForward );
+            return true;
         }
     }
 
commit 8a8aa4b1af74a4f4bdd40271cc2ff0bd578252c2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 9 14:26:59 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: Ib9eae95b8ace37d31e905bc098c67de97b7816e3

diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 105ba5a..097f3ef 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -346,8 +346,6 @@ vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pParent, vcl::Window* pWindow,
     rFormStart = nFormStart;
 
     // find end of template
-    nFormEnd = nFormStart;
-    pTempWindow = pSWindow;
     sal_Int32 nIteration = 0;
     do
     {
commit a35df7f88161956f92e1d501c83a32f927268f98
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 9 14:22:17 2015 +0200

    Abstract out repeated code into lambdas
    
    ...to silence a clang-analyzer-deadcode.DeadStores on the last update of nLeft
    and nRight, each.  Also, adding a gap of 3 to nRight in case no further buttons
    will be layed out next to maDockRect resp. maHideRect is irrelevant, as nRight
    will not be used for any further layout computations in those cases.
    
    Change-Id: I251d4470099b1f98782ebdfd0c776d881bb7fae5

diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index cdc45bc..773aaa7 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1431,74 +1431,60 @@ void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeigh
 
         if ( pData->mnTitleType & (BORDERWINDOW_TITLE_NORMAL | BORDERWINDOW_TITLE_SMALL) )
         {
-            long nLeft          = pData->maTitleRect.Left();
-            long nRight         = pData->maTitleRect.Right();
-            long nItemTop       = pData->maTitleRect.Top();
-            long nItemBottom    = pData->maTitleRect.Bottom();
-            nLeft              += 1;
-            nRight             -= 3;
-            nItemTop           += 2;
-            nItemBottom        -= 2;
+            long nLeft          = pData->maTitleRect.Left() + 1;
+            long nRight         = pData->maTitleRect.Right() - 3;
+            long const nItemTop = pData->maTitleRect.Top() + 2;
+            long const nItemBottom = pData->maTitleRect.Bottom() - 2;
+
+            auto addOnLeft = [&nLeft, nItemTop, nItemBottom](
+                Rectangle & rect, long width, long gap)
+            {
+                rect.Top() = nItemTop;
+                rect.Bottom() = nItemBottom;
+                rect.Left() = nLeft;
+                rect.Right() = rect.Left() + width;
+                nLeft += rect.GetWidth() + gap;
+            };
+            auto addSquareOnRight = [&nRight, nItemTop, nItemBottom](
+                Rectangle & rect, long gap)
+            {
+                rect.Top() = nItemTop;
+                rect.Bottom() = nItemBottom;
+                rect.Right() = nRight;
+                rect.Left() = rect.Right() - rect.GetHeight() + 1;
+                nRight -= rect.GetWidth() + gap;
+            };
 
             if ( pBorderWindow->GetStyle() & WB_PINABLE )
             {
                 Image aImage;
                 ImplGetPinImage( DrawButtonFlags::NONE, false, aImage );
-                pData->maPinRect.Top()    = nItemTop;
-                pData->maPinRect.Bottom() = nItemBottom;
-                pData->maPinRect.Left()   = nLeft;
-                pData->maPinRect.Right()  = pData->maPinRect.Left()+aImage.GetSizePixel().Width();
-                nLeft += pData->maPinRect.GetWidth()+3;
+                addOnLeft(pData->maPinRect, aImage.GetSizePixel().Width(), 3);
             }
 
             if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
             {
-                pData->maCloseRect.Top()    = nItemTop;
-                pData->maCloseRect.Bottom() = nItemBottom;
-                pData->maCloseRect.Right()  = nRight;
-                pData->maCloseRect.Left()   = pData->maCloseRect.Right()-pData->maCloseRect.GetHeight()+1;
-                nRight -= pData->maCloseRect.GetWidth()+3;
+                addSquareOnRight(pData->maCloseRect, 3);
             }
 
             if ( pBorderWindow->mbMenuBtn )
             {
-                pData->maMenuRect.Top()    = nItemTop;
-                pData->maMenuRect.Bottom() = nItemBottom;
-                pData->maMenuRect.Right()  = nRight;
-                pData->maMenuRect.Left()   = pData->maMenuRect.Right()-pData->maMenuRect.GetHeight()+1;
-                nRight -= pData->maMenuRect.GetWidth();
+                addSquareOnRight(pData->maMenuRect, 0);
             }
 
             if ( pBorderWindow->mbDockBtn )
             {
-                pData->maDockRect.Top()    = nItemTop;
-                pData->maDockRect.Bottom() = nItemBottom;
-                pData->maDockRect.Right()  = nRight;
-                pData->maDockRect.Left()   = pData->maDockRect.Right()-pData->maDockRect.GetHeight()+1;
-                nRight -= pData->maDockRect.GetWidth();
-                if ( !pBorderWindow->mbHideBtn &&
-                     !(pBorderWindow->GetStyle() & WB_ROLLABLE) )
-                    nRight -= 3;
+                addSquareOnRight(pData->maDockRect, 0);
             }
 
             if ( pBorderWindow->mbHideBtn )
             {
-                pData->maHideRect.Top()    = nItemTop;
-                pData->maHideRect.Bottom() = nItemBottom;
-                pData->maHideRect.Right()  = nRight;
-                pData->maHideRect.Left()   = pData->maHideRect.Right()-pData->maHideRect.GetHeight()+1;
-                nRight -= pData->maHideRect.GetWidth();
-                if ( !(pBorderWindow->GetStyle() & WB_ROLLABLE) )
-                    nRight -= 3;
+                addSquareOnRight(pData->maHideRect, 0);
             }
 
             if ( pBorderWindow->GetStyle() & WB_ROLLABLE )
             {
-                pData->maRollRect.Top()    = nItemTop;
-                pData->maRollRect.Bottom() = nItemBottom;
-                pData->maRollRect.Right()  = nRight;
-                pData->maRollRect.Left()   = pData->maRollRect.Right()-pData->maRollRect.GetHeight()+1;
-                nRight -= pData->maRollRect.GetWidth();
+                addSquareOnRight(pData->maRollRect, 0);
             }
         }
         else


More information about the Libreoffice-commits mailing list