add client_find_next_visible()
This commit is contained in:
parent
bda97fa36d
commit
2f8978c15b
57
client.c
57
client.c
|
@ -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
|
||||
|
|
1
client.h
1
client.h
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue