author | Anselm R. Garbe <arg@suckless.org> |
Wed, 16 May 2007 21:59:53 +0200 | |
changeset 888 | 8b7337534209 |
parent 887 | 44755dcf1ad4 |
child 889 | 00f4180df72b |
permissions | -rw-r--r-- |
858
b797071ebbd4
yet another fix of copyright compactisition
Anselm R. Garbe <arg@suckless.org>
parents:
857
diff
changeset
|
1 |
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com> |
b797071ebbd4
yet another fix of copyright compactisition
Anselm R. Garbe <arg@suckless.org>
parents:
857
diff
changeset
|
2 |
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com> |
857
453788ae925c
making Copyright notices more compact
Anselm R. Garbe <arg@suckless.org>
parents:
837
diff
changeset
|
3 |
* See LICENSE file for license details. */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
4 |
#include "dwm.h" |
825
bef1854ce739
fixed some issues due to the Arg->const char * transition
Anselm R. Garbe <arg@suckless.org>
parents:
823
diff
changeset
|
5 |
#include <stdlib.h> |
75 | 6 |
|
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
7 |
unsigned int blw = 0; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
8 |
Layout *lt = NULL; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
9 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
10 |
/* static */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
11 |
|
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
12 |
static unsigned int nlayouts = 0; |
813
0ed770c96e51
several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents:
799
diff
changeset
|
13 |
static unsigned int masterw = MASTERWIDTH; |
0ed770c96e51
several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents:
799
diff
changeset
|
14 |
static unsigned int nmaster = NMASTER; |
191 | 15 |
|
784
74722317b171
renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Anselm R. Garbe <arg@suckless.org>
parents:
782
diff
changeset
|
16 |
static void |
74722317b171
renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page
Anselm R. Garbe <arg@suckless.org>
parents:
782
diff
changeset
|
17 |
tile(void) { |
871 | 18 |
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th, remainder; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
19 |
Client *c; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
20 |
|
776
be103ae46dbc
renamed view.c into screen.c
Anselm R. Garbe <arg@suckless.org>
parents:
775
diff
changeset
|
21 |
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
22 |
n++; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
23 |
/* window geoms */ |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
24 |
mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); |
813
0ed770c96e51
several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
Anselm R. Garbe <arg@suckless.org>
parents:
799
diff
changeset
|
25 |
mw = (n > nmaster) ? (waw * masterw) / 1000 : waw; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
26 |
th = (n > nmaster) ? wah / (n - nmaster) : 0; |
871 | 27 |
remainder = (n > nmaster) ? wah - th * (n - nmaster) : 0; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
28 |
tw = waw - mw; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
29 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
30 |
for(i = 0, c = clients; c; c = c->next) |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
31 |
if(isvisible(c)) { |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
32 |
if(c->isbanned) |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
33 |
XMoveWindow(dpy, c->win, c->x, c->y); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
34 |
c->isbanned = False; |
837
123231b9eb87
renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents:
831
diff
changeset
|
35 |
if(c->isfloating) |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
36 |
continue; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
37 |
c->ismax = False; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
38 |
nx = wax; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
39 |
ny = way; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
40 |
if(i < nmaster) { |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
41 |
ny += i * mh; |
861 | 42 |
nw = mw - 2 * c->border; |
43 |
nh = mh - 2 * c->border; |
|
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
44 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
45 |
else { /* tile window */ |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
46 |
nx += mw; |
861 | 47 |
nw = tw - 2 * c->border; |
48 |
if(th > 2 * c->border) { |
|
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
49 |
ny += (i - nmaster) * th; |
870
21632814ba18
fixing remaining space calculation
Anselm R. Garbe <arg@suckless.org>
parents:
867
diff
changeset
|
50 |
nh = th - 2 * c->border; |
21632814ba18
fixing remaining space calculation
Anselm R. Garbe <arg@suckless.org>
parents:
867
diff
changeset
|
51 |
if (i == n - 1) |
871 | 52 |
nh += remainder; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
53 |
} |
861 | 54 |
else /* fallback if th <= 2 * c->border */ |
55 |
nh = wah - 2 * c->border; |