changeset: 2453:54b5cb0c33b3
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat May 16 10:43:03 2009 -0400
files: cmd/menu/keys.c
description:
Fix wimenu when numlock is on.
diff -r 9cab98a04837 -r 54b5cb0c33b3 cmd/menu/keys.c
--- a/cmd/menu/keys.c Fri May 15 13:56:57 2009 -0400
+++ b/cmd/menu/keys.c Sat May 16 10:43:03 2009 -0400
@@ -29,6 +29,28 @@
{0,}
};
+static void
+init_numlock(void) {
+ static int masks[] = {
+ ShiftMask, LockMask, ControlMask, Mod1Mask,
+ Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
+ };
+ XModifierKeymap *modmap;
+ KeyCode kcode;
+ int i, max;
+
+ modmap = XGetModifierMapping(display);
+ kcode = keycode("Num_Lock");
+ if(kcode)
+ if(modmap && modmap->max_keypermod > 0) {
+ max = nelem(masks) * modmap->max_keypermod;
+ for(i = 0; i < max; i++)
+ if(modmap->modifiermap[i] == kcode)
+ numlock = masks[i / modmap->max_keypermod];
+ }
+ XFreeModifiermap(modmap);
+}
+
/*
* To do: Find my red black tree implementation.
*/
@@ -42,6 +64,9 @@
char *p, *line;
long mask;
int i, j, nlines, nwords, nkeys;
+
+ if(!numlock)
+ init_numlock();
nlines = tokenize(lines, nelem(lines), spec, '\n');
for(i=0; i < nlines; i++) {
Received on Sat May 16 2009 - 14:43:05 UTC
This archive was generated by hypermail 2.2.0 : Sat May 16 2009 - 14:48:05 UTC