diff options
Diffstat (limited to '')
| -rw-r--r-- | main.c | 71 |
1 files changed, 29 insertions, 42 deletions
| @@ -3,31 +3,17 @@ | |||
| 3 | * See LICENSE file for license details. | 3 | * See LICENSE file for license details. |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include "dwm.h" | ||
| 7 | |||
| 6 | #include <errno.h> | 8 | #include <errno.h> |
| 7 | #include <stdarg.h> | ||
| 8 | #include <stdio.h> | 9 | #include <stdio.h> |
| 9 | #include <stdlib.h> | 10 | #include <stdlib.h> |
| 10 | #include <string.h> | 11 | #include <string.h> |
| 11 | #include <unistd.h> | 12 | #include <unistd.h> |
| 12 | |||
| 13 | #include <X11/cursorfont.h> | 13 | #include <X11/cursorfont.h> |
| 14 | #include <X11/Xatom.h> | 14 | #include <X11/Xatom.h> |
| 15 | #include <X11/Xproto.h> | 15 | #include <X11/Xproto.h> |
| 16 | 16 | ||
| 17 | #include "dwm.h" | ||
| 18 | |||
| 19 | /********** CUSTOMIZE **********/ | ||
| 20 | |||
| 21 | char *tags[TLast] = { | ||
| 22 | [Tscratch] = "scratch", | ||
| 23 | [Tdev] = "dev", | ||
| 24 | [Twww] = "www", | ||
| 25 | [Twork] = "work", | ||
| 26 | }; | ||
| 27 | |||
| 28 | /********** CUSTOMIZE **********/ | ||
| 29 | |||
| 30 | /* X structs */ | ||
| 31 | Display *dpy; | 17 | Display *dpy; |
| 32 | Window root, barwin; | 18 | Window root, barwin; |
| 33 | Atom wm_atom[WMLast], net_atom[NetLast]; | 19 | Atom wm_atom[WMLast], net_atom[NetLast]; |
| @@ -48,8 +34,17 @@ static const char version[] = | |||
| 48 | "dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; | 34 | "dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; |
| 49 | static int (*xerrorxlib)(Display *, XErrorEvent *); | 35 | static int (*xerrorxlib)(Display *, XErrorEvent *); |
| 50 | 36 | ||
| 37 | /* static functions */ | ||
| 38 | |||
| 51 | static void | 39 | static void |
| 52 | usage() { eprint("usage: dwm [-v]\n"); } | 40 | cleanup() |
| 41 | { | ||
| 42 | while(sel) { | ||
| 43 | resize(sel, True); | ||
| 44 | unmanage(sel); | ||
| 45 | } | ||
| 46 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); | ||
| 47 | } | ||
| 53 | 48 | ||
| 54 | static void | 49 | static void |
| 55 | scan() | 50 | scan() |
| @@ -73,22 +68,6 @@ scan() | |||
| 73 | XFree(wins); | 68 | XFree(wins); |
| 74 | } | 69 | } |
| 75 | 70 | ||
| 76 | static void | ||
| 77 | cleanup() | ||
| 78 | { | ||
| 79 | while(sel) { | ||
| 80 | resize(sel, True); | ||
| 81 | unmanage(sel); | ||
| 82 | } | ||
| 83 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); | ||
| 84 | } | ||
| 85 | |||
| 86 | void | ||
| 87 | quit(Arg *arg) | ||
| 88 | { | ||
| 89 | running = False; | ||
| 90 | } | ||
| 91 | |||
| 92 | static int | 71 | static int |
| 93 | win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) | 72 | win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) |
| 94 | { | 73 | { |
| @@ -109,6 +88,19 @@ win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) | |||
| 109 | return res; | 88 | return res; |
| 110 | } | 89 | } |
| 111 | 90 | ||
| 91 | /* | ||
| 92 | * Startup Error handler to check if another window manager | ||
| 93 | * is already running. | ||
| 94 | */ | ||
| 95 | static int | ||
| 96 | xerrorstart(Display *dsply, XErrorEvent *ee) | ||
| 97 | { | ||
| 98 | otherwm = True; | ||
| 99 | return -1; | ||
| 100 | } | ||
| 101 | |||
| 102 | /* extern functions */ | ||
| 103 | |||
| 112 | int | 104 | int |
| 113 | getproto(Window w) | 105 | getproto(Window w) |
| 114 | { | 106 | { |
| @@ -144,15 +136,10 @@ sendevent(Window w, Atom a, long value) | |||
| 144 | XFlush(dpy); | 136 | XFlush(dpy); |
| 145 | } | 137 | } |
| 146 | 138 | ||
| 147 | /* | 139 | void |
| 148 | * Startup Error handler to check if another window manager | 140 | quit(Arg *arg) |
| 149 | * is already running. | ||
| 150 | */ | ||
| 151 | static int | ||
| 152 | xerrorstart(Display *dsply, XErrorEvent *ee) | ||
| 153 | { | 141 | { |
| 154 | otherwm = True; | 142 | running = False; |
| 155 | return -1; | ||
| 156 | } | 143 | } |
| 157 | 144 | ||
| 158 | /* | 145 | /* |
| @@ -201,7 +188,7 @@ main(int argc, char *argv[]) | |||
| 201 | exit(0); | 188 | exit(0); |
| 202 | break; | 189 | break; |
| 203 | default: | 190 | default: |
| 204 | usage(); | 191 | eprint("usage: dwm [-v]\n"); |
| 205 | break; | 192 | break; |
| 206 | } | 193 | } |
| 207 | } | 194 | } |
