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

Julien Nabet serval2412 at yahoo.fr
Sun Dec 10 13:47:14 UTC 2017


 vcl/unx/generic/dtrans/X11_droptarget.cxx |   16 ++++++------
 vcl/unx/generic/window/salframe.cxx       |   38 ++++++++++++------------------
 vcl/unx/generic/window/salobj.cxx         |    4 +--
 vcl/unx/gtk/gtksalframe.cxx               |   12 ++++-----
 vcl/unx/gtk3/gtk3gtkframe.cxx             |    8 +++---
 5 files changed, 36 insertions(+), 42 deletions(-)

New commits:
commit f5c9593a7bab7af14feb88a74d757b2640e3149f
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Dec 10 12:58:40 2017 +0100

    Use some for range loops in vcl
    
    Change-Id: I58a334e4d1252b2addd6784ab60d15b60593f722
    Reviewed-on: https://gerrit.libreoffice.org/46184
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/unx/generic/dtrans/X11_droptarget.cxx b/vcl/unx/generic/dtrans/X11_droptarget.cxx
index 46acd06c3cc6..94040b39e528 100644
--- a/vcl/unx/generic/dtrans/X11_droptarget.cxx
+++ b/vcl/unx/generic/dtrans/X11_droptarget.cxx
@@ -116,9 +116,9 @@ void DropTarget::drop( const DropTargetDropEvent& dtde ) throw()
     std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
     aGuard.clear();
 
-    for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
+    for (auto const& listener : aListeners)
     {
-        (*it)->drop( dtde );
+        listener->drop(dtde);
     }
 }
 
@@ -128,9 +128,9 @@ void DropTarget::dragEnter( const DropTargetDragEnterEvent& dtde ) throw()
     std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
     aGuard.clear();
 
-    for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
+    for (auto const& listener : aListeners)
     {
-        (*it)->dragEnter( dtde );
+        listener->dragEnter(dtde);
     }
 }
 
@@ -140,9 +140,9 @@ void DropTarget::dragExit( const DropTargetEvent& dte ) throw()
     std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
     aGuard.clear();
 
-    for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
+    for (auto const& listener : aListeners)
     {
-        (*it)->dragExit( dte );
+        listener->dragExit(dte);
     }
 }
 
@@ -152,9 +152,9 @@ void DropTarget::dragOver( const DropTargetDragEvent& dtde ) throw()
     std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
     aGuard.clear();
 
-    for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
+    for (auto const& listener : aListeners)
     {
-        (*it)->dragOver( dtde );
+        listener->dragOver(dtde);
     }
 }
 
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index f88e9b6219a8..8d489cbe46c9 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1348,11 +1348,10 @@ void X11SalFrame::Show( bool bVisible, bool bNoActivate )
             && ! IsFloatGrabWindow()
             )
         {
-            for( std::list< X11SalFrame* >::const_iterator it = maChildren.begin();
-                 it != maChildren.end(); ++it )
+            for (auto const& child : maChildren)
             {
-                if( (*it)->mbTransientForRoot )
-                    GetDisplay()->getWMAdaptor()->changeReferenceFrame( *it, this );
+                if( child->mbTransientForRoot )
+                    GetDisplay()->getWMAdaptor()->changeReferenceFrame( child, this );
             }
         }
         /*
@@ -2140,9 +2139,8 @@ void X11SalFrame::SetApplicationID( const OUString &rWMClass )
     {
         m_sWMClass = rWMClass;
         updateWMClass();
-        std::list< X11SalFrame* >::const_iterator it;
-        for( it = maChildren.begin(); it != maChildren.end(); ++it )
-            (*it)->SetApplicationID(rWMClass);
+        for (auto const& child : maChildren)
+            child->SetApplicationID(rWMClass);
     }
 }
 
@@ -2515,8 +2513,8 @@ void X11SalFrame::createNewWindow( ::Window aNewParent, SalX11Screen nXScreen )
         Show( true );
 
     std::list< X11SalFrame* > aChildren = maChildren;
-    for( std::list< X11SalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it )
-        (*it)->createNewWindow( None, m_nXScreen );
+    for (auto const& child : aChildren)
+        child->createNewWindow( None, m_nXScreen );
 
     // FIXME: SalObjects
 }
@@ -3448,32 +3446,29 @@ void X11SalFrame::RestackChildren( ::Window* pTopLevelWindows, int nTopLevelWind
         if( nWindow < 0 )
             return;
 
-        std::list< X11SalFrame* >::const_iterator it;
-        for( it = maChildren.begin(); it != maChildren.end(); ++it )
+        for (auto const& child : maChildren)
         {
-            X11SalFrame* pData = *it;
-            if( pData->bMapped_ )
+            if( child->bMapped_ )
             {
                 int nChild = nWindow;
                 while( nChild-- )
                 {
-                    if( pTopLevelWindows[nChild] == pData->GetStackingWindow() )
+                    if( pTopLevelWindows[nChild] == child->GetStackingWindow() )
                     {
                         // if a child is behind its parent, place it above the
                         // parent (for insane WMs like Dtwm and olwm)
                         XWindowChanges aCfg;
                         aCfg.sibling    = GetStackingWindow();
                         aCfg.stack_mode = Above;
-                        XConfigureWindow( GetXDisplay(), pData->GetStackingWindow(), CWSibling|CWStackMode, &aCfg );
+                        XConfigureWindow( GetXDisplay(), child->GetStackingWindow(), CWSibling|CWStackMode, &aCfg );
                         break;
                     }
                 }
             }
         }
-        for( it = maChildren.begin(); it != maChildren.end(); ++it )
+        for (auto const& child : maChildren)
         {
-            X11SalFrame* pData = *it;
-            pData->RestackChildren( pTopLevelWindows, nTopLevelWindows );
+            child->RestackChildren( pTopLevelWindows, nTopLevelWindows );
         }
     }
 }
@@ -3994,11 +3989,10 @@ bool X11SalFrame::Dispatch( XEvent *pEvent )
                         && ! IsFloatGrabWindow()
                         )
                     {
-                        for( std::list< X11SalFrame* >::const_iterator it = maChildren.begin();
-                             it != maChildren.end(); ++it )
+                        for (auto const& child : maChildren)
                         {
-                            if( (*it)->mbTransientForRoot )
-                                pDisplay_->getWMAdaptor()->changeReferenceFrame( *it, this );
+                            if( child->mbTransientForRoot )
+                                pDisplay_->getWMAdaptor()->changeReferenceFrame( child, this );
                         }
                     }
 
diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx
index 9d0833094c1d..425bec45ec26 100644
--- a/vcl/unx/generic/window/salobj.cxx
+++ b/vcl/unx/generic/window/salobj.cxx
@@ -384,9 +384,9 @@ bool X11SalObject::Dispatch( XEvent* pEvent )
 {
     std::list< SalObject* >& rObjects = vcl_sal::getSalDisplay(GetGenericUnixSalData())->getSalObjects();
 
-    for( std::list< SalObject* >::iterator it = rObjects.begin(); it != rObjects.end(); ++it )
+    for (auto const& elem : rObjects)
     {
-        X11SalObject* pObject = static_cast<X11SalObject*>(*it);
+        X11SalObject* pObject = static_cast<X11SalObject*>(elem);
         if( pEvent->xany.window == pObject->maPrimary ||
             pEvent->xany.window == pObject->maSecondary )
         {
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index c0bbf1303b1a..a55f582ab921 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -2009,8 +2009,8 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, tools::Rect
     if( m_pParent && gtk_widget_get_screen( m_pParent->m_pWindow ) != pScreen )
         SetParent( nullptr );
     std::list< GtkSalFrame* > aChildren = m_aChildren;
-    for( std::list< GtkSalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it )
-        (*it)->SetScreen( nNewScreen, SetType::RetainSize );
+    for (auto const& child : aChildren)
+        child->SetScreen( nNewScreen, SetType::RetainSize );
 
     m_bDefaultPos = m_bDefaultSize = false;
     updateScreenNumber();
@@ -2057,8 +2057,8 @@ void GtkSalFrame::SetApplicationID( const OUString &rWMClass )
         m_sWMClass = rWMClass;
         updateWMClass();
 
-        for( std::list< GtkSalFrame* >::iterator it = m_aChildren.begin(); it != m_aChildren.end(); ++it )
-            (*it)->SetApplicationID(rWMClass);
+        for (auto const& child : m_aChildren)
+            child->SetApplicationID(rWMClass);
     }
 }
 
@@ -2563,8 +2563,8 @@ void GtkSalFrame::createNewWindow( ::Window aNewParent, bool bXEmbed, SalX11Scre
 
     std::list< GtkSalFrame* > aChildren = m_aChildren;
     m_aChildren.clear();
-    for( std::list< GtkSalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it )
-        (*it)->createNewWindow( None, false, m_nXScreen );
+    for (auto const& child : aChildren)
+        child->createNewWindow( None, false, m_nXScreen );
 
     // FIXME: SalObjects
 }
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 1f90760f7666..c71a22852e72 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1922,8 +1922,8 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, tools::Rect
     if( m_pParent && gtk_widget_get_screen( m_pParent->m_pWindow ) != pScreen )
         SetParent( nullptr );
     std::list< GtkSalFrame* > aChildren = m_aChildren;
-    for( std::list< GtkSalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it )
-        (*it)->SetScreen( nNewScreen, SetType::RetainSize );
+    for (auto const& child : aChildren)
+        child->SetScreen( nNewScreen, SetType::RetainSize );
 
     m_bDefaultPos = m_bDefaultSize = false;
     updateScreenNumber();
@@ -1969,8 +1969,8 @@ void GtkSalFrame::SetApplicationID( const OUString &rWMClass )
         m_sWMClass = rWMClass;
         updateWMClass();
 
-        for( std::list< GtkSalFrame* >::iterator it = m_aChildren.begin(); it != m_aChildren.end(); ++it )
-            (*it)->SetApplicationID(rWMClass);
+        for (auto const& child : m_aChildren)
+            child->SetApplicationID(rWMClass);
     }
 }
 


More information about the Libreoffice-commits mailing list