axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] 20080120.01.gxv.patch (7100/149)


From: daly
Subject: [Axiom-developer] 20080120.01.gxv.patch (7100/149)
Date: Sun, 20 Jan 2008 00:18:21 -0600

Hyperdoc does not allow changes in input fields when the num-lock key is on.
This patch by Greg Vanuxem fixes that problem.

Tim

========================================================================
diff --git a/changelog b/changelog
index 2a361bf..7fdcca6 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,5 @@
+20080119 gxv src/hyper/keyin handle numlock in hyperdoc correctly      
+20080119 gxv src/hyper/dialog handle numlock in hyperdoc correctly     
 20080119 tpd src/input/e1.input regression test E1(0.0) 
 20080119 tpd src/algebra/special.spad handle E1(0.0) properly
 20080119 tpd changelog credit FreeAbelianGroup fix to Franz Lehner
diff --git a/src/hyper/dialog.pamphlet b/src/hyper/dialog.pamphlet
index fc973f5..8478694 100644
--- a/src/hyper/dialog.pamphlet
+++ b/src/hyper/dialog.pamphlet
@@ -1224,7 +1224,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.pamphlet b/src/hyper/keyin.pamphlet
index 3f2a59b..b1252da 100644
--- a/src/hyper/keyin.pamphlet
+++ b/src/hyper/keyin.pamphlet
@@ -28,7 +28,7 @@ extern int simple_box_width;
 extern int gInInsertMode;
 
 extern unsigned int ModifiersMask;
-extern unsigned int ShiftModMask;
+extern unsigned int UnsupportedModMask;
 
 
 #endif
@@ -75,7 +75,7 @@ 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;
 
@@ -233,6 +233,40 @@ handle_key(XEvent *event)
   }
 }
 
+/*
+ * 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;
+}
+
+
 
 /*
  * This routine initializes some of the variables needed by the input
@@ -243,6 +277,11 @@ void
 init_keyin(void)
 {
     char *prop;
+    unsigned int nlm;
+
+    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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]