about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--client.c49
-rw-r--r--dwm.h5
-rw-r--r--tile.c5
-rw-r--r--view.c11
4 files changed, 40 insertions, 30 deletions
diff --git a/client.c b/client.c
index 79cd698..9a30526 100644
--- a/client.c
+++ b/client.c
@@ -10,13 +10,6 @@
 /* static */
 
 static void
-detachstack(Client *c) {
-	Client **tc;
-	for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
-	*tc = c->snext;
-}
-
-static void
 grabbuttons(Client *c, Bool focused) {
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
 
@@ -68,6 +61,20 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
 /* extern */
 
 void
+attach(Client *c) {
+	if(clients)
+		clients->prev = c;
+	c->next = clients;
+	clients = c;
+}
+
+void
+attachstack(Client *c) {
+	c->snext = stack;
+	stack = c;
+}
+
+void
 configure(Client *c) {
 	XConfigureEvent ce;
 
@@ -86,6 +93,24 @@ configure(Client *c) {
 }
 
 void
+detach(Client *c) {
+	if(c->prev)
+		c->prev->next = c->next;
+	if(c->next)
+		c->next->prev = c->prev;
+	if(c == clients)
+		clients = c->next;
+	c->next = c->prev = NULL;
+}
+
+void
+detachstack(Client *c) {
+	Client **tc;
+	for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
+	*tc = c->snext;
+}
+
+void
 focus(Client *c) {
 	if(c && !isvisible(c))
 		return;
@@ -95,8 +120,7 @@ focus(Client *c) {
 	}
 	if(c) {
 		detachstack(c);
-		c->snext = stack;
-		stack = c;
+		attachstack(c);
 		grabbuttons(c, True);
 	}
 	sel = c;
@@ -189,11 +213,8 @@ manage(Window w, XWindowAttributes *wa) {
 	settags(c, t);
 	if(!c->isfloat)
 		c->isfloat = (t != 0) || c->isfixed;
-	if(clients)
-		clients->prev = c;
-	c->next = clients;
-	c->snext = stack;
-	stack = clients = c;
+	attach(c);
+	attachstack(c);
 	c->isbanned = True;
 	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
 	XMapWindow(dpy, c->win);
diff --git a/dwm.h b/dwm.h
index c07229a..35950a6 100644
--- a/dwm.h
+++ b/dwm.h
@@ -99,7 +99,11 @@ extern Display *dpy;
 extern Window root, barwin;
 
 /* client.c */
+extern void attach(Client *c);			/* attaches c to global client list */
+extern void attachstack(Client *c);		/* attaches client to stack */
 extern void configure(Client *c);		/* send synthetic configure event */
+extern void detach(Client *c);			/* detaches c from global client list */
+extern void detachstack(Client *c);		/* detaches client from stack */
 extern void focus(Client *c);			/* focus c, c may be NULL */
 extern Client *getclient(Window w);		/* return client of w */
 extern Bool isprotodel(Client *c);		/* returns True if c->win supports wmatom[WMDelete] */
@@ -144,7 +148,6 @@ extern void eprint(const char *errstr, ...);	/* prints errstr and exits with 1 *
 extern void spawn(Arg *arg);			/* forks a new subprocess with to arg's cmd */
 
 /* view.c */
-extern void detach(Client *c);			/* detaches c from global client list */
 extern void dofloat(void);			/* arranges all windows floating */
 extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
 extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
diff --git a/tile.c b/tile.c
index fe25943..8075e55 100644
--- a/tile.c
+++ b/tile.c
@@ -125,10 +125,7 @@ zoom(Arg *arg) {
 		if(!(c = nextmanaged(c->next)))
 			return;
 	detach(c);
-	if(clients)
-		clients->prev = c;
-	c->next = clients;
-	clients = c;
+	attach(c);
 	focus(c);
 	arrange();
 }
diff --git a/view.c b/view.c
index 72aa04e..cd07b94 100644
--- a/view.c
+++ b/view.c
@@ -8,17 +8,6 @@
 void (*arrange)(void) = DEFMODE;
 
 void
-detach(Client *c) {
-	if(c->prev)
-		c->prev->next = c->next;
-	if(c->next)
-		c->next->prev = c->prev;
-	if(c == clients)
-		clients = c->next;
-	c->next = c->prev = NULL;
-}
-
-void
 dofloat(void) {
 	Client *c;
 
'Blame the previous revision' href='/acidbong/suckless/dwm/blame/dwm.1?h=3.8&id=2eebebf26243a4a80d646c85db2b9c9ebd168743'>^
caf5a16 ^
901b3ed ^
1076f2b

901b3ed ^
0c3544d ^
2b35fae ^

a3e3f0b ^

2b35fae ^
3e06ede ^
6f20315 ^
4aea423 ^
292ccc4 ^
d4b7a9a ^
10885d3 ^
1836b67 ^
92cb5eb ^





1836b67 ^
7ab8c87 ^
1836b67 ^

7ab8c87 ^
2b35fae ^
72655f0 ^
df74b26 ^


72655f0 ^
df74b26 ^
7ab8c87 ^
72655f0 ^
df74b26 ^
7ab8c87 ^
3af6434 ^
df74b26 ^
a118a57 ^
9fb6502 ^
6499fc4 ^
2cce4b9 ^
6499fc4 ^
9066ee2 ^
2cce4b9 ^
9066ee2 ^
8c4623d ^
726ae5b ^
06bae9d ^
8c4623d ^
726ae5b ^
06bae9d ^
bab575c ^
1549faf ^
7ab8c87 ^

1549faf ^
42fd392 ^


bab575c ^
df74b26 ^
7ab8c87 ^

df74b26 ^
45aea23 ^
7ab8c87 ^
45aea23 ^
df74b26 ^
4aea423 ^
1549faf ^
8dc8605 ^
683dabe ^
8dc8605 ^
bab575c ^
df74b26 ^
7ab8c87 ^

1549faf ^
bab575c ^
7ab8c87 ^
daae3bb ^
bab575c ^
3e06ede ^
7ab8c87 ^

4bb89e2 ^
df74b26 ^
7ab8c87 ^
2b35fae ^
0c3544d ^
0e5c819 ^
7ab8c87 ^
0e5c819 ^
4bd0d33 ^
a118a57 ^
4bd0d33 ^
0e5c819 ^
7ab8c87 ^
0c3544d ^
7ab8c87 ^
dc5c070 ^
7e98db2 ^

bced907 ^
60b3dce ^
21bd90d ^
c8f96b5 ^
4bb89e2 ^
c8f96b5 ^



c7da124 ^


c8f96b5 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149