Mercurial > aewl
annotate cmd.c @ 26:e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Wed, 12 Jul 2006 15:17:22 +0200 |
parents | 95ffdfd0a819 |
children |
rev | line source |
---|---|
12 | 1 /* |
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | |
3 * See LICENSE file for license details. | |
4 */ | |
5 | |
6 #include "wm.h" | |
7 #include <stdio.h> | |
14 | 8 #include <string.h> |
12 | 9 |
10 void | |
14 | 11 run(void *aux) |
12 | 12 { |
14 | 13 spawn(dpy, aux); |
12 | 14 } |
15 | |
16 void | |
14 | 17 quit(void *aux) |
12 | 18 { |
19 running = False; | |
20 } | |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
21 |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
22 void |
23 | 23 sel(void *aux) |
24 { | |
25 const char *arg = aux; | |
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
26 Client *c = NULL; |
23 | 27 |
28 if(!arg || !stack) | |
29 return; | |
30 if(!strncmp(arg, "next", 5)) | |
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
31 c = stack->snext ? stack->snext : stack; |
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
32 else if(!strncmp(arg, "prev", 5)) |
23 | 33 for(c = stack; c && c->snext; c = c->snext); |
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
34 if(!c) |
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
35 c = stack; |
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
36 raise(c); |
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
37 focus(c); |
23 | 38 } |
39 | |
40 void | |
14 | 41 kill(void *aux) |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
42 { |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
43 Client *c = stack; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
44 |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
45 if(!c) |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
46 return; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
47 if(c->proto & WM_PROTOCOL_DELWIN) |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
48 send_message(c->win, wm_atom[WMProtocols], wm_atom[WMDelete]); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
49 else |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
50 XKillClient(dpy, c->win); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
51 } |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
12
diff
changeset
|
52 |