Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 373:6240c7796c7a r21-2b2
Import from CVS: tag r21-2b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:04:06 +0200 |
parents | cc15677e0335 |
children | 8626e4521993 |
comparison
equal
deleted
inserted
replaced
372:49e1ed2d7ed8 | 373:6240c7796c7a |
---|---|
656 Of course, we DO worry about it, so we need a special translation. */ | 656 Of course, we DO worry about it, so we need a special translation. */ |
657 void | 657 void |
658 emacs_Xt_mapping_action (Widget w, XEvent* event) | 658 emacs_Xt_mapping_action (Widget w, XEvent* event) |
659 { | 659 { |
660 struct device *d = get_device_from_display (event->xany.display); | 660 struct device *d = get_device_from_display (event->xany.display); |
661 | |
662 if (DEVICE_X_BEING_DELETED (d)) | |
663 return; | |
661 #if 0 | 664 #if 0 |
662 /* nyet. Now this is handled by Xt. */ | 665 /* nyet. Now this is handled by Xt. */ |
663 XRefreshKeyboardMapping (&event->xmapping); | 666 XRefreshKeyboardMapping (&event->xmapping); |
664 #endif | 667 #endif |
665 /* xmodmap generates about a billion MappingKeyboard events, followed | 668 /* xmodmap generates about a billion MappingKeyboard events, followed |
767 static Lisp_Object | 770 static Lisp_Object |
768 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) | 771 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) |
769 /* simple_p means don't try too hard (ASCII only) */ | 772 /* simple_p means don't try too hard (ASCII only) */ |
770 { | 773 { |
771 KeySym keysym = 0; | 774 KeySym keysym = 0; |
772 | 775 |
773 #ifdef HAVE_XIM | 776 #ifdef HAVE_XIM |
774 int len; | 777 int len; |
775 char buffer[64]; | 778 char buffer[64]; |
776 char *bufptr = buffer; | 779 char *bufptr = buffer; |
777 int bufsiz = sizeof (buffer); | 780 int bufsiz = sizeof (buffer); |
792 { | 795 { |
793 /* Apparently it's necessary to specify a dummy here (rather | 796 /* Apparently it's necessary to specify a dummy here (rather |
794 than passing in 0) to avoid crashes on German IRIX */ | 797 than passing in 0) to avoid crashes on German IRIX */ |
795 char dummy[256]; | 798 char dummy[256]; |
796 XLookupString (event, dummy, 200, &keysym, 0); | 799 XLookupString (event, dummy, 200, &keysym, 0); |
797 return x_keysym_to_emacs_keysym (keysym, simple_p); | 800 return (IsModifierKey (keysym) || keysym == XK_Mode_switch ) |
801 ? Qnil : x_keysym_to_emacs_keysym (keysym, simple_p); | |
798 } | 802 } |
799 #endif /* ! XIM_MOTIF */ | 803 #endif /* ! XIM_MOTIF */ |
800 | 804 |
801 #ifdef HAVE_XIM | 805 #ifdef HAVE_XIM |
802 Lookup_String: /* Come-From XBufferOverflow */ | 806 Lookup_String: /* Come-From XBufferOverflow */ |
841 | 845 |
842 switch (status) | 846 switch (status) |
843 { | 847 { |
844 case XLookupKeySym: | 848 case XLookupKeySym: |
845 case XLookupBoth: | 849 case XLookupBoth: |
846 return x_keysym_to_emacs_keysym (keysym, simple_p); | 850 return (IsModifierKey (keysym) || keysym == XK_Mode_switch ) |
851 ? Qnil : x_keysym_to_emacs_keysym (keysym, simple_p); | |
847 | 852 |
848 case XLookupChars: | 853 case XLookupChars: |
849 { | 854 { |
850 /* Generate multiple emacs events */ | 855 /* Generate multiple emacs events */ |
851 struct device *d = get_device_from_display (event->display); | 856 struct device *d = get_device_from_display (event->display); |
919 { | 924 { |
920 Display *display = x_event->xany.display; | 925 Display *display = x_event->xany.display; |
921 struct device *d = get_device_from_display (display); | 926 struct device *d = get_device_from_display (display); |
922 struct x_device *xd = DEVICE_X_DATA (d); | 927 struct x_device *xd = DEVICE_X_DATA (d); |
923 | 928 |
929 if (DEVICE_X_BEING_DELETED (d)) | |
930 /* #### Uh, is this 0 correct? */ | |
931 return 0; | |
932 | |
924 set_last_server_timestamp (d, x_event); | 933 set_last_server_timestamp (d, x_event); |
925 | 934 |
926 switch (x_event->type) | 935 switch (x_event->type) |
927 { | 936 { |
928 case KeyRelease: | 937 case KeyRelease: |
981 | 990 |
982 if (key_event_p) | 991 if (key_event_p) |
983 { | 992 { |
984 Lisp_Object keysym; | 993 Lisp_Object keysym; |
985 XKeyEvent *ev = &x_event->xkey; | 994 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 | 995 /* 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. */ | 996 store it here, but we really don't care about the frame. */ |
993 emacs_event->channel = DEVICE_CONSOLE (d); | 997 emacs_event->channel = DEVICE_CONSOLE (d); |
994 keysym = x_to_emacs_keysym (&x_event->xkey, 0); | 998 keysym = x_to_emacs_keysym (&x_event->xkey, 0); |
995 | 999 |
996 /* If the emacs keysym is nil, then that means that the | 1000 /* If the emacs keysym is nil, then that means that the X |
997 X keysym was NoSymbol, which probably means that | 1001 keysym was either a Modifier or NoSymbol, which |
998 we're in the midst of reading a Multi_key sequence, | 1002 probably means that we're in the midst of reading a |
999 or a "dead" key prefix, or XIM input. Ignore it. */ | 1003 Multi_key sequence, or a "dead" key prefix, or XIM |
1004 input. Ignore it. */ | |
1000 if (NILP (keysym)) | 1005 if (NILP (keysym)) |
1001 return 0; | 1006 return 0; |
1002 | 1007 |
1003 /* More Caps_Lock garbage: Caps_Lock should *only* add the | 1008 /* More Caps_Lock garbage: Caps_Lock should *only* add the |
1004 shift modifier to two-case keys (that is, A-Z and | 1009 shift modifier to two-case keys (that is, A-Z and |
1335 | 1340 |
1336 void emacs_Xt_handle_focus_event (XEvent *event); | 1341 void emacs_Xt_handle_focus_event (XEvent *event); |
1337 void | 1342 void |
1338 emacs_Xt_handle_focus_event (XEvent *event) | 1343 emacs_Xt_handle_focus_event (XEvent *event) |
1339 { | 1344 { |
1345 struct device *d = get_device_from_display (event->xany.display); | |
1346 struct frame *f; | |
1347 | |
1348 if (DEVICE_X_BEING_DELETED (d)) | |
1349 return; | |
1350 | |
1340 /* | 1351 /* |
1341 * It's curious that we're using x_any_window_to_frame() instead | 1352 * It's curious that we're using x_any_window_to_frame() instead |
1342 * of x_window_to_frame(). I don't know what the impact of this is. | 1353 * of x_window_to_frame(). I don't know what the impact of this is. |
1343 */ | 1354 */ |
1344 | 1355 f = x_any_window_to_frame (d, event->xfocus.window); |
1345 struct frame *f = | |
1346 x_any_window_to_frame (get_device_from_display (event->xany.display), | |
1347 event->xfocus.window); | |
1348 if (!f) | 1356 if (!f) |
1349 /* focus events are sometimes generated just before | 1357 /* focus events are sometimes generated just before |
1350 a frame is destroyed. */ | 1358 a frame is destroyed. */ |
1351 return; | 1359 return; |
1352 handle_focus_event_1 (f, event->type == FocusIn); | 1360 handle_focus_event_1 (f, event->type == FocusIn); |
1509 { | 1517 { |
1510 /* This function can GC */ | 1518 /* This function can GC */ |
1511 XEvent *event = &emacs_event->event.magic.underlying_x_event; | 1519 XEvent *event = &emacs_event->event.magic.underlying_x_event; |
1512 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); | 1520 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); |
1513 | 1521 |
1514 if (!FRAME_LIVE_P (f)) | 1522 if (!FRAME_LIVE_P (f) || DEVICE_X_BEING_DELETED (XDEVICE (FRAME_DEVICE (f)))) |
1515 return; | 1523 return; |
1516 | 1524 |
1517 switch (event->type) | 1525 switch (event->type) |
1518 { | 1526 { |
1519 case SelectionRequest: | 1527 case SelectionRequest: |