naughty: notify{run} gets notification object argument (FS#398)
[awesome.git] / client.h
blob5e403c0663b7f9bcae91a1f4d42d263e93faaa78
1 /*
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
25 #include "mouse.h"
26 #include "stack.h"
27 #include "common/list.h"
29 static void
30 client_delete(client_t **c)
32 button_array_wipe(&(*c)->buttons);
33 p_delete(&(*c)->icon_path);
34 p_delete(&(*c)->name);
35 p_delete(c);
38 ARRAY_FUNCS(client_t *, client, DO_NOTHING)
39 DO_RCNT(client_t, client, client_delete)
41 #define client_need_arrange(c) \
42 do { \
43 if(!globalconf.screens[(c)->screen].need_arrange \
44 && client_isvisible(c, (c)->screen)) \
45 globalconf.screens[(c)->screen].need_arrange = true; \
46 } while(0)
48 bool client_maybevisible(client_t *, int);
49 client_t * client_getbywin(xcb_window_t);
50 void client_stack(void);
51 void client_ban(client_t *);
52 void client_unban(client_t *);
53 void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, int);
54 area_t client_geometry_hints(client_t *, area_t);
55 void client_resize(client_t *, area_t, bool);
56 void client_unmanage(client_t *);
57 void client_saveprops_tags(client_t *);
58 void client_kill(client_t *);
59 void client_setsticky(client_t *, bool);
60 void client_setabove(client_t *, bool);
61 void client_setbelow(client_t *, bool);
62 void client_setmodal(client_t *, bool);
63 void client_setontop(client_t *, bool);
64 void client_setfullscreen(client_t *, bool);
65 void client_setmaxhoriz(client_t *, bool);
66 void client_setmaxvert(client_t *, bool);
67 void client_setminimized(client_t *, bool);
68 void client_setborder(client_t *, int);
70 int luaA_client_newindex(lua_State *);
72 int luaA_client_userdata_new(lua_State *, client_t *);
74 DO_SLIST(client_t, client, client_unref)
76 /** Put client on top of the stack.
77 * \param c The client to raise.
79 static inline void
80 client_raise(client_t *c)
82 /* Push c on top of the stack. */
83 if(c->transient_for)
84 stack_client_push(c->transient_for);
85 stack_client_push(c);
86 client_stack();
89 /** Put client on the end of the stack.
90 * \param c The client to lower.
92 static inline void
93 client_lower(client_t *c)
95 stack_client_append(c);
96 if(c->transient_for)
97 stack_client_append(c->transient_for);
98 client_stack();
101 /** Check if a client has fixed size.
102 * \param c A client.
103 * \return A boolean value, true if the client has a fixed size.
105 static inline bool
106 client_isfixed(client_t *c)
108 return (c->maxw && c->minw && c->maxh && c->minh
109 && c->maxw == c->minw && c->maxh == c->minh);
112 /** Returns true if a client is tagged
113 * with one of the tags of the specified screen and is not hidden.
114 * \param c The client to check.
115 * \param screen Virtual screen number.
116 * \return true if the client is visible, false otherwise.
118 static inline bool
119 client_isvisible_exclude_banned(client_t *c, int screen)
121 return (!c->ishidden && !c->isminimized && client_maybevisible(c, screen));
124 /** Returns true if a client is tagged
125 * with one of the tags of the specified screen and is not hidden or banned.
126 * \param c The client to check.
127 * \param screen Virtual screen number.
128 * \return true if the client is visible, false otherwise.
130 static inline bool
131 client_isvisible(client_t *c, int screen)
133 return (client_isvisible_exclude_banned(c, screen) && !c->isbanned);
136 /** Check if a client has strut information.
137 * \param c A client.
138 * \return A boolean value, true if the client has strut information.
140 static inline bool
141 client_hasstrut(client_t *c)
143 return (c->strut.left
144 || c->strut.right
145 || c->strut.top
146 || c->strut.bottom
147 || c->strut.left_start_y
148 || c->strut.left_end_y
149 || c->strut.right_start_y
150 || c->strut.right_end_y
151 || c->strut.top_start_x
152 || c->strut.top_end_x
153 || c->strut.bottom_start_x
154 || c->strut.bottom_end_x);
157 #endif
158 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80