about summary refs log tree commit diff stats
diff options
context:
space:
mode:
/* See LICENSE file for copyright and license details. */
#include "dwm.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>

/* extern */

void *
emallocz(unsigned int size) {
	void *res = calloc(1, size);

	if(!res)
		eprint("fatal: could not malloc() %u bytes\n", size);
	return res;
}

void
eprint(const char *errstr, ...) {
	va_list ap;

	va_start(ap, errstr);
	vfprintf(stderr, errstr, ap);
	va_end(ap);
	exit(EXIT_FAILURE);
}

void
spawn(const char *arg) {
	static char *shell = NULL;

	if(!shell && !(shell = getenv("SHELL")))
		shell = "/bin/sh";
	if(!arg)
		return;
	/* The double-fork construct avoids zombie processes and keeps the code
	 * clean from stupid signal handlers. */
	if(fork() == 0) {
		if(fork() == 0) {
			if(dpy)
				close(ConnectionNumber(dpy));
			setsid();
			execl(shell, shell, "-c", arg, (char *)NULL);
			fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg);
			perror(" failed");
		}
		exit(0);
	}
	wait(0);
}
-rw-r--r--client.c51
-rw-r--r--dev.c
nt *); +extern void (*handler[LASTEvent])(XEvent *); +extern void (*arrange)(Arg *); extern int tsel, screen, sx, sy, sw, sh, mw, th; extern char *tags[TLast]; @@ -117,7 +119,8 @@ extern void prevc(Arg *arg); extern void max(Arg *arg); extern void floating(Arg *arg); extern void tiling(Arg *arg); -extern void tag(Arg *arg); +extern void ttrunc(Arg *arg); +extern void tappend(Arg *arg); extern void view(Arg *arg); extern void zoom(Arg *arg); extern void gravitate(Client *c, Bool invert); diff --git a/event.c b/event.c index 937bee2..e85e11f 100644 --- a/event.c +++ b/event.c @@ -89,6 +89,7 @@ configurerequest(XEvent *e) if(ev->value_mask & CWBorderWidth) c->border = ev->border_width; gravitate(c, False); + resize(c, True); } wc.x = ev->x; @@ -179,6 +180,7 @@ static void propertynotify(XEvent *e) { XPropertyEvent *ev = &e->xproperty; + Window trans; Client *c; if(ev->state == PropertyDelete) @@ -192,9 +194,10 @@ propertynotify(XEvent *e) switch (ev->atom) { default: break; case XA_WM_TRANSIENT_FOR: - XGetTransientForHint(dpy, c->win, &c->trans); + XGetTransientForHint(dpy, c->win, &trans); + if(!c->floating && (c->floating = (trans != 0))) + arrange(NULL); break; - update_size(c); case XA_WM_NORMAL_HINTS: update_size(c); break;