On Mon, Aug 01, 2011 at 01:50:33PM +0100, Ethan Grammatikidis wrote: > On Mon, 1 Aug 2011 15:52:37 +0400 > anonymous <p37si...@lavabit.com> wrote: > > > On Mon, Aug 01, 2011 at 03:34:46PM +0400, anonymous wrote: > > > Maybe it can be adopted for dwm so we would be able to remove this > > > CLEANMASK macro. > > > > Patch is attached. Maybe I missed something because I don't understand > > what numlockmask is for. Maybe my patch breaks something or maybe we > > can remove all numlockmask stuff? > > Did you test your patch both with numlock off and on? Years ago a lot of > keybindings wouldn't work if numlock was in the wrong state for the app. > Quite nasty, really. >
It works with numlock off and on. It doesn't clean keycode and matches it exactly with mask. Instead it applies mask (with &) and checks if all bits that are set in the mask are set in keycode. If your mask doesn't include numlock, numlock state can't change anything. What changed is that when you bind Ctrl+A, Ctrl+Shift+A is matched too. That is why I added "break" in the loop. It means you should bind Mod1+Shift+Return first and Mod1+Return later, but it is how it is done in default config.h so there are no problems. We still can't remove updatenumlockmask, because it is used in grabbuttons and grabkeys. Maybe it can be removed later. If my patch doesn't break anything, I think it makes code a little cleaner.