author | Anselm R. Garbe <arg@suckless.org> |
Wed, 30 May 2007 08:57:44 +0200 | |
changeset 908 | 2f27c51332ed |
parent 906 | e04a79845936 |
child 909 | 8a8b7a413e66 |
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> |
905
ca352bd2f8f7
added anydot to Copyright holders, because he contributed a lot recently
Anselm R. Garbe <arg@suckless.org>
parents:
904
diff
changeset
|
3 |
* © 2007 Premysl Hruby <dfenze at gmail dot com> |
906
e04a79845936
added nsz to copyright holders as well, because he did a lot recently
Anselm R. Garbe <arg@suckless.org>
parents:
905
diff
changeset
|
4 |
* © 2007 Szabolcs Nagy <nszabolcs at gmail dot com> |
857
453788ae925c
making Copyright notices more compact
Anselm R. Garbe <arg@suckless.org>
parents:
837
diff
changeset
|
5 |
* 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
|
6 |
#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
|
7 |
#include <stdlib.h> |
75 | 8 |
|
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
9 |
unsigned int blw = 0; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
10 |
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
|
11 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
12 |
/* static */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
13 |
|
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
14 |
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
|
15 |
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
|
16 |
static unsigned int nmaster = NMASTER; |
191 | 17 |
|
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
|
18 |
static void |
904
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
19 |
ban(Client *c) { |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
20 |
if (c->isbanned) |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
21 |
return; |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
22 |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
23 |
c->isbanned = True; |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
24 |
} |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
25 |
|
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
26 |
static void |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
27 |
unban(Client *c) { |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
28 |
if (!c->isbanned) |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
29 |
return; |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
30 |
XMoveWindow(dpy, c->win, c->x, c->y); |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
31 |
c->isbanned = False; |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
32 |
} |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
33 |
|
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
34 |
static void |
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
|
35 |
tile(void) { |
898
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
36 |
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
37 |
Client *c; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
38 |
|
776
be103ae46dbc
renamed view.c into screen.c
Anselm R. Garbe <arg@suckless.org>
parents:
775
diff
changeset
|
39 |
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
|
40 |
n++; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
41 |
/* window geoms */ |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
42 |
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
|
43 |
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
|
44 |
th = (n > nmaster) ? wah / (n - nmaster) : 0; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
45 |
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
|
46 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
47 |
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
|
48 |
if(isvisible(c)) { |
904
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
49 |
unban(c); |
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
|
50 |
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
|
51 |
continue; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
52 |
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
|
53 |
nx = wax; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
54 |
ny = way; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
55 |
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
|
56 |
ny += i * mh; |
861 | 57 |
nw = mw - 2 * c->border; |
898
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
58 |
nh = mh; |
901
8f6f61e07567
fix if n < nmaster of remainer calculation for master windows
Anselm R. Garbe <arg@suckless.org>
parents:
898
diff
changeset
|
59 |
if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */ |
898
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
60 |
nh = wah - mh * i; |
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
61 |
nh -= 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
|
62 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
63 |
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
|
64 |
nx += mw; |
861 | 65 |
nw = tw - 2 * c->border; |
66 |
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
|
67 |
ny += (i - nmaster) * th; |
898
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
68 |
nh = th; |
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
69 |
if(i + 1 == n) /* remainder */ |
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
70 |
nh = wah - th * (i - nmaster); |
6c8b43d7b616
calculating the remainder for master and stack area correctly
Anselm R. Garbe <arg@suckless.org>
parents:
892
diff
changeset
|
71 |
nh -= 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
|
72 |
} |
861 | 73 |
else /* fallback if th <= 2 * c->border */ |
74 |
nh = wah - 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
|
75 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
76 |
resize(c, nx, ny, nw, nh, False); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
77 |
i++; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
78 |
} |
904
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
79 |
else |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
80 |
ban(c); |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
81 |
focus(NULL); |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
82 |
restack(); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
83 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
84 |
|
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
|
85 |
LAYOUTS |
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
|
86 |
|
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
|
87 |
/* extern */ |
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
|
88 |
|
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
|
89 |
void |
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
|
90 |
floating(void) { |
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
|
91 |
Client *c; |
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
|
92 |
|
904
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
93 |
for(c = clients; c; c = c->next) |
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
|
94 |
if(isvisible(c)) { |
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
|
95 |
if(c->isbanned) |
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
|
96 |
XMoveWindow(dpy, c->win, c->x, c->y); |
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
|
97 |
c->isbanned = False; |
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
|
98 |
resize(c, c->x, c->y, c->w, c->h, True); |
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
|
99 |
} |
904
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
100 |
else |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
101 |
ban(c); |
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
901
diff
changeset
|
102 |
focus(NULL); |
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
|
103 |
restack(); |
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
|
104 |
} |
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
|
105 |
|
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
|
106 |
void |
829
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
107 |
focusclient(const char *arg) { |
799
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
108 |
Client *c; |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
109 |
|
829
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
110 |
if(!sel || !arg) |
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
111 |
return; |
831
8b84189854dc
simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
112 |
if(atoi(arg) < 0) { |
829
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
113 |
for(c = sel->prev; c && !isvisible(c); c = c->prev); |
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
114 |
if(!c) { |
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
115 |
for(c = clients; c && c->next; c = c->next); |
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
116 |
for(; c && !isvisible(c); c = c->prev); |
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
117 |
} |
831
8b84189854dc
simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
118 |
} |
8b84189854dc
simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
119 |
else { |
8b84189854dc
simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
120 |
for(c = sel->next; c && !isvisible(c); c = c->next); |
8b84189854dc
simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
121 |
if(!c) |
8b84189854dc
simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
122 |
for(c = clients; c && !isvisible(c); c = c->next); |
799
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
123 |
} |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
124 |
if(c) { |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
125 |
focus(c); |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
126 |
restack(); |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
127 |
} |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
128 |
} |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
129 |
|
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
130 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
131 |
incmasterw(const char *arg) { |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
132 |
int i; |
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
|
133 |
if(lt->arrange != tile) |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
134 |
return; |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
135 |
if(!arg) |
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
|
136 |
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
|
137 |
else { |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
138 |
i = atoi(arg); |
861 | 139 |
if(waw * (masterw + i) / 1000 >= waw - 2 * BORDERPX |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
140 |
|| waw * (masterw + i) / 1000 <= 2 * BORDERPX) |
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
|
141 |
return; |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
142 |
masterw += i; |
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
|
143 |
} |
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
|
144 |
lt->arrange(); |
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
|
145 |
} |
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
|
146 |
|
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
|
147 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
148 |
incnmaster(const char *arg) { |
826 | 149 |
int i; |
150 |
||
151 |
if(!arg) |
|
152 |
nmaster = NMASTER; |
|
153 |
else { |
|
154 |
i = atoi(arg); |
|
155 |
if((lt->arrange != tile) || (nmaster + i < 1) |
|
156 |
|| (wah / (nmaster + i) <= 2 * BORDERPX)) |
|
157 |
return; |
|
158 |
nmaster += i; |
|
159 |
} |
|
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
160 |
if(sel) |
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
161 |
lt->arrange(); |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
162 |
else |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
163 |
drawstatus(); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
164 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
165 |
|
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
166 |
void |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
167 |
initlayouts(void) { |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
168 |
unsigned int i, w; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
169 |
|
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
170 |
lt = &layout[0]; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
171 |
nlayouts = sizeof layout / sizeof layout[0]; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
172 |
for(blw = i = 0; i < nlayouts; i++) { |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
173 |
w = textw(layout[i].symbol); |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
174 |
if(w > blw) |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
175 |
blw = w; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
176 |
} |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
177 |
} |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
178 |
|
799
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
179 |
Client * |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
180 |
nexttiled(Client *c) { |
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
|
181 |
for(; c && (c->isfloating || !isvisible(c)); c = c->next); |
799
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
182 |
return c; |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
183 |
} |
30ec8b96a7f6
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
Anselm R. Garbe <arg@suckless.org>
parents:
790
diff
changeset
|
184 |
|
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
185 |
void |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
186 |
restack(void) { |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
187 |
Client *c; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
188 |
XEvent ev; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
189 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
190 |
drawstatus(); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
191 |
if(!sel) |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
192 |
return; |
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
|
193 |
if(sel->isfloating || lt->arrange == floating) |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
194 |
XRaiseWindow(dpy, sel->win); |
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
|
195 |
if(lt->arrange != floating) { |
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
|
196 |
if(!sel->isfloating) |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
197 |
XLowerWindow(dpy, sel->win); |
776
be103ae46dbc
renamed view.c into screen.c
Anselm R. Garbe <arg@suckless.org>
parents:
775
diff
changeset
|
198 |
for(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
|
199 |
if(c == sel) |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
200 |
continue; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
201 |
XLowerWindow(dpy, c->win); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
202 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
203 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
204 |
XSync(dpy, False); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
205 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
206 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
207 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
208 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
209 |
setlayout(const char *arg) { |
826 | 210 |
int i; |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
211 |
|
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
212 |
if(!arg) { |
891
b940ac76c22f
applied Szabolcs proposal to simplify setlayout()
Anselm R. Garbe <arg@suckless.org>
parents:
889
diff
changeset
|
213 |
lt++; |
b940ac76c22f
applied Szabolcs proposal to simplify setlayout()
Anselm R. Garbe <arg@suckless.org>
parents:
889
diff
changeset
|
214 |
if(lt == layout + nlayouts) |
b940ac76c22f
applied Szabolcs proposal to simplify setlayout()
Anselm R. Garbe <arg@suckless.org>
parents:
889
diff
changeset
|
215 |
lt = layout; |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
216 |
} |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
217 |
else { |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
218 |
i = atoi(arg); |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
219 |
if(i < 0 || i >= nlayouts) |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
220 |
return; |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
221 |
lt = &layout[i]; |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
222 |
} |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
223 |
if(sel) |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
224 |
lt->arrange(); |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
225 |
else |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
226 |
drawstatus(); |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
227 |
} |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
228 |
|
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
229 |
void |
878 | 230 |
togglebar(const char *arg) { |
887 | 231 |
if(bpos == BarOff) |
232 |
bpos = (BARPOS == BarOff) ? BarTop : BARPOS; |
|
883
2cbf1010be11
using BarTop as fallback if BARPOS is set to BarOff as default for toggling
Anselm R. Garbe <arg@suckless.org>
parents:
880
diff
changeset
|
233 |
else |
2cbf1010be11
using BarTop as fallback if BARPOS is set to BarOff as default for toggling
Anselm R. Garbe <arg@suckless.org>
parents:
880
diff
changeset
|
234 |
bpos = BarOff; |
878 | 235 |
updatebarpos(); |
880
f330be522eca
another fix, call lt->arrange() in togglebar only
Anselm R. Garbe <arg@suckless.org>
parents:
878
diff
changeset
|
236 |
lt->arrange(); |
878 | 237 |
} |
238 |
||
239 |
void |
|
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
240 |
togglemax(const char *arg) { |
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
|
241 |
XEvent ev; |
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
|
242 |
|
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
|
243 |
if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed) |
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
|
244 |
return; |
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
|
245 |
if((sel->ismax = !sel->ismax)) { |
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
|
246 |
sel->rx = sel->x; |
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
|
247 |
sel->ry = sel->y; |
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
|
248 |
sel->rw = sel->w; |
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
|
249 |
sel->rh = sel->h; |
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
|
250 |
resize(sel, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True); |
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
|
251 |
} |
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
|
252 |
else |
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
|
253 |
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True); |
819
21562c2567a6
status needs update even in togglemax() - since we got an indicator for this
Anselm R. Garbe <arg@suckless.org>
parents:
815
diff
changeset
|
254 |
drawstatus(); |
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
|
255 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
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
|
256 |
} |
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
|
257 |
|
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
|
258 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
819
diff
changeset
|
259 |
zoom(const char *arg) { |
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
|
260 |
Client *c; |
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
|
261 |
|
892
42bf8e618d52
applied Szabolcs proposal for zoom() as well
Anselm R. Garbe <arg@suckless.org>
parents:
891
diff
changeset
|
262 |
if(!sel || lt->arrange == floating || sel->isfloating) |
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
|
263 |
return; |
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
|
264 |
if((c = sel) == nexttiled(clients)) |
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
|
265 |
if(!(c = nexttiled(c->next))) |
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
|
266 |
return; |
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
|
267 |
detach(c); |
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
|
268 |
attach(c); |
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
|
269 |
focus(c); |
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
|
270 |
lt->arrange(); |
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
|
271 |
} |