This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  3957f0129365e827d7ec41f3c591952338e962ef (commit)
      from  709e7654bc85043ffa763598187a2ccf50b3adab (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/3957f0129365e827d7ec41f3c591952338e962ef

commit 3957f0129365e827d7ec41f3c591952338e962ef
Author: Rodolfo García Peñas (kix) <[email protected]>
Date:   Sun Sep 29 12:02:05 2013 +0200

    WPrefs: Ignore NumLock key when capturing keyboard shortcuts
    
    This patch includes the function "NumLockMask", that checks if the
    Alt Modifier key is "NumLock". Then we can use this function in the
    calls to Capture the key sequence and don't use this modifier.

diff --git a/WPrefs.app/KeyboardShortcuts.c b/WPrefs.app/KeyboardShortcuts.c
index 84da1d0..4c418c6 100644
--- a/WPrefs.app/KeyboardShortcuts.c
+++ b/WPrefs.app/KeyboardShortcuts.c
@@ -262,6 +262,22 @@ static void XConvertCase(register KeySym sym, KeySym * 
lower, KeySym * upper)
 }
 #endif
 
+static int NumLockMask(Display *dpy)
+{
+       int i;
+       XModifierKeymap *map = XGetModifierMapping(dpy);
+       KeyCode numlock_keycode = XKeysymToKeycode(dpy, XK_Num_Lock);
+       if (numlock_keycode == NoSymbol)
+               return 0;
+
+       for (i = 0; i < 8; i++) {
+               if (map->modifiermap[map->max_keypermod * i] == numlock_keycode)
+                       return 1 << i;
+       }
+
+       return 0;
+}
+
 char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
 {
        XEvent ev;
@@ -297,27 +313,27 @@ char *capture_shortcut(Display *dpy, Bool *capturing, 
Bool convert_case)
 
        buffer[0] = 0;
 
-       if (ev.xkey.state & ControlMask) {
+       if (ev.xkey.state & ControlMask)
                strcat(buffer, "Control+");
-       }
-       if (ev.xkey.state & ShiftMask) {
+
+       if (ev.xkey.state & ShiftMask)
                strcat(buffer, "Shift+");
-       }
-       if (ev.xkey.state & Mod1Mask) {
+
+       if ((ev.xkey.state & Mod1Mask) && !NumLockMask(dpy))
                strcat(buffer, "Mod1+");
-       }
-       if (ev.xkey.state & Mod2Mask) {
+
+       if ((ev.xkey.state & Mod2Mask) && !NumLockMask(dpy))
                strcat(buffer, "Mod2+");
-       }
-       if (ev.xkey.state & Mod3Mask) {
+
+       if ((ev.xkey.state & Mod3Mask) && !NumLockMask(dpy))
                strcat(buffer, "Mod3+");
-       }
-       if (ev.xkey.state & Mod4Mask) {
+
+       if ((ev.xkey.state & Mod4Mask) && !NumLockMask(dpy))
                strcat(buffer, "Mod4+");
-       }
-       if (ev.xkey.state & Mod5Mask) {
+
+       if ((ev.xkey.state & Mod5Mask) && !NumLockMask(dpy))
                strcat(buffer, "Mod5+");
-       }
+
        strcat(buffer, key);
 
        return wstrdup(buffer);

-----------------------------------------------------------------------

Summary of changes:
 WPrefs.app/KeyboardShortcuts.c |   44 +++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 14 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to [email protected].

Reply via email to