summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c71
1 files changed, 29 insertions, 42 deletions
diff --git a/main.c b/main.c
index 39172ee..b96157c 100644
--- a/main.c
+++ b/main.c
@@ -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
21char *tags[TLast] = {
22 [Tscratch] = "scratch",
23 [Tdev] = "dev",
24 [Twww] = "www",
25 [Twork] = "work",
26};
27
28/********** CUSTOMIZE **********/
29
30/* X structs */
31Display *dpy; 17Display *dpy;
32Window root, barwin; 18Window root, barwin;
33Atom wm_atom[WMLast], net_atom[NetLast]; 19Atom 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";
49static int (*xerrorxlib)(Display *, XErrorEvent *); 35static int (*xerrorxlib)(Display *, XErrorEvent *);
50 36
37/* static functions */
38
51static void 39static void
52usage() { eprint("usage: dwm [-v]\n"); } 40cleanup()
41{
42 while(sel) {
43 resize(sel, True);
44 unmanage(sel);
45 }
46 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
47}
53 48
54static void 49static void
55scan() 50scan()
@@ -73,22 +68,6 @@ scan()
73 XFree(wins); 68 XFree(wins);
74} 69}
75 70
76static void
77cleanup()
78{
79 while(sel) {
80 resize(sel, True);
81 unmanage(sel);
82 }
83 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
84}
85
86void
87quit(Arg *arg)
88{
89 running = False;
90}
91
92static int 71static int
93win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) 72win_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 */
95static int
96xerrorstart(Display *dsply, XErrorEvent *ee)
97{
98 otherwm = True;
99 return -1;
100}
101
102/* extern functions */
103
112int 104int
113getproto(Window w) 105getproto(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/* 139void
148 * Startup Error handler to check if another window manager 140quit(Arg *arg)
149 * is already running.
150 */
151static int
152xerrorstart(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 }