diff src/events.c @ 4780:2fd201d73a92

Call character_to_event on characters received from XIM, event-Xt.c src/ChangeLog addition: 2009-12-17 Aidan Kehoe <kehoea@parhasard.net> * events.h (character_to_event_meta_behavior): New enumeration, describing what character_to_event should do with characters in the range ?\x80-?\xFF, and passed as the third argument to character_to_event instead of the binary use_console_meta_flag. * events.c (character_to_event, Fcharacter_to_event): * event-unixoid.c (read_event_from_tty_or_stream_desc): * event-stream.c (maybe_kbd_translate, maybe_kbd_translate): * event-msw.c (mswindows_need_event): Use the new enumeration. * event-Xt.c (x_to_emacs_keysym): Call character_to_event when we receive XLookupChars events, passing latin_1_maps_to_itself as the meta_behavior flag, addressing the problem FKtPp sees in 87bpi9mwpu.fsf@yahoo.com.cn
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 17 Dec 2009 17:51:38 +0000
parents 141c2920ea48
children 6ef8256a020a 19a72041c5ed e0db3c197671
line wrap: on
line diff
--- a/src/events.c	Thu Dec 17 17:29:32 2009 +0000
+++ b/src/events.c	Thu Dec 17 17:51:38 2009 +0000
@@ -1195,7 +1195,12 @@
     }
 }
 
-/* USE_CONSOLE_META_FLAG is as in `character-to-event'.
+/* META_BEHAVIOR can be one of the following values, defined in events.h:
+
+    high_bit_is_meta
+    use_console_meta_flag
+    latin_1_maps_to_itself
+
    DO_BACKSPACE_MAPPING means that if CON is a TTY, and C is a the TTY's
    backspace character, the event will have keysym `backspace' instead of
    '(control h).  It is clearly correct to do this conversion is the
@@ -1245,7 +1250,7 @@
 
 void
 character_to_event (Ichar c, Lisp_Event *event, struct console *con,
-		    int use_console_meta_flag,
+		    character_to_event_meta_behavior meta_behavior,
 		    int USED_IF_TTY (do_backspace_mapping))
 {
   Lisp_Object k = Qnil;
@@ -1256,13 +1261,10 @@
 #ifndef MULE
   c &= 255;
 #endif
-  if (c > 127 && c <= 255)
+  if (meta_behavior != latin_1_maps_to_itself && c > 127 && c <= 255)
     {
-      /* #### What if the user wanted a Latin-1 char?  Perhaps the answer
-	 is what was suggested above.
-      */
       int meta_flag = 1;
-      if (use_console_meta_flag && CONSOLE_TTY_P (con))
+      if (meta_behavior == use_console_meta_flag && CONSOLE_TTY_P (con))
 	meta_flag = TTY_FLAGS (con).meta_key;
       switch (meta_flag)
 	{
@@ -1451,7 +1453,7 @@
 inverse functions, since events contain much more information than the
 Lisp character object type can encode.
 */
-       (keystroke, event, console, use_console_meta_flag))
+       (keystroke, event, console, use_console_meta_flag_))
 {
   struct console *con = decode_console (console);
   if (NILP (event))
@@ -1464,7 +1466,8 @@
     {
       CHECK_CHAR_COERCE_INT (keystroke);
       character_to_event (XCHAR (keystroke), XEVENT (event), con,
-			  !NILP (use_console_meta_flag), 1);
+			  (NILP (use_console_meta_flag_) ?
+			   high_bit_is_meta : use_console_meta_flag), 1); 
     }
   return event;
 }