2 * spiral.c - spiral layout
4 * Copyright © 2007 Julien Danjou <julien@danjou.info>
5 * Copyright © 2007 Jeroen Schot <schot@a-eskwadraat.nl>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 extern Client
*clients
; /* global client list */
31 fibonacci(Display
*disp
, awesome_config
*awesomeconf
, int shape
)
33 int n
, nx
, ny
, nh
, nw
, i
;
36 nx
= get_windows_area_x(awesomeconf
->statusbar
);
38 nw
= get_windows_area_width(disp
, awesomeconf
->statusbar
);
39 nh
= get_windows_area_height(disp
, awesomeconf
->statusbar
);
40 for(n
= 0, c
= clients
; c
; c
= c
->next
)
41 if(IS_TILED(c
, awesomeconf
->selected_tags
, awesomeconf
->ntags
))
43 for(i
= 0, c
= clients
; c
; c
= c
->next
)
46 if((i
% 2 && nh
/ 2 > 2 * c
->border
)
47 || (!(i
% 2) && nw
/ 2 > 2 * c
->border
))
55 if((i
% 4) == 2 && !shape
)
77 ny
= get_windows_area_y(awesomeconf
->statusbar
);
80 resize(c
, nx
, ny
, nw
- 2 * c
->border
, nh
- 2 * c
->border
, False
);
86 dwindle(Display
*disp
, awesome_config
*awesomeconf
)
88 fibonacci(disp
, awesomeconf
, 1);
92 spiral(Display
*disp
, awesome_config
*awesomeconf
)
94 fibonacci(disp
, awesomeconf
, 0);