diff options
author | dos-reis <gdr@axiomatics.org> | 2008-05-18 20:13:53 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-05-18 20:13:53 +0000 |
commit | a931c469aa73e88c6fd5a36c846bec8792571a14 (patch) | |
tree | 976d8e86ebff5ed1ecc5c7587b870002bdbd005a /src | |
parent | 01d9be9999622400347af560b28c9a2284950449 (diff) | |
download | open-axiom-a931c469aa73e88c6fd5a36c846bec8792571a14.tar.gz |
Fix AW/149
* hyper/keyin.h (UnsupportedModMask): Rename from ShiftModMask.
* hyper/keyin.c (UnsupportedModMask): Likewise.
(get_modifier_mask): New.
(init_keyin): Use it.
* hyper/dialog.c (dialog): Adjust.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 9 | ||||
-rw-r--r-- | src/hyper/dialog.c | 2 | ||||
-rw-r--r-- | src/hyper/keyin.c | 37 | ||||
-rw-r--r-- | src/hyper/keyin.h | 2 |
4 files changed, 47 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 37c65fcd..db67cfd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2008-05-18 Gregory Vanuxem <g.vanuxem@wanadoo.fr> + + Fix AW/149 + * hyper/keyin.h (UnsupportedModMask): Rename from ShiftModMask. + * hyper/keyin.c (UnsupportedModMask): Likewise. + (get_modifier_mask): New. + (init_keyin): Use it. + * hyper/dialog.c (dialog): Adjust. + 2008-05-18 Bill Page <bill.page@newsynthesis.org> Fix AW/117 diff --git a/src/hyper/dialog.c b/src/hyper/dialog.c index 61cdda70..5d067a4a 100644 --- a/src/hyper/dialog.c +++ b/src/hyper/dialog.c @@ -1238,7 +1238,7 @@ dialog(XEvent *event, KeySym keysym, char *buffer) { /* only handle normal keys */ - if (event->xkey.state & ShiftModMask) + if (event->xkey.state & UnsupportedModMask) BeepAtTheUser(); else add_buffer_to_sym(buffer, item); diff --git a/src/hyper/keyin.c b/src/hyper/keyin.c index ec775ac7..a0e89eac 100644 --- a/src/hyper/keyin.c +++ b/src/hyper/keyin.c @@ -73,10 +73,42 @@ unsigned int ModifiersMask = ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask; -unsigned int ShiftModMask = LockMask | ControlMask +unsigned int UnsupportedModMask = LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask; +/* + * This routine returns the modifier mask associated + * to a key symbol. + */ + +static unsigned int +get_modifier_mask(KeySym sym) +{ + unsigned int i, mask; + XModifierKeymap *mod; + KeyCode kcode; + const int masks[8] = { + ShiftMask, LockMask, ControlMask, + Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask + }; + + mod = XGetModifierMapping(gXDisplay); + kcode = XKeysymToKeycode(gXDisplay,sym); + + if (mod) { + for (i = 0; i < (8 * mod->max_keypermod); i++){ + if (!mod->modifiermap[i]) continue; + else if (kcode == mod->modifiermap[i]){ + mask = masks[i / mod->max_keypermod]; + XFreeModifiermap(mod); + return mask; + } + } + XFreeModifiermap(mod); + } + return 0; +} /* * Since the user can't tell me directly what name to use here, I am going to @@ -241,6 +273,9 @@ void init_keyin(void) { char *prop; + unsigned nlm = get_modifier_mask(XK_Num_Lock); + UnsupportedModMask &= ~nlm; + ModifiersMask &= ~nlm; /* * First set all the values for when the active cursor is in the window diff --git a/src/hyper/keyin.h b/src/hyper/keyin.h index e1bc564c..752150ff 100644 --- a/src/hyper/keyin.h +++ b/src/hyper/keyin.h @@ -49,7 +49,7 @@ extern int simple_box_width; extern int gInInsertMode; extern unsigned int ModifiersMask; -extern unsigned int ShiftModMask; +extern unsigned int UnsupportedModMask; #endif |