[CONTACT]

[ABOUT]

[POLICY]

git clone dmenu dmenu Log gph

Found at: gopher.r-36.net:70/scm/dmenu/commit/b6cd6ed2661693c90c1c6e7119a8ac4a0b09e7e1.gph

tadded evil key support to dmenu - dmenu - Dmenu fork with xft fonts.

git clone git://r-36.net/dmenu

Log

Files

Refs

README

LICENSE

---

commit b6cd6ed2661693c90c1c6e7119a8ac4a0b09e7e1

parent 09813fcf2c7929fbfe5bc2f9d877c4e2e83e14b8

Author: Anselm R. Garbe

Date:   Thu, 11 Jan 2007 15:52:37 +0100
added evil key support to dmenu
Diffstat:
  main.c                              |      17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---

diff --git a/main.c b/main.c

t@@ -15,6 +15,8 @@
 #include 
 #include 
+#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
+
 typedef struct Item Item;
 struct Item {
         Item *next;                /* traverses all items */
t@@ -31,6 +33,7 @@ static int ret = 0;
 static int nitem = 0;
 static unsigned int cmdw = 0;
 static unsigned int promptw = 0;
+static unsigned int numlockmask = 0;
 static Bool running = True;
 static Item *allitems = NULL;        /* first of all items */
 static Item *item = NULL;        /* first of pattern matching items */
t@@ -187,7 +190,7 @@ kpress(XKeyEvent * e) {
                         return;
                 }
         }
-        if(e->state & Mod1Mask) {
+        if(CLEANMASK(e->state) & Mod1Mask) {
                 switch(ksym) {
                 default: return;
                 case XK_h:
t@@ -347,10 +350,11 @@ main(int argc, char *argv[]) {
         char *selbg = SELBGCOLOR;
         char *selfg = SELFGCOLOR;
         fd_set rd;
-        int i;
+        int i, j;
         struct timeval timeout;
         Item *itm;
         XEvent ev;
+        XModifierKeymap *modmap;
         XSetWindowAttributes wa;
         timeout.tv_usec = 0;
t@@ -408,6 +412,15 @@ main(int argc, char *argv[]) {
         if(select(ConnectionNumber(dpy) + 1, &rd, NULL, NULL, &timeout) < 1)
                 goto UninitializedEnd;
         maxname = readstdin();
+        /* 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);
         /* style */
         dc.norm[ColBG] = getcolor(normbg);
         dc.norm[ColFG] = getcolor(normfg);
.


AD: