Mercurial > emacs
comparison src/keyboard.c @ 44353:4c66bc116ca9
(make_lispy_event): Handle unknown keysyms together
with system-specific keysyms. Use it also for unknown function keys.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 03 Apr 2002 04:49:33 +0000 |
parents | b6b565886e78 |
children | 05ce431b76fb |
comparison
equal
deleted
inserted
replaced
44352:d38932df86fc | 44353:4c66bc116ca9 |
---|---|
4760 Qfunction_key, Qnil, | 4760 Qfunction_key, Qnil, |
4761 lispy_accent_keys, &accent_key_syms, | 4761 lispy_accent_keys, &accent_key_syms, |
4762 (sizeof (lispy_accent_keys) | 4762 (sizeof (lispy_accent_keys) |
4763 / sizeof (lispy_accent_keys[0]))); | 4763 / sizeof (lispy_accent_keys[0]))); |
4764 | 4764 |
4765 /* Handle system-specific keysyms. */ | 4765 #ifdef XK_kana_A |
4766 if (event->code & (1 << 28)) | 4766 if (event->code >= 0x400 && event->code < 0x500) |
4767 return modify_event_symbol (event->code - 0x400, | |
4768 event->modifiers & ~shift_modifier, | |
4769 Qfunction_key, Qnil, | |
4770 lispy_kana_keys, &func_key_syms, | |
4771 (sizeof (lispy_kana_keys) | |
4772 / sizeof (lispy_kana_keys[0]))); | |
4773 #endif /* XK_kana_A */ | |
4774 | |
4775 #ifdef ISO_FUNCTION_KEY_OFFSET | |
4776 if (event->code < FUNCTION_KEY_OFFSET | |
4777 && event->code >= ISO_FUNCTION_KEY_OFFSET) | |
4778 return modify_event_symbol (event->code - ISO_FUNCTION_KEY_OFFSET, | |
4779 event->modifiers, | |
4780 Qfunction_key, Qnil, | |
4781 iso_lispy_function_keys, &func_key_syms, | |
4782 (sizeof (iso_lispy_function_keys) | |
4783 / sizeof (iso_lispy_function_keys[0]))); | |
4784 #endif | |
4785 | |
4786 /* Handle system-specific or unknown keysyms. */ | |
4787 if (event->code & (1 << 28) | |
4788 || event->code - FUNCTION_KEY_OFFSET < 0 | |
4789 || (event->code - FUNCTION_KEY_OFFSET | |
4790 >= sizeof lispy_function_keys / sizeof *lispy_function_keys) | |
4791 || !lispy_function_keys[event->code - FUNCTION_KEY_OFFSET]) | |
4767 { | 4792 { |
4768 /* We need to use an alist rather than a vector as the cache | 4793 /* We need to use an alist rather than a vector as the cache |
4769 since we can't make a vector long enuf. */ | 4794 since we can't make a vector long enuf. */ |
4770 if (NILP (current_kboard->system_key_syms)) | 4795 if (NILP (current_kboard->system_key_syms)) |
4771 current_kboard->system_key_syms = Fcons (Qnil, Qnil); | 4796 current_kboard->system_key_syms = Fcons (Qnil, Qnil); |
4774 Qfunction_key, | 4799 Qfunction_key, |
4775 current_kboard->Vsystem_key_alist, | 4800 current_kboard->Vsystem_key_alist, |
4776 0, ¤t_kboard->system_key_syms, | 4801 0, ¤t_kboard->system_key_syms, |
4777 (unsigned) -1); | 4802 (unsigned) -1); |
4778 } | 4803 } |
4779 | |
4780 #ifdef XK_kana_A | |
4781 if (event->code >= 0x400 && event->code < 0x500) | |
4782 return modify_event_symbol (event->code - 0x400, | |
4783 event->modifiers & ~shift_modifier, | |
4784 Qfunction_key, Qnil, | |
4785 lispy_kana_keys, &func_key_syms, | |
4786 (sizeof (lispy_kana_keys) | |
4787 / sizeof (lispy_kana_keys[0]))); | |
4788 #endif /* XK_kana_A */ | |
4789 | |
4790 #ifdef ISO_FUNCTION_KEY_OFFSET | |
4791 if (event->code < FUNCTION_KEY_OFFSET | |
4792 && event->code >= ISO_FUNCTION_KEY_OFFSET) | |
4793 return modify_event_symbol (event->code - ISO_FUNCTION_KEY_OFFSET, | |
4794 event->modifiers, | |
4795 Qfunction_key, Qnil, | |
4796 iso_lispy_function_keys, &func_key_syms, | |
4797 (sizeof (iso_lispy_function_keys) | |
4798 / sizeof (iso_lispy_function_keys[0]))); | |
4799 else | |
4800 #endif | |
4801 | |
4802 #ifdef HAVE_X_WINDOWS | |
4803 if (event->code - FUNCTION_KEY_OFFSET < 0 | |
4804 || (event->code - FUNCTION_KEY_OFFSET | |
4805 >= sizeof lispy_function_keys / sizeof *lispy_function_keys)) | |
4806 { | |
4807 /* EVENT->code is an unknown keysym, for example someone | |
4808 assigned `ccaron' to a key in a locale where | |
4809 XmbLookupString doesn't return a translation for it. */ | |
4810 char *name; | |
4811 Lisp_Object symbol; | |
4812 | |
4813 BLOCK_INPUT; | |
4814 /* This returns a pointer to a static area. Don't free it. */ | |
4815 name = XKeysymToString (event->code); | |
4816 symbol = name ? intern (name) : Qnil; | |
4817 UNBLOCK_INPUT; | |
4818 | |
4819 if (!NILP (symbol)) | |
4820 return apply_modifiers (event->modifiers, symbol); | |
4821 } | |
4822 #endif /* HAVE_X_WINDOWS */ | |
4823 | 4804 |
4824 return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET, | 4805 return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET, |
4825 event->modifiers, | 4806 event->modifiers, |
4826 Qfunction_key, Qnil, | 4807 Qfunction_key, Qnil, |
4827 lispy_function_keys, &func_key_syms, | 4808 lispy_function_keys, &func_key_syms, |