bugfix: restore focus after swapprev/next

This commit is contained in:
Julien Danjou 2007-10-15 21:17:32 +02:00
parent 035bf83f59
commit 00ddb9d398
1 changed files with 10 additions and 6 deletions

View File

@ -725,16 +725,18 @@ void
uicb_swapnext(awesome_config *awesomeconf, uicb_swapnext(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused))) const char *arg __attribute__ ((unused)))
{ {
Client *next; Client *next, *sel = *awesomeconf->client_sel;
if(!*awesomeconf->client_sel) if(!sel)
return; 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) if(next)
{ {
client_swap(awesomeconf->clients, *awesomeconf->client_sel, next); client_swap(awesomeconf->clients, *awesomeconf->client_sel, next);
arrange(awesomeconf); arrange(awesomeconf);
/* restore focus */
focus(sel, True, awesomeconf);
} }
} }
@ -742,16 +744,18 @@ void
uicb_swapprev(awesome_config *awesomeconf, uicb_swapprev(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused))) const char *arg __attribute__ ((unused)))
{ {
Client *prev; Client *prev, *sel = *awesomeconf->client_sel;
if(!*awesomeconf->client_sel) if(!sel)
return; 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) if(prev)
{ {
client_swap(awesomeconf->clients, prev, *awesomeconf->client_sel); client_swap(awesomeconf->clients, prev, *awesomeconf->client_sel);
arrange(awesomeconf); arrange(awesomeconf);
/* restore focus */
focus(sel, True, awesomeconf);
} }
} }