client: add property hook
[awesome.git] / client.h
blob9315e2f8befdc11ef46a3d0afae609d0fdb39f17
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 <xcb/xcb_icccm.h>
27 #include "structs.h"
28 #include "stack.h"
30 #define client_need_arrange(c) \
31 do { \
32 if(!globalconf.screens[(c)->screen].need_arrange \
33 && client_isvisible(c, (c)->screen)) \
34 globalconf.screens[(c)->screen].need_arrange = true; \
35 } while(0)
37 bool client_maybevisible(client_t *, int);
38 client_t * client_getbywin(xcb_window_t);
39 void client_stack(void);
40 void client_ban(client_t *);
41 void client_unban(client_t *);
42 void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, int);
43 area_t client_geometry_hints(client_t *, area_t);
44 void client_resize(client_t *, area_t, bool);
45 void client_unmanage(client_t *);
46 void client_saveprops_tags(client_t *);
47 void client_kill(client_t *);
48 void client_setfloating(client_t *, bool);
49 void client_setsticky(client_t *, bool);
50 void client_setabove(client_t *, bool);
51 void client_setbelow(client_t *, bool);
52 void client_setmodal(client_t *, bool);
53 void client_setontop(client_t *, bool);
54 void client_setfullscreen(client_t *, bool);
55 void client_setminimized(client_t *, bool);
56 void client_setborder(client_t *, int);
58 int luaA_client_newindex(lua_State *);
60 int luaA_client_userdata_new(lua_State *, client_t *);
62 DO_SLIST(client_t, client, client_unref)
64 /** Put client on top of the stack
65 * \param c The client to raise.
67 static inline void
68 client_raise(client_t *c)
70 /* Push c on top of the stack. */
71 stack_client_push(c);
72 client_stack();
75 /** Check if a client has fixed size.
76 * \param c A client.
77 * \return A boolean value, true if the client has a fixed size.
79 static inline bool
80 client_isfixed(client_t *c)
82 return (c->maxw && c->minw && c->maxh && c->minh
83 && c->maxw == c->minw && c->maxh == c->minh);
87 /** Check if a client is floating.
88 * \param c A client.
89 * \return A boolean value, true if the client is floating.
91 static inline bool
92 client_isfloating(client_t *c)
94 return (c->type != WINDOW_TYPE_NORMAL
95 || c->isfloating
96 || c->isfullscreen
97 || client_isfixed(c));
100 /** Returns true if a client is tagged
101 * with one of the tags of the specified screen and is not hidden.
102 * \param c The client to check.
103 * \param screen Virtual screen number.
104 * \return true if the client is visible, false otherwise.
106 static inline bool
107 client_isvisible(client_t *c, int screen)
109 return (!c->ishidden && !c->isminimized && client_maybevisible(c, screen));
112 /** Check if a client has strut information.
113 * \param c A client.
114 * \return A boolean value, true if the client has strut information.
116 static inline bool
117 client_hasstrut(client_t *c)
119 return (c->strut.left
120 || c->strut.right
121 || c->strut.top
122 || c->strut.bottom
123 || c->strut.left_start_y
124 || c->strut.left_end_y
125 || c->strut.right_start_y
126 || c->strut.right_end_y
127 || c->strut.top_start_x
128 || c->strut.top_end_x
129 || c->strut.bottom_start_x
130 || c->strut.bottom_end_x);
133 #endif
134 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80