[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdecore
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2004-11-29 0:18:02
Message-ID: 20041129001802.7D9D91160A () office ! kde ! org
[Download RAW message or body]

CVS commit by aseigo: 

small optimization. use findIndex rather than contains to figure if the
winID is in our QValueLists, as findIndex using ConstIterators and stops at
the first instance of the item in the list while contains goes through the
whole list counting the total number of matches. noticed this while plant-
ing debug msgs here while working on kicker's stacking/strut handling
code.


  M +7 -7      kwinmodule.cpp   1.66


--- kdelibs/kdecore/kwinmodule.cpp  #1.65:1.66
@@ -156,5 +156,5 @@ const QValueList<WId>& KWinModule::stack
 bool KWinModule::hasWId(WId w) const
 {
-    return d->windows.contains( w );
+    return d->windows.findIndex( w ) != -1;
 }
 
@@ -192,5 +192,5 @@ bool KWinModulePrivate::x11Event( XEvent
                 emit (*mit)->stackingOrderChanged();
         }
-    } else  if ( windows.contains( ev->xany.window ) ){
+    } else  if ( windows.findIndex( ev->xany.window ) != -1 ){
         NETWinInfo ni( qt_xdisplay(), ev->xany.window, qt_xrootwin(), 0 );
         unsigned long dirty[ 2 ];
@@ -206,5 +206,5 @@ bool KWinModulePrivate::x11Event( XEvent
         if ( (dirty[ NETWinInfo::PROTOCOLS ] & NET::WMStrut) != 0 ) {
             removeStrutWindow( ev->xany.window );
-            if ( !possibleStrutWindows.contains( ev->xany.window )  )
+            if ( !possibleStrutWindows.findIndex( ev->xany.window ) != -1  )
                 possibleStrutWindows.append( ev->xany.window );
         }
@@ -267,5 +267,5 @@ void KWinModulePrivate::removeClient(Win
 {
     bool emit_strutChanged = removeStrutWindow( w );
-    if( strutSignalConnected && possibleStrutWindows.contains( w ) && modules.count() > 0 ) {
+    if( strutSignalConnected && possibleStrutWindows.findIndex( w ) != -1 && modules.count() > 0 ) {
         NETWinInfo info( qt_xdisplay(), w, qt_xrootwin(), NET::WMStrut );
         NETStrut strut = info.strut();
@@ -334,5 +334,5 @@ QRect KWinModule::workArea( const QValue
     for( it1 = d->windows.begin(); it1 != d->windows.end(); ++it1 ) {
 
-        if(exclude.contains(*it1) > 0) continue;
+        if(exclude.findIndex(*it1) != -1) continue;
         
 // Kicker (very) extensively calls this function, causing hundreds of roundtrips just
@@ -350,5 +350,5 @@ QRect KWinModule::workArea( const QValue
                 continue;
             strut = (*it2).strut;
-        } else if( d->possibleStrutWindows.contains( *it1 )) {
+        } else if( d->possibleStrutWindows.findIndex( *it1 ) != -1 ) {
             NETWinInfo info( qt_xdisplay(), (*it1), qt_xrootwin(), NET::WMStrut | NET::WMDesktop);
             strut = info.strut();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic