From 00ddb9d3984643fab6352518d8355b24a5d3913d Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 15 Oct 2007 21:17:32 +0200 Subject: [PATCH] bugfix: restore focus after swapprev/next --- client.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/client.c b/client.c index b1c25a0b..8f6c9c78 100644 --- a/client.c +++ b/client.c @@ -725,16 +725,18 @@ void uicb_swapnext(awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { - Client *next; + Client *next, *sel = *awesomeconf->client_sel; - if(!*awesomeconf->client_sel) + if(!sel) return; - for(next = (*awesomeconf->client_sel)->next; next && !isvisible(next, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); next = next->next); + for(next = sel->next; next && !isvisible(next, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); next = next->next); if(next) { client_swap(awesomeconf->clients, *awesomeconf->client_sel, next); arrange(awesomeconf); + /* restore focus */ + focus(sel, True, awesomeconf); } } @@ -742,16 +744,18 @@ void uicb_swapprev(awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { - Client *prev; + Client *prev, *sel = *awesomeconf->client_sel; - if(!*awesomeconf->client_sel) + if(!sel) return; - for(prev = (*awesomeconf->client_sel)->prev; prev && !isvisible(prev, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); prev = prev->prev); + for(prev = sel->prev; prev && !isvisible(prev, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); prev = prev->prev); if(prev) { client_swap(awesomeconf->clients, prev, *awesomeconf->client_sel); arrange(awesomeconf); + /* restore focus */ + focus(sel, True, awesomeconf); } }