applied Sanders patches (numlock2)

master
arg@10ksloc.org 2006-08-02 11:13:32 +02:00
parent 57871415c1
commit 3af6434085
5 changed files with 40 additions and 26 deletions

View File

@ -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 }; \

View File

@ -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 }; \

View File

@ -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}

27
dwm.1
View File

@ -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.

17
event.c
View File

@ -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);
}