changeset 50994:5461f0256e86

(make_lispy_event): Apply modifiers to multibyte-char keys. (keyremap): Add `parent' field. (keyremap_step): Use it. Remove `parent' argument. (read_key_sequence): Setup and use the new `parent' field.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 14 May 2003 18:43:12 +0000
parents 5cdcabc328d7
children c955fcb7a64a
files src/keyboard.c
diffstat 1 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Wed May 14 16:20:51 2003 +0000
+++ b/src/keyboard.c	Wed May 14 18:43:12 2003 +0000
@@ -5013,8 +5013,17 @@
     case MULTIBYTE_CHAR_KEYSTROKE_EVENT:
       {
 	Lisp_Object lispy_c;
-
-	XSETFASTINT (lispy_c, event->code);
+	int c = event->code;
+
+	/* Add in the other modifier bits.  We took care of ctrl_modifier
+	   just above, and the shift key was taken care of by the X code,
+	   and applied to control characters by make_ctrl_char.  */
+	c |= (event->modifiers
+	      & (meta_modifier | alt_modifier
+		 | hyper_modifier | super_modifier | ctrl_modifier));
+	/* What about the `shift' modifier ?  */
+	button_down_time = 0;
+	XSETFASTINT (lispy_c, c);
 	return lispy_c;
       }
 
@@ -8205,7 +8214,7 @@
    such as Vfunction_key_map and Vkey_translation_map.  */
 typedef struct keyremap
 {
-  Lisp_Object map;
+  Lisp_Object map, parent;
   int start, end;
 } keyremap;
 
@@ -8270,8 +8279,8 @@
    The return value is non-zero if the remapping actually took place.  */
 
 static int
-keyremap_step (keybuf, bufsize, fkey, input, doit, diff, parent, prompt)
-     Lisp_Object *keybuf, prompt, parent;
+keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt)
+     Lisp_Object *keybuf, prompt;
      keyremap *fkey;
      int input, doit, *diff, bufsize;
 {
@@ -8306,7 +8315,7 @@
 	  = Faref (next, make_number (i));
 
       fkey->start = fkey->end += *diff;
-      fkey->map = parent;
+      fkey->map = fkey->parent;
 
       return 1;
     }
@@ -8318,7 +8327,7 @@
   if (!CONSP (fkey->map))
     {
       fkey->end = ++fkey->start;
-      fkey->map = parent;
+      fkey->map = fkey->parent;
     }
   return 0;
 }
@@ -8474,8 +8483,8 @@
   last_nonmenu_event = Qnil;
 
   delayed_switch_frame = Qnil;
-  fkey.map = Vfunction_key_map;
-  keytran.map = Vkey_translation_map;
+  fkey.map = fkey.parent = Vfunction_key_map;
+  keytran.map = keytran.parent = Vkey_translation_map;
   /* If there is no translation-map, turn off scanning.  */
   fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1;
   keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
@@ -8631,9 +8640,9 @@
 	    keybuf[i - first_unbound - 1] = keybuf[i];
 	  mock_input = t - first_unbound - 1;
 	  fkey.end = fkey.start -= first_unbound + 1;
-	  fkey.map = Vfunction_key_map;
+	  fkey.map = fkey.parent;
 	  keytran.end = keytran.start -= first_unbound + 1;
-	  keytran.map = Vkey_translation_map;
+	  keytran.map = keytran.parent;
 	  goto replay_sequence;
 	}
 
@@ -9185,7 +9194,7 @@
 	   invariant that keytran.end <= fkey.start).  */
 	{
 	  if (fkey.start < t)
-	    (fkey.start = fkey.end = t, fkey.map = Vfunction_key_map);
+	    (fkey.start = fkey.end = t, fkey.map = fkey.parent);
 	}
       else
 	/* If the sequence is unbound, see if we can hang a function key
@@ -9203,7 +9212,7 @@
 				     first_binding >= nmaps) we don't want
 				     to apply this function-key-mapping.  */
 				  fkey.end + 1 == t && first_binding >= nmaps,
-				  &diff, Vfunction_key_map, prompt);
+				  &diff, prompt);
 	    UNGCPRO;
 	    if (done)
 	      {
@@ -9221,7 +9230,7 @@
 
 	  GCPRO3 (fkey.map, keytran.map, delayed_switch_frame);
 	  done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input),
-				1, &diff, Vkey_translation_map, prompt);
+				1, &diff, prompt);
 	  UNGCPRO;
 	  if (done)
 	    {