author | Anselm R. Garbe <garbeam@gmail.com> |
Sat, 18 Aug 2007 13:48:05 +0200 | |
changeset 963 | 7416c26a14db |
parent 961 | edfafdb7084d |
child 964 | 777a9d9ce70b |
permissions | -rw-r--r-- |
910
c13cb8c6b7a5
referred to LICENSE file
Anselm R. Garbe <arg@suckless.org>
parents:
909
diff
changeset
|
1 |
/* See LICENSE file for copyright and license details. */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
2 |
#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
|
3 |
#include <stdlib.h> |
75 | 4 |
|
949
99ee5c370f94
tags should be persistent now during X server run
Anselm R. Garbe <garbeam@gmail.com>
parents:
946
diff
changeset
|
5 |
/* static */ |
99ee5c370f94
tags should be persistent now during X server run
Anselm R. Garbe <garbeam@gmail.com>
parents:
946
diff
changeset
|
6 |
|
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
7 |
typedef struct { |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
8 |
const char *symbol; |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
9 |
void (*arrange)(void); |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
10 |
} Layout; |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
11 |
|
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
12 |
unsigned int blw = 0; |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
13 |
static unsigned int ltidx = 0; /* default */ |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
14 |
|
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
15 |
static void |
949
99ee5c370f94
tags should be persistent now during X server run
Anselm R. Garbe <garbeam@gmail.com>
parents:
946
diff
changeset
|
16 |
floating(void) { /* default floating layout */ |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
17 |
Client *c; |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
18 |
|
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
19 |
for(c = clients; c; c = c->next) |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
20 |
if(isvisible(c)) |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
21 |
resize(c, c->x, c->y, c->w, c->h, True); |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
22 |
} |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
23 |
|
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
24 |
static unsigned int nlayouts = 0; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
25 |
|
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
|
26 |
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
|
27 |
|
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
|
28 |
/* 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
|
29 |
|
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
|
30 |
void |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
31 |
arrange(void) { |
944
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
32 |
Client *c; |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
33 |
|
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
34 |
for(c = clients; c; c = c->next) |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
35 |
if(isvisible(c)) |
944
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
36 |
unban(c); |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
37 |
else |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
38 |
ban(c); |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
39 |
layouts[ltidx].arrange(); |
944
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
40 |
focus(NULL); |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
41 |
restack(); |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
42 |
} |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
43 |
|
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
44 |
void |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
45 |
focusnext(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
|
46 |
Client *c; |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
47 |
|
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
48 |
if(!sel) |
829
f1ec35606dbc
merged focus{prev.next} into focusclient(1/-1)
Anselm R. Garbe <arg@suckless.org>
parents:
826
diff
changeset
|
49 |
return; |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
50 |
for(c = sel->next; c && !isvisible(c); c = c->next); |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
51 |
if(!c) |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
52 |
for(c = clients; c && !isvisible(c); c = c->next); |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
53 |
if(c) { |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
54 |
focus(c); |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
55 |
restack(); |
831
8b84189854dc
simplified focusclient()
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
56 |
} |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
57 |
} |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
58 |
|
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
59 |
void |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
60 |
focusprev(const char *arg) { |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
61 |
Client *c; |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
62 |
|
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
63 |
if(!sel) |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
64 |
return; |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
65 |
for(c = sel->prev; c && !isvisible(c); c = c->prev); |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
66 |
if(!c) { |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
67 |
for(c = clients; c && c->next; c = c->next); |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
949
diff
changeset
|
68 |
for(; c && !isvisible(c); c = c->prev); |
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
|
69 |
} |
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
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
} |
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
|
74 |
} |
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
|
75 |
|
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
76 |
const char * |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
77 |
getsymbol(void) |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
78 |
{ |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
79 |
return layouts[ltidx].symbol; |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
80 |
} |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
81 |
|
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
82 |
Bool |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
83 |
isfloating(void) { |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
84 |
return layouts[ltidx].arrange == floating; |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
85 |
} |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
86 |
|
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
87 |
Bool |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
88 |
isarrange(void (*func)()) |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
89 |
{ |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
90 |
return func == layouts[ltidx].arrange; |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
91 |
} |
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
92 |
|
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
|
93 |
void |
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
94 |
initlayouts(void) { |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
95 |
unsigned int i, w; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
96 |
|
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
97 |
/* TODO deserialize ltidx if present */ |
958 | 98 |
nlayouts = sizeof layouts / sizeof layouts[0]; |
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
99 |
for(blw = i = 0; i < nlayouts; i++) { |
958 | 100 |
w = textw(layouts[i].symbol); |
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
101 |
if(w > blw) |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
102 |
blw = w; |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
103 |
} |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
104 |
} |
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
780
diff
changeset
|
105 |
|
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
|
106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
} |
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
|
111 |
|
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
112 |
void |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
113 |
restack(void) { |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
114 |
Client *c; |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
115 |
XEvent ev; |
918
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
116 |
XWindowChanges wc; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
117 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
118 |
drawstatus(); |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
119 |
if(!sel) |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
120 |
return; |
961
edfafdb7084d
replaced static Layout *lt with static unsigned int sellayout... (will be adapted later when _DWM_CONFIG is serialized as root window property)
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
121 |
if(sel->isfloating || isfloating()) |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
122 |
XRaiseWindow(dpy, sel->win); |
961
edfafdb7084d
replaced static Layout *lt with static unsigned int sellayout... (will be adapted later when _DWM_CONFIG is serialized as root window property)
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
123 |
if(!isfloating()) { |
918
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
124 |
wc.stack_mode = Below; |
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
125 |
wc.sibling = barwin; |
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
126 |
if(!sel->isfloating) { |
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
127 |
XConfigureWindow(dpy, sel->win, CWSibling | CWStackMode, &wc); |
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
128 |
wc.sibling = sel->win; |
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
129 |
} |
776
be103ae46dbc
renamed view.c into screen.c
Anselm R. Garbe <arg@suckless.org>
parents:
775
diff
changeset
|
130 |
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
|
131 |
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
|
132 |
continue; |
918
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
133 |
XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc); |
7c556b28f1f6
applied restack patch of anydot, with slight changes
Anselm R. Garbe <arg@suckless.org>
parents:
915
diff
changeset
|
134 |
wc.sibling = c->win; |
773
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
135 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
136 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
137 |
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
|
138 |
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
|
139 |
} |
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
140 |
|
81c5237a53b8
merged tag.c, view.c and tile.c to manage.c
Anselm R. Garbe <arg@suckless.org>
parents:
769
diff
changeset
|
141 |
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
|
142 |
setlayout(const char *arg) { |
826 | 143 |
int i; |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
144 |
|
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
|
145 |
if(!arg) { |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
146 |
if(++ltidx == nlayouts) |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
147 |
ltidx = 0;; |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
148 |
} |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
149 |
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
|
150 |
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
|
151 |
if(i < 0 || i >= nlayouts) |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
152 |
return; |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
961
diff
changeset
|
153 |
ltidx = i; |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
154 |
} |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
155 |
if(sel) |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
156 |
arrange(); |
788
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
157 |
else |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
158 |
drawstatus(); |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
159 |
} |
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
160 |
|
a61fcdf7b4c1
replaced togglelayout with setlayout
Anselm R. Garbe <arg@suckless.org>
parents:
786
diff
changeset
|
161 |
void |
878 | 162 |
togglebar(const char *arg) { |
887 | 163 |
if(bpos == BarOff) |
164 |
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
|
165 |
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
|
166 |
bpos = BarOff; |
878 | 167 |
updatebarpos(); |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
944
diff
changeset
|
168 |
arrange(); |
878 | 169 |
} |
944
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
170 |
|
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
171 |
void |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
172 |
togglemax(const char *arg) { |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
173 |
XEvent ev; |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
174 |
|
961
edfafdb7084d
replaced static Layout *lt with static unsigned int sellayout... (will be adapted later when _DWM_CONFIG is serialized as root window property)
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
175 |
if(!sel || (!isfloating() && !sel->isfloating) || sel->isfixed) |
944
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
176 |
return; |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
177 |
if((sel->ismax = !sel->ismax)) { |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
178 |
sel->rx = sel->x; |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
179 |
sel->ry = sel->y; |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
180 |
sel->rw = sel->w; |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
181 |
sel->rh = sel->h; |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
182 |
resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True); |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
183 |
} |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
184 |
else |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
185 |
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True); |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
186 |
drawstatus(); |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
187 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
bd5cf635c601
moved floating to layout.c, kept tile.c outside
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
188 |
} |