applied Sanders patches

This commit is contained in:
arg@10ksloc.org 2006-08-01 12:32:33 +02:00
parent 937cabfa0a
commit 7b5638f61d
8 changed files with 42 additions and 58 deletions

View File

@ -13,7 +13,6 @@ all: options dwm
options: options:
@echo dwm build options: @echo dwm build options:
@echo "LIBS = ${LIBS}"
@echo "CFLAGS = ${CFLAGS}" @echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}" @echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}" @echo "CC = ${CC}"
@ -29,7 +28,7 @@ dwm: ${OBJ}
@${CC} -o $@ ${OBJ} ${LDFLAGS} @${CC} -o $@ ${OBJ} ${LDFLAGS}
clean: clean:
rm -f dwm *.o core dwm-${VERSION}.tar.gz rm -f dwm *.o dwm-${VERSION}.tar.gz
dist: clean dist: clean
mkdir -p dwm-${VERSION} mkdir -p dwm-${VERSION}

17
README
View File

@ -1,6 +1,6 @@
dwm - dynamic window manager dwm - dynamic window manager
---------------------------- ----------------------------
dwm is an extremly fast, small, and dynamic X11 window manager. dwm is an extremely fast, small, and dynamic X11 window manager.
Requirements Requirements
@ -10,8 +10,8 @@ In order to build dwm you need the Xlib header files.
Installation Installation
------------ ------------
Edit config.mk to match your local setup. dwm is installed into Edit config.mk to match your local setup (dwm is installed into
the /usr/local namespace by default. the /usr/local namespace by default).
Afterwards enter the following command to build and install dwm (if Afterwards enter the following command to build and install dwm (if
necessary as root): necessary as root):
@ -35,16 +35,17 @@ This will start dwm on display :1 of the host foo.bar.
Displaying status info Displaying status info
---------------------- ----------------------
In order to display status info in the bar, you can do following In order to display status info in the bar, you can do something
in .xinitrc: like this in your .xinitrc:
while true while true
do do
echo `date` `uptime | sed 's/.*://; s/,//g'` echo `date` `uptime | sed 's/.*://; s/,//g'`
sleep 2 sleep 1
done | dwm done | dwm
Configuration Configuration
------------- -------------
The configuration of dwm is done by customizing source code, The configuration of dwm is done by customizing its source code
grep for CUSTOMIZE keyword. (grep for the CUSTOMIZE keyword).

View File

@ -244,11 +244,11 @@ manage(Window w, XWindowAttributes *wa)
c->next = clients; c->next = clients;
clients = c; clients = c;
XGrabButton(dpy, Button1, MODKEY, c->win, False, ButtonPressMask, XGrabButton(dpy, Button1, MODKEY, c->win, False, ButtonMask,
GrabModeAsync, GrabModeSync, None, None); GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, MODKEY, c->win, False, ButtonPressMask, XGrabButton(dpy, Button2, MODKEY, c->win, False, ButtonMask,
GrabModeAsync, GrabModeSync, None, None); GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button3, MODKEY, c->win, False, ButtonPressMask, XGrabButton(dpy, Button3, MODKEY, c->win, False, ButtonMask,
GrabModeAsync, GrabModeSync, None, None); GrabModeAsync, GrabModeSync, None, None);
if(!c->isfloat) if(!c->isfloat)

View File

@ -7,24 +7,18 @@ MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
VERSION = 0.5
# includes and libs # includes and libs
LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 INCS = -I/usr/lib -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
# Linux/BSD # flags
CFLAGS = -O3 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\"
-DVERSION=\"${VERSION}\"
LDFLAGS = ${LIBS} LDFLAGS = ${LIBS}
#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ #CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
# -DVERSION=\"${VERSION}\"
#LDFLAGS = -g ${LIBS} #LDFLAGS = -g ${LIBS}
# compiler
# Solaris
#CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"
#LIBS += -lnsl -lsocket
AR = ar cr
CC = cc CC = cc
RANLIB = ranlib
# dwm version
VERSION = 0.6

24
dwm.1
View File

@ -21,7 +21,7 @@ time. But each window may contain more than one tag, which makes it visible in
several views. several views.
.P .P
.B dwm .B dwm
consists of a small status bar which reads the text displayed from standard has a small status bar which reads the text displayed from standard
input, if written. It draws 1-pixel borders around windows to indicate the input, if written. It draws 1-pixel borders around windows to indicate the
focus state. Unfocused windows contain a small bar in front of the window focus state. Unfocused windows contain a small bar in front of the window
displaying the tags and the window title. displaying the tags and the window title.
@ -56,14 +56,12 @@ Focus
tag tag
.TP .TP
.B Mod1-space .B Mod1-space
(Re-)arrange Toggle between
.B all .B tiled
windows tiled and
.TP .B floating
.B Mod1-Shift-space mode (affects
(Re-)arrange .BR "all windows" )
.B all
windows floating
.TP .TP
.B Mod1-Shift-[0..n] .B Mod1-Shift-[0..n]
Apply Apply
@ -79,14 +77,6 @@ Quit
Start Start
.B terminal .B terminal
.TP .TP
.B Mod1-Shift-w
Start
.B web browser
.TP
.B Mod1-Shift-l
Lock
.B screen
.TP
.B Mod1-Control-[0..n] .B Mod1-Control-[0..n]
Append Append
.B nth .B nth

8
dwm.h
View File

@ -25,9 +25,12 @@ enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
/* END CUSTOMIZE */ /* END CUSTOMIZE */
/* mask shorthands, used in event.c and client.c */
#define ButtonMask (ButtonPressMask | ButtonReleaseMask)
#define MouseMask (ButtonMask | PointerMotionMask)
typedef union Arg Arg; typedef union Arg Arg;
typedef struct Client Client; typedef struct Client Client;
typedef enum Corner Corner;
typedef struct DC DC; typedef struct DC DC;
typedef struct Fnt Fnt; typedef struct Fnt Fnt;
@ -43,7 +46,8 @@ enum { WMProtocols, WMDelete, WMLast };
/* cursor */ /* cursor */
enum { CurNormal, CurResize, CurMove, CurLast }; enum { CurNormal, CurResize, CurMove, CurLast };
enum Corner { TopLeft, TopRight, BotLeft, BotRight }; /* windowcorners */
typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner;
struct Fnt { struct Fnt {
int ascent; int ascent;

14
event.c
View File

@ -8,9 +8,6 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#define ButtonMask (ButtonPressMask | ButtonReleaseMask)
#define MouseMask (ButtonMask | PointerMotionMask)
/* CUSTOMIZE */ /* CUSTOMIZE */
typedef struct { typedef struct {
@ -20,17 +17,13 @@ typedef struct {
Arg arg; Arg arg;
} Key; } Key;
/*
const char *browse[] = { "firefox", NULL }; const char *browse[] = { "firefox", NULL };
const char *gimp[] = { "gimp", NULL }; const char *gimp[] = { "gimp", NULL };
*/ const char *term[] = { /*"xterm", NULL };*/
const char *term[] = { "xterm", NULL };
/*
"urxvt", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", "urxvt", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
}; };
const char *xlock[] = { "xlock", NULL }; const char *xlock[] = { "xlock", NULL };
*/
static Key key[] = { static Key key[] = {
/* modifier key function arguments */ /* modifier key function arguments */
@ -57,11 +50,9 @@ static Key key[] = {
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, { MODKEY|ShiftMask, XK_c, killclient, { 0 } },
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, { MODKEY|ShiftMask, XK_q, quit, { 0 } },
{ MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } },
/*
{ MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, { MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } },
{ MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } },
{ MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } }, { MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } },
*/
}; };
/* END CUSTOMIZE */ /* END CUSTOMIZE */
@ -172,6 +163,7 @@ buttonpress(XEvent *e)
} }
} }
else if((c = getclient(ev->window))) { else if((c = getclient(ev->window))) {
focus(c);
switch(ev->button) { switch(ev->button) {
default: default:
break; break;
@ -247,7 +239,7 @@ enternotify(XEvent *e)
Client *c; Client *c;
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) if(ev->detail == NotifyInferior)
return; return;
if((c = getclient(ev->window))) if((c = getclient(ev->window)))

4
tag.c
View File

@ -67,6 +67,8 @@ dofloat(Arg *arg)
higher(sel); higher(sel);
focus(sel); focus(sel);
} }
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
} }
drawall(); drawall();
} }
@ -130,6 +132,8 @@ dotile(Arg *arg)
higher(sel); higher(sel);
focus(sel); focus(sel);
} }
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
} }
drawall(); drawall();
} }