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"
27 extern awesome_t globalconf
;
30 layout_fibonacci(int screen
, int shape
)
34 area_t geometry
, area
;
35 geometry
= area
= screen_area_get(screen
,
36 &globalconf
.screens
[screen
].wiboxes
,
37 &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
))
46 if((i
% 2 && geometry
.height
/ 2 > 2 * c
->border
)
47 || (!(i
% 2) && geometry
.width
/ 2 > 2 * c
->border
))
55 if((i
% 4) == 2 && !shape
)
56 geometry
.x
+= geometry
.width
;
57 else if((i
% 4) == 3 && !shape
)
58 geometry
.y
+= geometry
.height
;
63 geometry
.y
+= geometry
.height
;
65 geometry
.y
-= geometry
.height
;
68 geometry
.x
+= geometry
.width
;
70 geometry
.y
+= geometry
.height
;
74 geometry
.x
+= geometry
.width
;
76 geometry
.x
-= geometry
.width
;
82 geometry
.width
-= 2 * c
->border
;
83 geometry
.height
-= 2 * c
->border
;
84 client_resize(c
, geometry
, c
->honorsizehints
);
85 geometry
.width
+= 2 * c
->border
;
86 geometry
.height
+= 2 * c
->border
;
91 layout_spiral(int screen
)
93 layout_fibonacci(screen
, 0);
97 layout_dwindle(int screen
)
99 layout_fibonacci(screen
, 1);
102 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80