changeset 1324:44215417cf6e

* xterm.c (x_find_modifier_meanings): If there are no modifiers containing a Meta_ keysym, use the Alt keysyms to denote meta. (construct_mouse_click): Set the down_modifier bit on mouse button press events. (XTread_socket): When processing keypress events, use x_meta_mod_mask when processing ordinary ASCII characters, not just when processing function keys and other non-ASCII events. (XTread_socket): If we receive a MappingNotify event with the `request' member set to `MappingModifier', then call x_find_modifier_meanings to refresh x_meta_mod_mask.
author Jim Blandy <jimb@redhat.com>
date Sat, 03 Oct 1992 05:10:14 +0000
parents 25b5b55a3916
children f03e559aac3e
files src/xterm.c
diffstat 1 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Sat Oct 03 03:30:53 1992 +0000
+++ b/src/xterm.c	Sat Oct 03 05:10:14 1992 +0000
@@ -1448,10 +1448,11 @@
 static void
 x_find_modifier_meanings ()
 {
-  KeyCode min_code, max_code;
+  int min_code, max_code;
   KeySym *syms;
   int syms_per_code;
   XModifierKeymap *mods;
+  int alt_mod_mask = 0;
 
   x_meta_mod_mask = 0;
   
@@ -1480,20 +1481,31 @@
 
 	    for (code_col = 0; code_col < syms_per_code; code_col++)
 	      {
-		int sym = syms[(code * syms_per_code) + code_col];
-
-		if (sym == XK_Meta_L || sym == XK_Meta_R)
+		int sym = syms[((code - min_code) * syms_per_code) + code_col];
+
+		switch (sym)
 		  {
+		  case XK_Meta_L:
+		  case XK_Meta_R:
 		    x_meta_mod_mask |= (1 << row);
 		    break;
+
+		  case XK_Alt_L:
+		  case XK_Alt_R:
+		    alt_mod_mask |= (1 << row);
+		    break;
 		  }
 	      }
 	  }
 	}
   }
 
+  /* If we couldn't find any meta keys, accept any alt keys as meta keys.  */
+  if (! x_meta_mod_mask)
+    x_meta_mod_mask = alt_mod_mask;
+
   XFree ((char *) syms);
-  XFreeModifierMap (mods);
+  XFreeModifiermap (mods);
 }
 
 
@@ -1535,7 +1547,9 @@
   XSET (result->code, Lisp_Int, event->button);
   result->timestamp = event->time;
   result->modifiers = (x_convert_modifiers (event->state)
-		       | (event->type == ButtonRelease ? up_modifier : 0));
+		       | (event->type == ButtonRelease
+			  ? up_modifier 
+			  : down_modifier));
 
   /* Notice if the mouse is still grabbed.  */
   if (event->type == ButtonPress)
@@ -2061,7 +2075,7 @@
 
 		      if (nbytes == 1)
 			{
-			  if (modifiers & Mod1Mask)
+			  if (modifiers & x_meta_mod_mask)
 			    *copy_buffer |= METABIT;
 			  bufp->kind = ascii_keystroke;
 			  XSET (bufp->code, Lisp_Int, *copy_buffer);
@@ -2390,6 +2404,8 @@
 	    /* Someone has changed the keyboard mapping - flush the
 	       local cache.  */
 	    XRefreshKeyboardMapping (&event.xmapping);
+	  else if (event.xmapping.request == MappingModifier)
+	    x_find_modifier_meanings ();
 	  break;
 
 	default: