2 * titlebar.h - titlebar management header
4 * Copyright © 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_TITLEBAR_H
23 #define AWESOME_TITLEBAR_H
27 client_t
* client_getbytitlebar(titlebar_t
*);
28 client_t
* client_getbytitlebarwin(xcb_window_t
);
29 void titlebar_geometry_compute(client_t
*, area_t
, area_t
*);
30 void titlebar_draw(client_t
*);
31 void titlebar_init(client_t
*);
32 void titlebar_refresh(void);
34 int luaA_titlebar_userdata_new(lua_State
*, titlebar_t
*);
36 /** Add the titlebar geometry to a geometry.
37 * \param t The titlebar
38 * \param border The client border size.
39 * \param geometry The geometry
40 * \return A new geometry bigger if the titlebar is visible.
43 titlebar_geometry_add(titlebar_t
*t
, int border
, area_t geometry
)
49 geometry
.y
-= t
->sw
->geometry
.height
+ 2 * t
->border
.width
- border
;
50 geometry
.height
+= t
->sw
->geometry
.height
+ 2 * t
->border
.width
- border
;
53 geometry
.height
+= t
->sw
->geometry
.height
+ 2 * t
->border
.width
- border
;
56 geometry
.x
-= t
->sw
->geometry
.width
+ 2 * t
->border
.width
- border
;
57 geometry
.width
+= t
->sw
->geometry
.width
+ 2 * t
->border
.width
- border
;
60 geometry
.width
+= t
->sw
->geometry
.width
+ 2 * t
->border
.width
- border
;
69 /** Remove the titlebar geometry to a geometry.
70 * \param t The titlebar.
71 * \param border The client border size.
72 * \param geometry The geometry.
73 * \return A new geometry smaller if the titlebar is visible.
76 titlebar_geometry_remove(titlebar_t
*t
, int border
, area_t geometry
)
82 geometry
.y
+= t
->sw
->geometry
.height
+ 2 * t
->border
.width
- border
;
83 geometry
.height
-= t
->sw
->geometry
.height
+ 2 * t
->border
.width
- border
;
86 geometry
.height
-= t
->sw
->geometry
.height
+ 2 * t
->border
.width
- border
;
89 geometry
.x
+= t
->sw
->geometry
.width
+ 2 * t
->border
.width
- border
;
90 geometry
.width
-= t
->sw
->geometry
.width
+ 2 * t
->border
.width
- border
;
93 geometry
.width
-= t
->sw
->geometry
.width
+ 2 * t
->border
.width
- border
;
102 /** Update the titlebar geometry for a floating client.
103 * \param c The client.
106 titlebar_update_geometry_floating(client_t
*c
)
110 if(!c
->titlebar
|| !c
->titlebar
->sw
)
113 titlebar_geometry_compute(c
, c
->geometry
, &geom
);
114 simplewindow_moveresize(c
->titlebar
->sw
, geom
.x
, geom
.y
, geom
.width
, geom
.height
);
115 c
->titlebar
->need_update
= true;
118 /** Update the titlebar geometry for a tiled client.
119 * \param c The client.
120 * \param geometry The geometry the client will receive.
123 titlebar_update_geometry_tiled(client_t
*c
, area_t geometry
)
127 if(!c
->titlebar
|| !c
->titlebar
->sw
)
130 titlebar_geometry_compute(c
, geometry
, &geom
);
131 simplewindow_moveresize(c
->titlebar
->sw
, geom
.x
, geom
.y
, geom
.width
, geom
.height
);
132 c
->titlebar
->need_update
= true;
136 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80