2 * client.h - client management header
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.
22 #ifndef AWESOME_CLIENT_H
23 #define AWESOME_CLIENT_H
27 #include "common/list.h"
29 #define CLIENT_SELECT_INPUT_EVENT_MASK (XCB_EVENT_MASK_STRUCTURE_NOTIFY \
30 | XCB_EVENT_MASK_PROPERTY_CHANGE \
31 | XCB_EVENT_MASK_ENTER_WINDOW \
32 | XCB_EVENT_MASK_LEAVE_WINDOW \
33 | XCB_EVENT_MASK_FOCUS_CHANGE)
35 client_t
* luaA_client_checkudata(lua_State
*, int);
37 ARRAY_FUNCS(client_t
*, client
, DO_NOTHING
)
38 LUA_OBJECT_FUNCS(client_t
, client
, "client")
40 #define client_need_arrange(c) \
42 if(!globalconf.screens[(c)->screen].need_arrange \
43 && client_isvisible(c, (c)->screen)) \
44 globalconf.screens[(c)->screen].need_arrange = true; \
47 bool client_maybevisible(client_t
*, int);
48 client_t
* client_getbywin(xcb_window_t
);
49 void client_ban(client_t
*);
50 void client_unban(client_t
*);
51 void client_manage(xcb_window_t
, xcb_get_geometry_reply_t
*, int, bool);
52 area_t
client_geometry_hints(client_t
*, area_t
);
53 bool client_resize(client_t
*, area_t
, bool);
54 void client_update_strut_positions(int);
55 void client_unmanage(client_t
*);
56 void client_kill(client_t
*);
57 void client_setsticky(client_t
*, bool);
58 void client_setabove(client_t
*, bool);
59 void client_setbelow(client_t
*, bool);
60 void client_setmodal(client_t
*, bool);
61 void client_setontop(client_t
*, bool);
62 void client_setfullscreen(client_t
*, bool);
63 void client_setmaxhoriz(client_t
*, bool);
64 void client_setmaxvert(client_t
*, bool);
65 void client_setminimized(client_t
*, bool);
66 void client_setborder(client_t
*, int);
67 void client_seturgent(client_t
*, bool);
68 void client_focus(client_t
*);
69 void client_focus_update(client_t
*);
70 void client_unfocus(client_t
*);
71 void client_unfocus_update(client_t
*);
72 void client_stack_refresh(void);
77 globalconf
.client_need_stack_refresh
= true;
80 /** Put client on top of the stack.
81 * \param c The client to raise.
84 client_raise(client_t
*c
)
89 /* Find number of transient layers. */
90 for(counter
= 0; tc
->transient_for
; counter
++)
91 tc
= tc
->transient_for
;
93 /* Push them in reverse order. */
94 for(; counter
> 0; counter
--)
97 for(int i
= 0; i
< counter
; i
++)
98 tc
= tc
->transient_for
;
99 stack_client_push(tc
);
102 /* Push c on top of the stack. */
103 stack_client_push(c
);
107 /** Put client on the end of the stack.
108 * \param c The client to lower.
111 client_lower(client_t
*c
)
113 stack_client_append(c
);
115 /* Traverse all transient layers. */
116 for(client_t
*tc
= c
->transient_for
; tc
; tc
= tc
->transient_for
)
117 stack_client_append(tc
);
122 /** Check if a client has fixed size.
124 * \return A boolean value, true if the client has a fixed size.
127 client_isfixed(client_t
*c
)
129 return (c
->size_hints
.flags
& XCB_SIZE_HINT_P_MAX_SIZE
130 && c
->size_hints
.flags
& XCB_SIZE_HINT_P_MIN_SIZE
131 && c
->size_hints
.max_width
== c
->size_hints
.min_width
132 && c
->size_hints
.max_height
== c
->size_hints
.min_height
133 && c
->size_hints
.max_width
134 && c
->size_hints
.max_height
);
137 /** Returns true if a client is tagged with one of the tags of the
138 * specified screen and is not hidden. Note that "banned" clients are included.
139 * \param c The client to check.
140 * \param screen Virtual screen number.
141 * \return true if the client is visible, false otherwise.
144 client_isvisible(client_t
*c
, int screen
)
146 return (!c
->ishidden
&& !c
->isminimized
&& client_maybevisible(c
, screen
));
149 /** Check if a client has strut information.
151 * \return A boolean value, true if the client has strut information.
154 client_hasstrut(client_t
*c
)
156 return (c
->strut
.left
160 || c
->strut
.left_start_y
161 || c
->strut
.left_end_y
162 || c
->strut
.right_start_y
163 || c
->strut
.right_end_y
164 || c
->strut
.top_start_x
165 || c
->strut
.top_end_x
166 || c
->strut
.bottom_start_x
167 || c
->strut
.bottom_end_x
);
171 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80