applied Sanders patches (numlock2)

This commit is contained in:
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. * See LICENSE file for license details.
*/ */
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
#define DEFMODE dotile /* dofloat */ #define DEFMODE dotile /* dofloat */
#define DEFTAG Tdev
#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
#define BGCOLOR "#0a2c2d" #define BGCOLOR "#0a2c2d"
#define FGCOLOR "#ddeeee" #define FGCOLOR "#ddeeee"
@ -14,6 +12,7 @@ enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
#define NUMLOCKMASK Mod2Mask #define NUMLOCKMASK Mod2Mask
#define MASTERW 52 /* percent */ #define MASTERW 52 /* percent */
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
#define TAGS \ #define TAGS \
char *tags[TLast] = { \ char *tags[TLast] = { \
[Tfnord] = "fnord", \ [Tfnord] = "fnord", \
@ -22,6 +21,7 @@ char *tags[TLast] = { \
[Twork] = "work", \ [Twork] = "work", \
[Tmisc] = "misc", \ [Tmisc] = "misc", \
}; };
#define DEFTAG Tdev
#define KEYS \ #define KEYS \
const char *browse[] = { "firefox", NULL }; \ const char *browse[] = { "firefox", NULL }; \

View File

@ -3,9 +3,7 @@
* See LICENSE file for license details. * See LICENSE file for license details.
*/ */
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
#define DEFMODE dotile /* dofloat */ #define DEFMODE dotile /* dofloat */
#define DEFTAG Tdev
#define FONT "fixed" #define FONT "fixed"
#define BGCOLOR "#666699" #define BGCOLOR "#666699"
#define FGCOLOR "#eeeeee" #define FGCOLOR "#eeeeee"
@ -14,6 +12,7 @@ enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
#define NUMLOCKMASK Mod2Mask #define NUMLOCKMASK Mod2Mask
#define MASTERW 52 /* percent */ #define MASTERW 52 /* percent */
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
#define TAGS \ #define TAGS \
char *tags[TLast] = { \ char *tags[TLast] = { \
[Tfnord] = "fnord", \ [Tfnord] = "fnord", \
@ -22,6 +21,7 @@ char *tags[TLast] = { \
[Twork] = "work", \ [Twork] = "work", \
[Tmisc] = "misc", \ [Tmisc] = "misc", \
}; };
#define DEFTAG Tdev
#define KEYS \ #define KEYS \
const char *term[] = { "xterm", NULL }; \ 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 # paths
PREFIX = /usr/local PREFIX = /usr/local
@ -11,12 +17,6 @@ X11LIB = /usr/X11R6/lib
INCS = -I/usr/lib -I${X11INC} INCS = -I/usr/lib -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
# dwm version
VERSION = 0.6
# default config.h
CONFIG = config.h
# flags # flags
CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" -DCONFIG=\"${CONFIG}\" CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" -DCONFIG=\"${CONFIG}\"
LDFLAGS = ${LIBS} LDFLAGS = ${LIBS}

27
dwm.1
View File

@ -38,22 +38,29 @@ to the
.B master .B master
column column
.TP .TP
.B Mod1-k .B Mod1-h
Focus previous Focus previous
.B window .B tag
.TP .TP
.B Mod1-j .B Mod1-j
Focus next Focus next
.B window .B window
.TP .TP
.B Mod1-k
Focus previous
.B window
.TP
.B Mod1-l
Focus next
.B tag
.TP
.B Mod1-m .B Mod1-m
Maximize current Maximize current
.B window .B window
.TP .TP
.B Mod1-[0..n] .B Mod1-[0..n]
Focus Focus
.B nth .B nth tag
tag
.TP .TP
.B Mod1-space .B Mod1-space
Toggle between Toggle between
@ -65,8 +72,8 @@ mode (affects
.TP .TP
.B Mod1-Shift-[0..n] .B Mod1-Shift-[0..n]
Apply Apply
.B nth .B nth tag
tag to current to current
.B window .B window
.TP .TP
.B Mod1-Shift-q .B Mod1-Shift-q
@ -79,8 +86,8 @@ Start
.TP .TP
.B Mod1-Control-[0..n] .B Mod1-Control-[0..n]
Append Append
.B nth .B nth tag
tag to current to current
.B window .B window
.TP .TP
.B Mod1-Button1 .B Mod1-Button1
@ -98,5 +105,5 @@ Resizes current
while dragging while dragging
.SH CUSTOMIZATION .SH CUSTOMIZATION
.B dwm .B dwm
is customized through editing config.h of the source code. This keeps it fast, is customized by editing the file config.h of the source code.
secure and simple. This keeps it fast, secure and simple.

17
event.c
View File

@ -19,7 +19,7 @@ typedef struct {
KEYS KEYS
static unsigned int valid_mask = 255 & ~(NUMLOCKMASK | LockMask); #define CLEANMASK(mask) (mask & ~(NUMLOCKMASK | LockMask))
static void static void
movemouse(Client *c) movemouse(Client *c)
@ -229,11 +229,11 @@ keypress(XEvent *e)
unsigned int i; unsigned int i;
KeySym keysym; KeySym keysym;
XKeyEvent *ev = &e->xkey; XKeyEvent *ev = &e->xkey;
ev->state &= valid_mask;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < len; i++) 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) if(key[i].func)
key[i].func(&key[i].arg); key[i].func(&key[i].arg);
return; return;
@ -335,13 +335,20 @@ grabkeys()
for(i = 0; i < len; i++) { for(i = 0; i < len; i++) {
code = XKeysymToKeycode(dpy, key[i].keysym); code = XKeysymToKeycode(dpy, key[i].keysym);
/* normal */
XUngrabKey(dpy, code, key[i].mod, root); 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, XGrabKey(dpy, code, key[i].mod, root, True,
GrabModeAsync, GrabModeAsync); 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, XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root, True,
GrabModeAsync, GrabModeAsync); GrabModeAsync, GrabModeAsync);
/* capslock & numlock */
XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root);
XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root, True, XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root, True,
GrabModeAsync, GrabModeAsync); GrabModeAsync, GrabModeAsync);
} }