From 3af6434085aee75bd90e22aee95419dc0ae0b969 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Wed, 2 Aug 2006 11:13:32 +0200 Subject: [PATCH] applied Sanders patches (numlock2) --- config.arg.h | 4 ++-- config.h | 4 ++-- config.mk | 14 +++++++------- dwm.1 | 27 +++++++++++++++++---------- event.c | 17 ++++++++++++----- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/config.arg.h b/config.arg.h index f87489b..80d4918 100644 --- a/config.arg.h +++ b/config.arg.h @@ -3,9 +3,7 @@ * See LICENSE file for license details. */ -enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; #define DEFMODE dotile /* dofloat */ -#define DEFTAG Tdev #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" #define BGCOLOR "#0a2c2d" #define FGCOLOR "#ddeeee" @@ -14,6 +12,7 @@ enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; #define NUMLOCKMASK Mod2Mask #define MASTERW 52 /* percent */ +enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; #define TAGS \ char *tags[TLast] = { \ [Tfnord] = "fnord", \ @@ -22,6 +21,7 @@ char *tags[TLast] = { \ [Twork] = "work", \ [Tmisc] = "misc", \ }; +#define DEFTAG Tdev #define KEYS \ const char *browse[] = { "firefox", NULL }; \ diff --git a/config.h b/config.h index ac7bdac..d9070e3 100644 --- a/config.h +++ b/config.h @@ -3,9 +3,7 @@ * See LICENSE file for license details. */ -enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; #define DEFMODE dotile /* dofloat */ -#define DEFTAG Tdev #define FONT "fixed" #define BGCOLOR "#666699" #define FGCOLOR "#eeeeee" @@ -14,6 +12,7 @@ enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; #define NUMLOCKMASK Mod2Mask #define MASTERW 52 /* percent */ +enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; #define TAGS \ char *tags[TLast] = { \ [Tfnord] = "fnord", \ @@ -22,6 +21,7 @@ char *tags[TLast] = { \ [Twork] = "work", \ [Tmisc] = "misc", \ }; +#define DEFTAG Tdev #define KEYS \ const char *term[] = { "xterm", NULL }; \ diff --git a/config.mk b/config.mk index b3c8cf7..4772ff0 100644 --- a/config.mk +++ b/config.mk @@ -1,4 +1,10 @@ -# Customize to fit your system +# dwm version +VERSION = 0.6 + +# Customize below to fit your system + +# configheader +CONFIG = config.h # paths PREFIX = /usr/local @@ -11,12 +17,6 @@ X11LIB = /usr/X11R6/lib INCS = -I/usr/lib -I${X11INC} LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -# dwm version -VERSION = 0.6 - -# default config.h -CONFIG = config.h - # flags CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" -DCONFIG=\"${CONFIG}\" LDFLAGS = ${LIBS} diff --git a/dwm.1 b/dwm.1 index 14e3209..670a53b 100644 --- a/dwm.1 +++ b/dwm.1 @@ -38,22 +38,29 @@ to the .B master column .TP -.B Mod1-k +.B Mod1-h Focus previous -.B window +.B tag .TP .B Mod1-j Focus next .B window .TP +.B Mod1-k +Focus previous +.B window +.TP +.B Mod1-l +Focus next +.B tag +.TP .B Mod1-m Maximize current .B window .TP .B Mod1-[0..n] Focus -.B nth -tag +.B nth tag .TP .B Mod1-space Toggle between @@ -65,8 +72,8 @@ mode (affects .TP .B Mod1-Shift-[0..n] Apply -.B nth -tag to current +.B nth tag +to current .B window .TP .B Mod1-Shift-q @@ -79,8 +86,8 @@ Start .TP .B Mod1-Control-[0..n] Append -.B nth -tag to current +.B nth tag +to current .B window .TP .B Mod1-Button1 @@ -98,5 +105,5 @@ Resizes current while dragging .SH CUSTOMIZATION .B dwm -is customized through editing config.h of the source code. This keeps it fast, -secure and simple. +is customized by editing the file config.h of the source code. +This keeps it fast, secure and simple. diff --git a/event.c b/event.c index 1aed904..0359971 100644 --- a/event.c +++ b/event.c @@ -19,7 +19,7 @@ typedef struct { KEYS -static unsigned int valid_mask = 255 & ~(NUMLOCKMASK | LockMask); +#define CLEANMASK(mask) (mask & ~(NUMLOCKMASK | LockMask)) static void movemouse(Client *c) @@ -229,11 +229,11 @@ keypress(XEvent *e) unsigned int i; KeySym keysym; XKeyEvent *ev = &e->xkey; - ev->state &= valid_mask; keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); for(i = 0; i < len; i++) - if((keysym == key[i].keysym) && ((key[i].mod & valid_mask) == ev->state)) { + if(keysym == key[i].keysym && + CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) { if(key[i].func) key[i].func(&key[i].arg); return; @@ -335,13 +335,20 @@ grabkeys() for(i = 0; i < len; i++) { code = XKeysymToKeycode(dpy, key[i].keysym); + /* normal */ XUngrabKey(dpy, code, key[i].mod, root); - XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root); - XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root); XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync); + /* capslock */ + XUngrabKey(dpy, code, key[i].mod | LockMask, root); + XGrabKey(dpy, code, key[i].mod | LockMask, root, True, + GrabModeAsync, GrabModeAsync); + /* numlock */ + XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root); XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root, True, GrabModeAsync, GrabModeAsync); + /* capslock & numlock */ + XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root); XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root, True, GrabModeAsync, GrabModeAsync); }