add client_find_next_visible()

This commit is contained in:
Julien Danjou 2008-01-17 14:43:15 +01:00
parent bda97fa36d
commit 2f8978c15b
2 changed files with 32 additions and 26 deletions

View File

@ -669,31 +669,7 @@ uicb_client_settrans(int screen __attribute__ ((unused)), char *arg)
window_settrans(sel->win, delta);
}
/** Swap current with next client
* \param screen Screen ID
* \param arg nothing
* \ingroup ui_callback
*/
void
uicb_client_swapnext(int screen, char *arg __attribute__ ((unused)))
{
Client *next, *sel = globalconf.focus->client;
if(!sel)
return;
for(next = sel->next; next && !client_isvisible(next, screen); next = next->next);
if(!next)
for(next = globalconf.clients; next && !client_isvisible(next, screen); next = next->next);
if(next)
{
client_list_swap(&globalconf.clients, sel, next);
arrange(screen);
}
}
Client *
static Client *
client_find_prev_visible(Client *sel)
{
Client *prev = NULL;
@ -708,6 +684,20 @@ client_find_prev_visible(Client *sel)
return prev;
}
static Client *
client_find_next_visible(Client *sel)
{
Client *next = NULL;
if(!sel) return NULL;
for(next = sel->next; next && !client_isvisible(next, sel->screen); next = next->next);
if(!next)
for(next = globalconf.clients; next && !client_isvisible(next, sel->screen); next = next->next);
return next;
}
/** Swap current with previous client
* \param screen Screen ID
* \param arg nothing
@ -725,6 +715,23 @@ uicb_client_swapprev(int screen, char *arg __attribute__ ((unused)))
}
}
/** Swap current with next client
* \param screen Screen ID
* \param arg nothing
* \ingroup ui_callback
*/
void
uicb_client_swapnext(int screen, char *arg __attribute__ ((unused)))
{
Client *next;
if((next = client_find_next_visible(globalconf.focus->client)))
{
client_list_swap(&globalconf.clients, globalconf.focus->client, next);
arrange(screen);
}
}
/** Move and resize client
* \param screen Screen ID
* \param arg x y w h

View File

@ -27,7 +27,6 @@
Bool client_isvisible(Client *, int);
Client * get_client_bywin(Client *, Window);
Client * get_client_byname(Client *, char *);
Client * client_find_prev_visible(Client *);
void client_ban(Client *);
void focus(Client *, Bool, int);
void client_manage(Window, XWindowAttributes *, int);