comparison src/event-Xt.c @ 306:9ea74add5d37 r21-0b51

Import from CVS: tag r21-0b51
author cvs
date Mon, 13 Aug 2007 10:41:58 +0200
parents 4b85ae5eabfb
children 7c94d56991e1
comparison
equal deleted inserted replaced
305:18920a7e9a86 306:9ea74add5d37
767 static Lisp_Object 767 static Lisp_Object
768 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) 768 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p)
769 /* simple_p means don't try too hard (ASCII only) */ 769 /* simple_p means don't try too hard (ASCII only) */
770 { 770 {
771 KeySym keysym = 0; 771 KeySym keysym = 0;
772 772
773 #ifdef HAVE_XIM 773 #ifdef HAVE_XIM
774 int len; 774 int len;
775 char buffer[64]; 775 char buffer[64];
776 char *bufptr = buffer; 776 char *bufptr = buffer;
777 int bufsiz = sizeof (buffer); 777 int bufsiz = sizeof (buffer);
792 { 792 {
793 /* Apparently it's necessary to specify a dummy here (rather 793 /* Apparently it's necessary to specify a dummy here (rather
794 than passing in 0) to avoid crashes on German IRIX */ 794 than passing in 0) to avoid crashes on German IRIX */
795 char dummy[256]; 795 char dummy[256];
796 XLookupString (event, dummy, 200, &keysym, 0); 796 XLookupString (event, dummy, 200, &keysym, 0);
797 return x_keysym_to_emacs_keysym (keysym, simple_p); 797 return (IsModifierKey (keysym) || keysym == XK_Mode_switch )
798 ? Qnil : x_keysym_to_emacs_keysym (keysym, simple_p);
798 } 799 }
799 #endif /* ! XIM_MOTIF */ 800 #endif /* ! XIM_MOTIF */
800 801
801 #ifdef HAVE_XIM 802 #ifdef HAVE_XIM
802 Lookup_String: /* Come-From XBufferOverflow */ 803 Lookup_String: /* Come-From XBufferOverflow */
841 842
842 switch (status) 843 switch (status)
843 { 844 {
844 case XLookupKeySym: 845 case XLookupKeySym:
845 case XLookupBoth: 846 case XLookupBoth:
846 return x_keysym_to_emacs_keysym (keysym, simple_p); 847 return (IsModifierKey (keysym) || keysym == XK_Mode_switch )
848 ? Qnil : x_keysym_to_emacs_keysym (keysym, simple_p);
847 849
848 case XLookupChars: 850 case XLookupChars:
849 { 851 {
850 /* Generate multiple emacs events */ 852 /* Generate multiple emacs events */
851 struct device *d = get_device_from_display (event->display); 853 struct device *d = get_device_from_display (event->display);
981 983
982 if (key_event_p) 984 if (key_event_p)
983 { 985 {
984 Lisp_Object keysym; 986 Lisp_Object keysym;
985 XKeyEvent *ev = &x_event->xkey; 987 XKeyEvent *ev = &x_event->xkey;
986 KeyCode keycode = ev->keycode;
987
988 if (x_key_is_modifier_p (keycode, d)) /* it's a modifier key */
989 return 0;
990
991 /* This used to compute the frame from the given X window and 988 /* This used to compute the frame from the given X window and
992 store it here, but we really don't care about the frame. */ 989 store it here, but we really don't care about the frame. */
993 emacs_event->channel = DEVICE_CONSOLE (d); 990 emacs_event->channel = DEVICE_CONSOLE (d);
994 keysym = x_to_emacs_keysym (&x_event->xkey, 0); 991 keysym = x_to_emacs_keysym (&x_event->xkey, 0);
995 992
996 /* If the emacs keysym is nil, then that means that the 993 /* If the emacs keysym is nil, then that means that the X
997 X keysym was NoSymbol, which probably means that 994 keysym was either a Modifier or NoSymbol, which
998 we're in the midst of reading a Multi_key sequence, 995 probably means that we're in the midst of reading a
999 or a "dead" key prefix, or XIM input. Ignore it. */ 996 Multi_key sequence, or a "dead" key prefix, or XIM
997 input. Ignore it. */
1000 if (NILP (keysym)) 998 if (NILP (keysym))
1001 return 0; 999 return 0;
1002 1000
1003 /* More Caps_Lock garbage: Caps_Lock should *only* add the 1001 /* More Caps_Lock garbage: Caps_Lock should *only* add the
1004 shift modifier to two-case keys (that is, A-Z and 1002 shift modifier to two-case keys (that is, A-Z and