From 7b5b02416afc404f286f2c50ed6af590e6f83e7f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 18 Jan 2008 09:49:04 +0100 Subject: [PATCH] fix a bug in the tasklist loop that made clicking on tasklist focusing a wrong client --- widgets/tasklist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/widgets/tasklist.c b/widgets/tasklist.c index f7227916..420ad129 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -151,7 +151,7 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev) Client *c; Data *d = widget->data; Tag *tag; - int n = 0, box_width = 0, i = 0, ci = 0; + int n = 0, box_width = 0, i, ci = 0; /* button1 give focus */ if(ev->button == Button1 && CLEANMASK(ev->state) == NoSymbol) @@ -185,9 +185,10 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev) c && !ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all); c = c->next); /* found ci-th visible client */ - for(; c && i < ci; c = c->next) + for(i = 0; c ; c = c->next) if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all)) - i++; + if(i++ >= ci) + break; if(c) {