applied Peter Hartlich's initmodmap patch
This commit is contained in:
parent
0f26de991f
commit
2b4157eccd
1
LICENSE
1
LICENSE
|
@ -7,6 +7,7 @@ MIT/X Consortium License
|
||||||
© 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
|
© 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
|
||||||
© 2007 Christof Musik <christof at sendfax dot de>
|
© 2007 Christof Musik <christof at sendfax dot de>
|
||||||
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
|
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
|
||||||
|
© 2007-2008 Peter Hartlich <sgkkr at hartlich dot com>
|
||||||
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|
31
dwm.c
31
dwm.c
|
@ -158,6 +158,7 @@ static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
static void grabbuttons(Client *c, Bool focused);
|
static void grabbuttons(Client *c, Bool focused);
|
||||||
static void grabkeys(void);
|
static void grabkeys(void);
|
||||||
static void initfont(const char *fontstr);
|
static void initfont(const char *fontstr);
|
||||||
|
static void initmodmap(void);
|
||||||
static Bool isprotodel(Client *c);
|
static Bool isprotodel(Client *c);
|
||||||
static void keypress(XEvent *e);
|
static void keypress(XEvent *e);
|
||||||
static void killclient(const Arg *arg);
|
static void killclient(const Arg *arg);
|
||||||
|
@ -753,16 +754,6 @@ grabkeys(void) {
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
||||||
KeyCode code;
|
KeyCode code;
|
||||||
XModifierKeymap *modmap;
|
|
||||||
|
|
||||||
/* init modifier map */
|
|
||||||
modmap = XGetModifierMapping(dpy);
|
|
||||||
for(i = 0; i < 8; i++)
|
|
||||||
for(j = 0; j < modmap->max_keypermod; j++) {
|
|
||||||
if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
|
|
||||||
numlockmask = (1 << i);
|
|
||||||
}
|
|
||||||
XFreeModifiermap(modmap);
|
|
||||||
|
|
||||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||||
for(i = 0; i < LENGTH(keys); i++) {
|
for(i = 0; i < LENGTH(keys); i++) {
|
||||||
|
@ -813,6 +804,19 @@ initfont(const char *fontstr) {
|
||||||
dc.font.height = dc.font.ascent + dc.font.descent;
|
dc.font.height = dc.font.ascent + dc.font.descent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
initmodmap(void) {
|
||||||
|
unsigned int i, j;
|
||||||
|
XModifierKeymap *modmap;
|
||||||
|
|
||||||
|
modmap = XGetModifierMapping(dpy);
|
||||||
|
for(i = 0; i < 8; i++)
|
||||||
|
for(j = 0; j < modmap->max_keypermod; j++)
|
||||||
|
if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
|
||||||
|
numlockmask = (1 << i);
|
||||||
|
XFreeModifiermap(modmap);
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
isprotodel(Client *c) {
|
isprotodel(Client *c) {
|
||||||
int i, n;
|
int i, n;
|
||||||
|
@ -925,8 +929,10 @@ mappingnotify(XEvent *e) {
|
||||||
XMappingEvent *ev = &e->xmapping;
|
XMappingEvent *ev = &e->xmapping;
|
||||||
|
|
||||||
XRefreshKeyboardMapping(ev);
|
XRefreshKeyboardMapping(ev);
|
||||||
if(ev->request == MappingKeyboard)
|
if(ev->request == MappingKeyboard) {
|
||||||
|
initmodmap();
|
||||||
grabkeys();
|
grabkeys();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1373,8 +1379,7 @@ setup(void) {
|
||||||
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
|
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
|
||||||
XSelectInput(dpy, root, wa.event_mask);
|
XSelectInput(dpy, root, wa.event_mask);
|
||||||
|
|
||||||
|
initmodmap();
|
||||||
/* grab keys */
|
|
||||||
grabkeys();
|
grabkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue