From 669baf827bd49a7420253a5d1afdfc14683c2f6d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 23 Dec 2015 08:49:34 +0200 Subject: [PATCH] Add an early return to reorder_window This avoids a linear search in case the window is already at the right position. --- source/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/main.c b/source/main.c index 34e05b1..43e130b 100644 --- a/source/main.c +++ b/source/main.c @@ -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; jnwindows; ++j) -- 2.43.0