mirror of git://git.suckless.org/dwm
applied Hiltjo's cleanup patch
This commit is contained in:
parent
a644baf674
commit
b68528d85d
14
dwm.c
14
dwm.c
|
@ -267,7 +267,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[UnmapNotify] = unmapnotify
|
[UnmapNotify] = unmapnotify
|
||||||
};
|
};
|
||||||
static Atom wmatom[WMLast], netatom[NetLast];
|
static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
static Bool otherwm;
|
|
||||||
static Bool running = True;
|
static Bool running = True;
|
||||||
static Cursor cursor[CurLast];
|
static Cursor cursor[CurLast];
|
||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
|
@ -458,13 +457,10 @@ buttonpress(XEvent *e) {
|
||||||
|
|
||||||
void
|
void
|
||||||
checkotherwm(void) {
|
checkotherwm(void) {
|
||||||
otherwm = False;
|
|
||||||
xerrorxlib = XSetErrorHandler(xerrorstart);
|
xerrorxlib = XSetErrorHandler(xerrorstart);
|
||||||
/* this causes an error if some other window manager is running */
|
/* this causes an error if some other window manager is running */
|
||||||
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
|
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
if(otherwm)
|
|
||||||
die("dwm: another window manager is already running\n");
|
|
||||||
XSetErrorHandler(xerror);
|
XSetErrorHandler(xerror);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
@ -994,12 +990,11 @@ initfont(const char *fontstr) {
|
||||||
XFreeStringList(missing);
|
XFreeStringList(missing);
|
||||||
}
|
}
|
||||||
if(dc.font.set) {
|
if(dc.font.set) {
|
||||||
XFontSetExtents *font_extents;
|
|
||||||
XFontStruct **xfonts;
|
XFontStruct **xfonts;
|
||||||
char **font_names;
|
char **font_names;
|
||||||
|
|
||||||
dc.font.ascent = dc.font.descent = 0;
|
dc.font.ascent = dc.font.descent = 0;
|
||||||
font_extents = XExtentsOfFontSet(dc.font.set);
|
XExtentsOfFontSet(dc.font.set);
|
||||||
n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
|
n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
|
||||||
for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) {
|
for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) {
|
||||||
dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
|
dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
|
||||||
|
@ -1088,14 +1083,12 @@ killclient(const Arg *arg) {
|
||||||
|
|
||||||
void
|
void
|
||||||
manage(Window w, XWindowAttributes *wa) {
|
manage(Window w, XWindowAttributes *wa) {
|
||||||
static Client cz;
|
|
||||||
Client *c, *t = NULL;
|
Client *c, *t = NULL;
|
||||||
Window trans = None;
|
Window trans = None;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
if(!(c = malloc(sizeof(Client))))
|
if(!(c = calloc(1, sizeof(Client))))
|
||||||
die("fatal: could not malloc() %u bytes\n", sizeof(Client));
|
die("fatal: could not malloc() %u bytes\n", sizeof(Client));
|
||||||
*c = cz;
|
|
||||||
c->win = w;
|
c->win = w;
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
|
if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
|
||||||
|
@ -1579,7 +1572,6 @@ showhide(Client *c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sigchld(int unused) {
|
sigchld(int unused) {
|
||||||
if(signal(SIGCHLD, sigchld) == SIG_ERR)
|
if(signal(SIGCHLD, sigchld) == SIG_ERR)
|
||||||
|
@ -2015,7 +2007,7 @@ xerrordummy(Display *dpy, XErrorEvent *ee) {
|
||||||
* is already running. */
|
* is already running. */
|
||||||
int
|
int
|
||||||
xerrorstart(Display *dpy, XErrorEvent *ee) {
|
xerrorstart(Display *dpy, XErrorEvent *ee) {
|
||||||
otherwm = True;
|
die("dwm: another window manager is already running\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue