2 * fibonacci.c - fibonacci layout
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.
25 #include "layouts/fibonacci.h"
26 #include "common/util.h"
28 extern AwesomeConf globalconf
;
31 layout_fibonacci(int screen
, int shape
)
35 area_t geometry
, area
;
36 geometry
= area
= screen_get_area(screen
,
37 globalconf
.screens
[screen
].statusbar
,
38 &globalconf
.screens
[screen
].padding
);
40 for(c
= globalconf
.clients
; c
; c
= c
->next
)
41 if(IS_TILED(c
, screen
))
43 for(c
= globalconf
.clients
; c
; c
= c
->next
)
44 if(IS_TILED(c
, screen
))
47 if((i
% 2 && geometry
.height
/ 2 > 2 * c
->border
)
48 || (!(i
% 2) && geometry
.width
/ 2 > 2 * c
->border
))
56 if((i
% 4) == 2 && !shape
)
57 geometry
.x
+= geometry
.width
;
58 else if((i
% 4) == 3 && !shape
)
59 geometry
.y
+= geometry
.height
;
64 geometry
.y
+= geometry
.height
;
66 geometry
.y
-= geometry
.height
;
69 geometry
.x
+= geometry
.width
;
71 geometry
.y
+= geometry
.height
;
75 geometry
.x
+= geometry
.width
;
77 geometry
.x
-= geometry
.width
;
83 geometry
.width
-= 2 * c
->border
;
84 geometry
.height
-= 2 * c
->border
;
85 client_resize(c
, geometry
, globalconf
.screens
[screen
].resize_hints
);
86 geometry
.width
+= 2 * c
->border
;
87 geometry
.height
+= 2 * c
->border
;
92 layout_spiral(int screen
)
94 layout_fibonacci(screen
, 0);
98 layout_dwindle(int screen
)
100 layout_fibonacci(screen
, 1);
103 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80