luaa: merge tostring() with DO_LUA_NEW
[awesome.git] / client.h
blob2b05a9c4966348641454fce9648ca3a5fb9112ae
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"
28 static void
29 client_delete(client_t **c)
31 button_array_wipe(&(*c)->buttons);
32 p_delete(&(*c)->icon_path);
33 p_delete(&(*c)->name);
34 p_delete(c);
37 ARRAY_FUNCS(client_t *, client, DO_NOTHING)
38 DO_RCNT(client_t, client, client_delete)
40 #define client_need_arrange(c) \
41 do { \
42 if(!globalconf.screens[(c)->screen].need_arrange \
43 && client_isvisible(c, (c)->screen)) \
44 globalconf.screens[(c)->screen].need_arrange = true; \
45 } while(0)
47 bool client_maybevisible(client_t *, int);
48 client_t * client_getbywin(xcb_window_t);
49 void client_stack(void);
50 void client_ban(client_t *);
51 void client_unban(client_t *);
52 void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, int);
53 area_t client_geometry_hints(client_t *, area_t);
54 void client_resize(client_t *, area_t, bool);
55 void client_unmanage(client_t *);
56 void client_saveprops_tags(client_t *);
57 void client_kill(client_t *);
58 void client_setfloating(client_t *, bool);
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_setminimized(client_t *, bool);
66 void client_setborder(client_t *, int);
68 int luaA_client_newindex(lua_State *);
70 int luaA_client_userdata_new(lua_State *, client_t *);
72 DO_SLIST(client_t, client, client_unref)
74 /** Put client on top of the stack
75 * \param c The client to raise.
77 static inline void
78 client_raise(client_t *c)
80 /* Push c on top of the stack. */
81 stack_client_push(c);
82 client_stack();
85 /** Check if a client has fixed size.
86 * \param c A client.
87 * \return A boolean value, true if the client has a fixed size.
89 static inline bool
90 client_isfixed(client_t *c)
92 return (c->maxw && c->minw && c->maxh && c->minh
93 && c->maxw == c->minw && c->maxh == c->minh);
97 /** Check if a client is floating.
98 * \param c A client.
99 * \return A boolean value, true if the client is floating.
101 static inline bool
102 client_isfloating(client_t *c)
104 return (c->type != WINDOW_TYPE_NORMAL
105 || c->isfloating
106 || c->isfullscreen
107 || client_isfixed(c));
110 /** Returns true if a client is tagged
111 * with one of the tags of the specified screen and is not hidden.
112 * \param c The client to check.
113 * \param screen Virtual screen number.
114 * \return true if the client is visible, false otherwise.
116 static inline bool
117 client_isvisible(client_t *c, int screen)
119 return (!c->ishidden && !c->isminimized && client_maybevisible(c, screen));
122 /** Check if a client has strut information.
123 * \param c A client.
124 * \return A boolean value, true if the client has strut information.
126 static inline bool
127 client_hasstrut(client_t *c)
129 return (c->strut.left
130 || c->strut.right
131 || c->strut.top
132 || c->strut.bottom
133 || c->strut.left_start_y
134 || c->strut.left_end_y
135 || c->strut.right_start_y
136 || c->strut.right_end_y
137 || c->strut.top_start_x
138 || c->strut.top_end_x
139 || c->strut.bottom_start_x
140 || c->strut.bottom_end_x);
143 #endif
144 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80