summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/main.c b/main.c
index 46e0b44..59b3a72 100644
--- a/main.c
+++ b/main.c
@@ -15,6 +15,8 @@
#include <X11/Xutil.h>
#include <X11/keysym.h>
+#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
+
typedef struct Item Item;
struct Item {
Item *next; /* traverses all items */
@@ -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 */
@@ -187,7 +190,7 @@ kpress(XKeyEvent * e) {
return;
}
}
- if(e->state & Mod1Mask) {
+ if(CLEANMASK(e->state) & Mod1Mask) {
switch(ksym) {
default: return;
case XK_h:
@@ -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;
@@ -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);
4b8b17f5&follow=1'>fix: multimon: always spawn client on first monitor if specified with -m 0Gravatar Hiltjo Posthuma 1-1/+1 2015-10-20drw: cleanup drw_text, prevent gcc warning false-positive of unused varGravatar Hiltjo Posthuma 1-21/+14 2015-10-20drw: simplify drw_font_xcreate and prevent a potential unneeded allocationGravatar Hiltjo Posthuma 1-22/+19 2015-10-20drw: a valid (non-NULL) Drw and Fnt context must be passedGravatar Hiltjo Posthuma 1-16/+3 2015-10-20add sbase-style ecalloc(), calloc: or dieGravatar Hiltjo Posthuma 3-12/+18 2015-10-18free schemes as arrayGravatar Hiltjo Posthuma 1-6/+6 2015-10-04fix input text matchingGravatar Quentin Rameau 1-1/+1 2015-10-04fix incorrect ordering of match resultsGravatar Davide Del Zompo 1-2/+3 2015-10-04fix paste from clipboard (ctrl+shift+y)Gravatar Hiltjo Posthuma 1-0/+1 2015-09-28minor style fixGravatar Hiltjo Posthuma 1-1/+2 2015-09-28Remove function prototypes and reorder functions accordinglyGravatar FRIGN 1-80/+64 2015-09-28Untypedef struct itemGravatar FRIGN 1-10/+9 2015-09-28Fix the conversion from microseconds to nanosecondsGravatar Quentin Rameau 1-1/+1 2015-09-28Replace deprecated usleep() with nanosleep()Gravatar Quentin Rameau 1-2/+3 2015-09-28config.mk: use -std=c99Gravatar Hiltjo Posthuma 1-1/+1 2015-09-27dmenu: style improvementsGravatar Hiltjo Posthuma 1-204/+213 2015-09-27drw style improvementsGravatar Hiltjo Posthuma 2-93/+106 2015-09-27separate program-specific c99 bool and X11Gravatar Hiltjo Posthuma 2-11/+10 2015-09-27config.mk: fix _XOPEN_SOURCE=700 for getline()Gravatar Hiltjo Posthuma 1-1/+1 2015-09-27config.mk: improve feature test checkGravatar Hiltjo Posthuma 1-1/+1 2015-08-06Fixed typo introduced by shared codeGravatar Eric Pruitt 1-1/+1 2015-07-19stest: get rid of getopt, use suckless arg.hGravatar Hiltjo Posthuma 3-53/+141 2015-07-19config.mk: add FREETYPELIBS and FREETYPEINCGravatar Hiltjo Posthuma 1-3/+9 2015-07-19fix prompt color style how it used to beGravatar Hiltjo Posthuma 1-1/+1 2015-06-27Use libdraw: add Xft and fallback-fonts support to graphics libGravatar Hiltjo Posthuma 11-316/+684 2014-09-17applied Hiltjo's patch as suggested on the ml to fix ControlMask for C-j and C-mGravatar Anselm R Garbe 2-2/+5 2014-07-30fix crash with ctrl-enter as inputGravatar Hiltjo Posthuma 1-1/+2 2014-05-29updated copyright notices in LICENSE and dmenu.c fileGravatar Anselm R Garbe 2-2/+2 2013-08-13applied Martin Kühl's inverse matching flag to stestGravatar Anselm R Garbe 2-4/+7 2013-08-02applied Martti Kühne's dmenu monitor patchGravatar Anselm R Garbe 3-4/+14 2013-06-28accepted vi'is exit approach ^[ (suggested by Arkaduisz)Gravatar Anselm R Garbe 1-0/+2