2 * focus.c - focus management
4 * Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 extern awesome_t globalconf
;
28 /** Push the client at the beginning of the client focus history stack.
29 * \param c The client to push.
32 focus_client_push(client_t
*c
)
34 client_node_t
*node
= client_node_client_add(&globalconf
.focus
, c
);
35 client_node_list_push(&globalconf
.focus
, node
);
38 /** Append the client at the end of the client focus history stack.
39 * \param c The client to append.
42 focus_client_append(client_t
*c
)
44 client_node_t
*node
= client_node_client_add(&globalconf
.focus
, c
);
45 client_node_list_append(&globalconf
.focus
, node
);
48 /** Remove a client from focus history.
49 * \param c The client.
52 focus_client_delete(client_t
*c
)
54 client_node_t
*node
= client_node_client_getby(globalconf
.focus
, c
);
58 client_node_list_detach(&globalconf
.focus
, node
);
64 focus_get_latest_client_for_tags(tag_t
**t
, int nindex
)
70 for(node
= globalconf
.focus
; node
; node
= node
->next
)
71 if(node
->client
&& !node
->client
->skip
&& !node
->client
->ishidden
)
72 for(tags
= t
; *tags
; tags
++)
73 if(is_client_tagged(node
->client
, *tags
))
79 /** Get the latest focused client on a screen.
80 * \param screen The virtual screen number.
81 * \return A pointer to an existing client.
84 focus_get_current_client(int screen
)
86 tag_t
**curtags
= tags_get_current(screen
);
87 client_t
*sel
= focus_get_latest_client_for_tags(curtags
, 0);
93 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80