]> git.tdb.fi Git - geometrycompositor.git/commitdiff
Add an early return to reorder_window master
authorMikko Rasa <tdb@tdb.fi>
Wed, 23 Dec 2015 06:49:34 +0000 (08:49 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 23 Dec 2015 06:49:34 +0000 (08:49 +0200)
This avoids a linear search in case the window is already at the right
position.

source/main.c

index 34e05b1a97d1c30804ba782b8741f6df3ce24329..43e130b9a33b63a37ee2ff258dc0761b9c049e4f 100644 (file)
@@ -555,6 +555,9 @@ CompositedWindow *reorder_window(CompositedScreen *screen, CompositedWindow *win
        CompositedWindow hold;
 
        i = window-screen->windows;
+       if((i>0 && screen->windows[i-1].window==above) || (i==0 && !above))
+               return window;
+
        if(above)
        {
                for(j=0; j<screen->nwindows; ++j)