Mercurial > hg > xemacs-beta
changeset 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 | fd98353950a4 |
children | 8a653fbe5c27 |
files | src/ChangeLog src/event-Xt.c src/event-msw.c src/event-stream.c src/event-unixoid.c src/events.c src/events.h src/keymap.c |
diffstat | 8 files changed, 55 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Thu Dec 17 17:29:32 2009 +0000 +++ b/src/ChangeLog Thu Dec 17 17:51:38 2009 +0000 @@ -1,3 +1,19 @@ +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 + 2009-12-17 Aidan Kehoe <kehoea@parhasard.net> * elhash.c (HASH_TABLE_DEFAULT_REHASH_THRESHOLD):
--- a/src/event-Xt.c Thu Dec 17 17:29:32 2009 +0000 +++ b/src/event-Xt.c Thu Dec 17 17:51:38 2009 +0000 @@ -967,10 +967,12 @@ Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); Lisp_Event *ev = XEVENT (emacs_event); ev->channel = DEVICE_CONSOLE (d); + XSET_EVENT_TYPE (emacs_event, key_press_event); + /* Make sure space and linefeed and so on get the proper + keysyms. */ + character_to_event (ch, ev, XCONSOLE (ev->channel), + latin_1_maps_to_itself, 0); ev->timestamp = event->time; - XSET_EVENT_TYPE (emacs_event, key_press_event); - XSET_EVENT_KEY_MODIFIERS (emacs_event, 0); - XSET_EVENT_KEY_KEYSYM (emacs_event, make_char (ch)); enqueue_dispatch_event (emacs_event); } Lstream_close (istr);
--- a/src/event-msw.c Thu Dec 17 17:29:32 2009 +0000 +++ b/src/event-msw.c Thu Dec 17 17:51:38 2009 +0000 @@ -1616,7 +1616,8 @@ /* Here we really do want to set the use_console_meta_flag because the char is from the TTY. */ - character_to_event (ch, XEVENT (event), con, 1, 1); + character_to_event (ch, XEVENT (event), con, + use_console_meta_flag, 1); XSET_EVENT_CHANNEL (event, porca_troia); enqueue_dispatch_event (event); }
--- a/src/event-stream.c Thu Dec 17 17:29:32 2009 +0000 +++ b/src/event-stream.c Thu Dec 17 17:51:38 2009 +0000 @@ -3189,7 +3189,8 @@ Lisp_Object ev2 = Fmake_event (Qnil, Qnil); character_to_event (XCHAR (traduit), XEVENT (ev2), - XCONSOLE (XEVENT_CHANNEL (event)), 0, 1); + XCONSOLE (XEVENT_CHANNEL (event)), + high_bit_is_meta, 1); XSET_EVENT_KEY_KEYSYM (event, XEVENT_KEY_KEYSYM (ev2)); XSET_EVENT_KEY_MODIFIERS (event, XEVENT_KEY_MODIFIERS (ev2)); Fdeallocate_event (ev2); @@ -3214,7 +3215,8 @@ Lisp_Object ev2 = Fmake_event (Qnil, Qnil); character_to_event (XCHAR (traduit), XEVENT (ev2), - XCONSOLE (XEVENT_CHANNEL (event)), 0, 1); + XCONSOLE (XEVENT_CHANNEL (event)), + high_bit_is_meta, 1); XSET_EVENT_KEY_KEYSYM (event, XEVENT_KEY_KEYSYM (ev2)); XSET_EVENT_KEY_MODIFIERS (event, XEVENT_KEY_MODIFIERS (event) |
--- a/src/event-unixoid.c Thu Dec 17 17:29:32 2009 +0000 +++ b/src/event-unixoid.c Thu Dec 17 17:51:38 2009 +0000 @@ -118,9 +118,7 @@ } else { - /* Here we really do want to set the use_console_meta_flag because - the char is from the TTY. */ - character_to_event (ch, event, con, 1, 1); + character_to_event (ch, event, con, use_console_meta_flag, 1); event->channel = console; return 1; }
--- 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; }
--- a/src/events.h Thu Dec 17 17:29:32 2009 +0000 +++ b/src/events.h Thu Dec 17 17:51:38 2009 +0000 @@ -951,13 +951,20 @@ /* Maybe this should be trickier */ #define KEYSYM(x) (intern (x)) +typedef enum character_to_event_meta_behavior +{ + high_bit_is_meta, + use_console_meta_flag, + latin_1_maps_to_itself +} character_to_event_meta_behavior; + /* from events.c */ void format_event_object (Eistring *buf, Lisp_Object event, int brief); /*void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);*/ -void character_to_event (Ichar c, Lisp_Event *event, - struct console *con, - int use_console_meta_flag, +void character_to_event (Ichar, Lisp_Event *, struct console *, + character_to_event_meta_behavior meta_flag, int do_backspace_mapping); + void zero_event (Lisp_Event *e); #define MECR_DEALLOCATE_EVENT 1
--- a/src/keymap.c Thu Dec 17 17:29:32 2009 +0000 +++ b/src/keymap.c Thu Dec 17 17:51:38 2009 +0000 @@ -1103,7 +1103,8 @@ struct gcpro gcpro1; GCPRO1 (event); character_to_event (XCHAR (idx), XEVENT (event), - XCONSOLE (Vselected_console), 0, 0); + XCONSOLE (Vselected_console), + high_bit_is_meta, 0); indirection.keysym = XEVENT_KEY_KEYSYM (event); indirection.modifiers = XEVENT_KEY_MODIFIERS (event); UNGCPRO; @@ -1529,7 +1530,7 @@ struct gcpro gcpro1; GCPRO1 (event); character_to_event (XCHAR_OR_CHAR_INT (spec), XEVENT (event), - XCONSOLE (Vselected_console), 0, 0); + XCONSOLE (Vselected_console), high_bit_is_meta, 0); SET_KEY_DATA_KEYSYM (returned_value, XEVENT_KEY_KEYSYM (event)); SET_KEY_DATA_MODIFIERS (returned_value, XEVENT_KEY_MODIFIERS (event)); @@ -3526,7 +3527,8 @@ Lisp_Object event = Fmake_event (Qnil, Qnil); CHECK_CHAR_COERCE_INT (key); character_to_event (XCHAR (key), XEVENT (event), - XCONSOLE (Vselected_console), 0, 1); + XCONSOLE (Vselected_console), + high_bit_is_meta, 1); format_event_object (buf, event, 1); Fdeallocate_event (event); }