[hackers] [dwm] applied Peter Hartlich's initmodmap patch || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Sat, 23 Aug 2008 08:26:15 +0000 (UTC)

changeset: 1339:fdf4b9511575
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Sat Aug 23 09:26:11 2008 +0100
files: LICENSE dwm.c
description:
applied Peter Hartlich's initmodmap patch

diff -r 04c5619da581 -r fdf4b9511575 LICENSE
--- a/LICENSE Fri Aug 22 15:26:30 2008 +0200
+++ b/LICENSE Sat Aug 23 09:26:11 2008 +0100
@@ -7,6 +7,7 @@
 © 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
 © 2007 Christof Musik <christof at sendfax 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>
 
 Permission is hereby granted, free of charge, to any person obtaining a
diff -r 04c5619da581 -r fdf4b9511575 dwm.c
--- a/dwm.c Fri Aug 22 15:26:30 2008 +0200
+++ b/dwm.c Sat Aug 23 09:26:11 2008 +0100
@@ -158,6 +158,7 @@
 static void grabbuttons(Client *c, Bool focused);
 static void grabkeys(void);
 static void initfont(const char *fontstr);
+static void initmodmap(void);
 static Bool isprotodel(Client *c);
 static void keypress(XEvent *e);
 static void killclient(const Arg *arg);
@@ -753,16 +754,6 @@
         unsigned int i, j;
         unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
         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);
         for(i = 0; i < LENGTH(keys); i++) {
@@ -811,6 +802,19 @@
                 dc.font.descent = dc.font.xfont->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
@@ -925,8 +929,10 @@
         XMappingEvent *ev = &e->xmapping;
 
         XRefreshKeyboardMapping(ev);
- if(ev->request == MappingKeyboard)
+ if(ev->request == MappingKeyboard) {
+ initmodmap();
                 grabkeys();
+ }
 }
 
 void
@@ -1373,8 +1379,7 @@
         XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
         XSelectInput(dpy, root, wa.event_mask);
 
-
- /* grab keys */
+ initmodmap();
         grabkeys();
 }
 
Received on Sat Aug 23 2008 - 08:26:15 UTC

This archive was generated by hypermail 2.2.0 : Sat Aug 23 2008 - 08:36:08 UTC