Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 183:e121b013d1f0 r20-3b18
Import from CVS: tag r20-3b18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:54:23 +0200 |
parents | 9ad43877534d |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
182:f07455f06202 | 183:e121b013d1f0 |
---|---|
169 static void | 169 static void |
170 x_reset_key_mapping (struct device *d) | 170 x_reset_key_mapping (struct device *d) |
171 { | 171 { |
172 Display *display = DEVICE_X_DISPLAY (d); | 172 Display *display = DEVICE_X_DISPLAY (d); |
173 struct x_device *xd = DEVICE_X_DATA (d); | 173 struct x_device *xd = DEVICE_X_DATA (d); |
174 int max_code; | |
175 if (xd->x_keysym_map) | 174 if (xd->x_keysym_map) |
176 XFree ((char *) xd->x_keysym_map); | 175 XFree ((char *) xd->x_keysym_map); |
177 XDisplayKeycodes (display, &xd->x_keysym_map_min_code, | 176 XDisplayKeycodes (display, |
178 &max_code); | 177 &xd->x_keysym_map_min_code, |
179 xd->x_keysym_map = | 178 &xd->x_keysym_map_max_code); |
180 XGetKeyboardMapping (display, xd->x_keysym_map_min_code, | 179 xd->x_keysym_map = XGetKeyboardMapping (display, |
181 max_code - xd->x_keysym_map_min_code + 1, | 180 xd->x_keysym_map_min_code, |
182 &xd->x_keysym_map_keysyms_per_code); | 181 xd->x_keysym_map_max_code - |
182 xd->x_keysym_map_min_code + 1, | |
183 &xd->x_keysym_map_keysyms_per_code); | |
183 } | 184 } |
184 | 185 |
185 static CONST char * | 186 static CONST char * |
186 index_to_name (int indice) | 187 index_to_name (int indice) |
187 { | 188 { |
188 switch (indice) | 189 switch (indice) |
189 { | 190 { |
190 case ShiftMapIndex: return "ModShift"; | 191 case ShiftMapIndex: return "ModShift"; |
191 case LockMapIndex: return "ModLock"; | 192 case LockMapIndex: return "ModLock"; |
192 case ControlMapIndex: return "ModControl"; | 193 case ControlMapIndex: return "ModControl"; |
193 case Mod1MapIndex: return "Mod1"; | 194 case Mod1MapIndex: return "Mod1"; |
194 case Mod2MapIndex: return "Mod2"; | 195 case Mod2MapIndex: return "Mod2"; |
195 case Mod3MapIndex: return "Mod3"; | 196 case Mod3MapIndex: return "Mod3"; |
196 case Mod4MapIndex: return "Mod4"; | 197 case Mod4MapIndex: return "Mod4"; |
399 | 400 |
400 static int | 401 static int |
401 x_key_is_modifier_p (KeyCode keycode, struct device *d) | 402 x_key_is_modifier_p (KeyCode keycode, struct device *d) |
402 { | 403 { |
403 struct x_device *xd = DEVICE_X_DATA (d); | 404 struct x_device *xd = DEVICE_X_DATA (d); |
404 KeySym *syms = &xd->x_keysym_map [(keycode - xd->x_keysym_map_min_code) * | 405 KeySym *syms; |
405 xd->x_keysym_map_keysyms_per_code]; | |
406 int i; | 406 int i; |
407 | |
408 if (keycode < xd->x_keysym_map_min_code || | |
409 keycode > xd->x_keysym_map_max_code) | |
410 return 0; | |
411 | |
412 syms = &xd->x_keysym_map [(keycode - xd->x_keysym_map_min_code) * | |
413 xd->x_keysym_map_keysyms_per_code]; | |
407 for (i = 0; i < xd->x_keysym_map_keysyms_per_code; i++) | 414 for (i = 0; i < xd->x_keysym_map_keysyms_per_code; i++) |
408 if (IsModifierKey (syms [i]) || | 415 if (IsModifierKey (syms [i]) || |
409 syms [i] == XK_Mode_switch) /* why doesn't IsModifierKey count this? */ | 416 syms [i] == XK_Mode_switch) /* why doesn't IsModifierKey count this? */ |
410 return 1; | 417 return 1; |
411 return 0; | 418 return 0; |
441 return; | 448 return; |
442 | 449 |
443 xd = DEVICE_X_DATA (d); | 450 xd = DEVICE_X_DATA (d); |
444 keycode = ev->xkey.keycode; | 451 keycode = ev->xkey.keycode; |
445 type = ev->type; | 452 type = ev->type; |
446 | 453 |
454 if (keycode < xd->x_keysym_map_min_code || | |
455 keycode > xd->x_keysym_map_max_code) | |
456 return; | |
457 | |
447 if (! ((type == KeyPress || type == KeyRelease) && | 458 if (! ((type == KeyPress || type == KeyRelease) && |
448 x_key_is_modifier_p (keycode, d))) | 459 x_key_is_modifier_p (keycode, d))) |
449 { /* Not a modifier key */ | 460 { /* Not a modifier key */ |
450 Bool key_event_p = (type == KeyPress || type == KeyRelease); | 461 Bool key_event_p = (type == KeyPress || type == KeyRelease); |
451 | 462 |
452 if (type == KeyPress && !xd->last_downkey) | 463 if (type == KeyPress && !xd->last_downkey) |
453 xd->last_downkey = keycode; | 464 xd->last_downkey = keycode; |
454 else if (type == ButtonPress || | 465 else if (type == ButtonPress || |
455 (type == KeyPress && xd->last_downkey && | 466 (type == KeyPress && xd->last_downkey && |
456 (keycode != xd->last_downkey || | 467 (keycode != xd->last_downkey || |
564 characters, where "alphabetic" means something more than simply A-Z. | 575 characters, where "alphabetic" means something more than simply A-Z. |
565 That is, if Caps_Lock is down, typing ESC doesn't produce Shift-ESC. | 576 That is, if Caps_Lock is down, typing ESC doesn't produce Shift-ESC. |
566 But if shift-lock is down, then it does. */ | 577 But if shift-lock is down, then it does. */ |
567 if (xd->lock_interpretation == XK_Shift_Lock) | 578 if (xd->lock_interpretation == XK_Shift_Lock) |
568 return 1; | 579 return 1; |
569 | 580 |
570 return | 581 return |
571 ((sym >= XK_A) && (sym <= XK_Z)) || | 582 ((sym >= XK_A) && (sym <= XK_Z)) || |
572 ((sym >= XK_a) && (sym <= XK_z)) || | 583 ((sym >= XK_a) && (sym <= XK_z)) || |
573 ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) || | 584 ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) || |
574 ((sym >= XK_agrave) && (sym <= XK_odiaeresis)) || | 585 ((sym >= XK_agrave) && (sym <= XK_odiaeresis)) || |
578 | 589 |
579 /* called from EmacsFrame.c (actually from Xt itself) when a | 590 /* called from EmacsFrame.c (actually from Xt itself) when a |
580 MappingNotify event is received. In its infinite wisdom, Xt | 591 MappingNotify event is received. In its infinite wisdom, Xt |
581 decided that Xt event handlers never get MappingNotify events. | 592 decided that Xt event handlers never get MappingNotify events. |
582 O'Reilly Xt Programming Manual 9.1.2 says: | 593 O'Reilly Xt Programming Manual 9.1.2 says: |
583 | 594 |
584 MappingNotify is automatically handled by Xt, so it isn't passed | 595 MappingNotify is automatically handled by Xt, so it isn't passed |
585 to event handlers and you don't need to worry about it. | 596 to event handlers and you don't need to worry about it. |
586 | 597 |
587 Of course, we DO worry about it, so we need a special translation. */ | 598 Of course, we DO worry about it, so we need a special translation. */ |
588 void | 599 void |
644 return KEYSYM (buf); | 655 return KEYSYM (buf); |
645 } | 656 } |
646 /* If it's got a one-character name, that's good enough. */ | 657 /* If it's got a one-character name, that's good enough. */ |
647 if (!name[1]) | 658 if (!name[1]) |
648 return make_char (name[0]); | 659 return make_char (name[0]); |
649 | 660 |
650 /* If it's in the "Keyboard" character set, downcase it. | 661 /* If it's in the "Keyboard" character set, downcase it. |
651 The case of those keysyms is too totally random for us to | 662 The case of those keysyms is too totally random for us to |
652 force anyone to remember them. | 663 force anyone to remember them. |
653 The case of the other character sets is significant, however. | 664 The case of the other character sets is significant, however. |
654 */ | 665 */ |
723 print_status_when (XLookupKeySym); | 734 print_status_when (XLookupKeySym); |
724 print_status_when (XLookupBoth); | 735 print_status_when (XLookupBoth); |
725 print_status_when (XLookupChars); | 736 print_status_when (XLookupChars); |
726 print_status_when (XLookupNone); | 737 print_status_when (XLookupNone); |
727 print_status_when (XBufferOverflow); | 738 print_status_when (XBufferOverflow); |
728 | 739 |
729 if (status == XLookupKeySym || status == XLookupBoth) | 740 if (status == XLookupKeySym || status == XLookupBoth) |
730 stderr_out (" keysym=%s", XKeysymToString (keysym)); | 741 stderr_out (" keysym=%s", XKeysymToString (keysym)); |
731 if (status == XLookupChars || status == XLookupBoth) | 742 if (status == XLookupChars || status == XLookupBoth) |
732 { | 743 { |
733 if (len != 1) | 744 if (len != 1) |
763 | 774 |
764 /* ### Use Fget_coding_system (Vcomposed_input_coding_system) */ | 775 /* ### Use Fget_coding_system (Vcomposed_input_coding_system) */ |
765 instream = | 776 instream = |
766 make_decoding_input_stream (XLSTREAM (instream), | 777 make_decoding_input_stream (XLSTREAM (instream), |
767 Fget_coding_system (Qautomatic_conversion)); | 778 Fget_coding_system (Qautomatic_conversion)); |
768 | 779 |
769 while ((ch = Lstream_get_emchar (XLSTREAM (instream))) != EOF) | 780 while ((ch = Lstream_get_emchar (XLSTREAM (instream))) != EOF) |
770 { | 781 { |
771 Lisp_Object emacs_event = Fmake_event (); | 782 Lisp_Object emacs_event = Fmake_event (); |
772 XEVENT (emacs_event)->channel = DEVICE_CONSOLE (d); | 783 XEVENT (emacs_event)->channel = DEVICE_CONSOLE (d); |
773 XEVENT (emacs_event)->event_type = key_press_event; | 784 XEVENT (emacs_event)->event_type = key_press_event; |
853 DEVICE_X_MOUSE_TIMESTAMP (d) = | 864 DEVICE_X_MOUSE_TIMESTAMP (d) = |
854 DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (d) = | 865 DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (d) = |
855 key_event_p ? x_event->xkey.time : x_event->xbutton.time; | 866 key_event_p ? x_event->xkey.time : x_event->xbutton.time; |
856 | 867 |
857 x_handle_sticky_modifiers (x_event, d); | 868 x_handle_sticky_modifiers (x_event, d); |
858 | 869 |
859 if (*state & ControlMask) modifiers |= MOD_CONTROL; | 870 if (*state & ControlMask) modifiers |= MOD_CONTROL; |
860 if (*state & xd->MetaMask) modifiers |= MOD_META; | 871 if (*state & xd->MetaMask) modifiers |= MOD_META; |
861 if (*state & xd->SuperMask) modifiers |= MOD_SUPER; | 872 if (*state & xd->SuperMask) modifiers |= MOD_SUPER; |
862 if (*state & xd->HyperMask) modifiers |= MOD_HYPER; | 873 if (*state & xd->HyperMask) modifiers |= MOD_HYPER; |
863 if (*state & xd->AltMask) modifiers |= MOD_ALT; | 874 if (*state & xd->AltMask) modifiers |= MOD_ALT; |
886 | 897 |
887 /* This used to compute the frame from the given X window and | 898 /* This used to compute the frame from the given X window and |
888 store it here, but we really don't care about the frame. */ | 899 store it here, but we really don't care about the frame. */ |
889 emacs_event->channel = DEVICE_CONSOLE (d); | 900 emacs_event->channel = DEVICE_CONSOLE (d); |
890 keysym = x_to_emacs_keysym (&x_event->xkey, 0); | 901 keysym = x_to_emacs_keysym (&x_event->xkey, 0); |
891 | 902 |
892 /* If the emacs keysym is nil, then that means that the | 903 /* If the emacs keysym is nil, then that means that the |
893 X keysym was NoSymbol, which probably means that | 904 X keysym was NoSymbol, which probably means that |
894 we're in the midst of reading a Multi_key sequence, | 905 we're in the midst of reading a Multi_key sequence, |
895 or a "dead" key prefix. Ignore it. */ | 906 or a "dead" key prefix, or XIM input. Ignore it. */ |
896 if (NILP (keysym)) | 907 if (NILP (keysym)) |
897 return 0; | 908 return 0; |
898 | 909 |
899 /* More Caps_Lock garbage: Caps_Lock should *only* add the | 910 /* More Caps_Lock garbage: Caps_Lock should *only* add the |
900 shift modifier to two-case keys (that is, A-Z and | 911 shift modifier to two-case keys (that is, A-Z and |
939 XButtonEvent *ev = &x_event->xbutton; | 950 XButtonEvent *ev = &x_event->xbutton; |
940 struct frame *frame = x_window_to_frame (d, ev->window); | 951 struct frame *frame = x_window_to_frame (d, ev->window); |
941 if (! frame) | 952 if (! frame) |
942 return 0; /* not for us */ | 953 return 0; /* not for us */ |
943 XSETFRAME (emacs_event->channel, frame); | 954 XSETFRAME (emacs_event->channel, frame); |
944 | 955 |
945 emacs_event->event_type = (x_event->type == ButtonPress) ? | 956 emacs_event->event_type = (x_event->type == ButtonPress) ? |
946 button_press_event : button_release_event; | 957 button_press_event : button_release_event; |
947 | 958 |
948 emacs_event->event.button.modifiers = modifiers; | 959 emacs_event->event.button.modifiers = modifiers; |
949 emacs_event->timestamp = ev->time; | 960 emacs_event->timestamp = ev->time; |
950 emacs_event->event.button.button = ev->button; | 961 emacs_event->event.button.button = ev->button; |
951 emacs_event->event.button.x = ev->x; | 962 emacs_event->event.button.x = ev->x; |
952 emacs_event->event.button.y = ev->y; | 963 emacs_event->event.button.y = ev->y; |
953 } | 964 } |
954 } | 965 } |
955 break; | 966 break; |
956 | 967 |
957 case MotionNotify: | 968 case MotionNotify: |
958 { | 969 { |
959 XMotionEvent *ev = &x_event->xmotion; | 970 XMotionEvent *ev = &x_event->xmotion; |
960 struct frame *frame = x_window_to_frame (d, ev->window); | 971 struct frame *frame = x_window_to_frame (d, ev->window); |
961 unsigned int modifiers = 0; | 972 unsigned int modifiers = 0; |
962 XMotionEvent event2; | 973 XMotionEvent event2; |
963 | 974 |
964 if (! frame) | 975 if (! frame) |
965 return 0; /* not for us */ | 976 return 0; /* not for us */ |
966 | 977 |
967 /* We use MotionHintMask, so we will get only one motion event | 978 /* We use MotionHintMask, so we will get only one motion event |
968 until the next time we call XQueryPointer or the user | 979 until the next time we call XQueryPointer or the user |
969 clicks the mouse. So call XQueryPointer now (meaning that | 980 clicks the mouse. So call XQueryPointer now (meaning that |
970 the event will be in sync with the server just before | 981 the event will be in sync with the server just before |
971 Fnext_event() returns). If the mouse is still in motion, | 982 Fnext_event() returns). If the mouse is still in motion, |
977 &event2.root, &event2.subwindow, | 988 &event2.root, &event2.subwindow, |
978 &event2.x_root, &event2.y_root, | 989 &event2.x_root, &event2.y_root, |
979 &event2.x, &event2.y, | 990 &event2.x, &event2.y, |
980 &event2.state)) | 991 &event2.state)) |
981 ev = &event2; /* only one structure copy */ | 992 ev = &event2; /* only one structure copy */ |
982 | 993 |
983 DEVICE_X_MOUSE_TIMESTAMP (d) = ev->time; | 994 DEVICE_X_MOUSE_TIMESTAMP (d) = ev->time; |
984 | 995 |
985 XSETFRAME (emacs_event->channel, frame); | 996 XSETFRAME (emacs_event->channel, frame); |
986 emacs_event->event_type = pointer_motion_event; | 997 emacs_event->event_type = pointer_motion_event; |
987 emacs_event->timestamp = ev->time; | 998 emacs_event->timestamp = ev->time; |
996 /* Currently ignores Shift_Lock but probably shouldn't | 1007 /* Currently ignores Shift_Lock but probably shouldn't |
997 (but it definitely should ignore Caps_Lock). */ | 1008 (but it definitely should ignore Caps_Lock). */ |
998 emacs_event->event.motion.modifiers = modifiers; | 1009 emacs_event->event.motion.modifiers = modifiers; |
999 } | 1010 } |
1000 break; | 1011 break; |
1001 | 1012 |
1002 case ClientMessage: | 1013 case ClientMessage: |
1003 { | 1014 { |
1004 /* Patch bogus TAKE_FOCUS messages from MWM; CurrentTime is | 1015 /* Patch bogus TAKE_FOCUS messages from MWM; CurrentTime is |
1005 passed as the timestamp of the TAKE_FOCUS, which the ICCCM | 1016 passed as the timestamp of the TAKE_FOCUS, which the ICCCM |
1006 explicitly prohibits. */ | 1017 explicitly prohibits. */ |
1011 { | 1022 { |
1012 ev->data.l[1] = DEVICE_X_LAST_SERVER_TIMESTAMP (d); | 1023 ev->data.l[1] = DEVICE_X_LAST_SERVER_TIMESTAMP (d); |
1013 } | 1024 } |
1014 } | 1025 } |
1015 /* fall through */ | 1026 /* fall through */ |
1016 | 1027 |
1017 default: /* it's a magic event */ | 1028 default: /* it's a magic event */ |
1018 { | 1029 { |
1019 struct frame *frame; | 1030 struct frame *frame; |
1020 Window w; | 1031 Window w; |
1021 | 1032 size_t event_size; |
1033 XEvent *x_event_copy = &emacs_event->event.magic.underlying_x_event; | |
1034 | |
1035 #define FROB(event_member, window_member) \ | |
1036 x_event_copy->event_member = x_event->event_member; \ | |
1037 w = x_event->event_member.window_member | |
1038 | |
1022 switch (x_event->type) | 1039 switch (x_event->type) |
1023 { | 1040 { |
1024 /* Note: the number of cases could be reduced to two or | 1041 case SelectionRequest: FROB(xselectionrequest, owner); break; |
1025 three by using xany.window, but it's perhaps clearer | 1042 case SelectionClear: FROB(xselectionclear, window); break; |
1026 and potentially more robust this way */ | 1043 case SelectionNotify: FROB(xselection, requestor); break; |
1027 case SelectionRequest: w = x_event->xselectionrequest.owner; break; | 1044 case PropertyNotify: FROB(xproperty, window); break; |
1028 case SelectionClear: w = x_event->xselectionclear.window; break; | 1045 case ClientMessage: FROB(xclient, window); break; |
1029 case SelectionNotify: w = x_event->xselection.requestor; break; | 1046 case ConfigureNotify: FROB(xconfigure, window); break; |
1030 case PropertyNotify: w = x_event->xproperty.window; break; | 1047 case Expose: |
1031 case ClientMessage: w = x_event->xclient.window; break; | 1048 case GraphicsExpose: FROB(xexpose, window); break; |
1032 case ConfigureNotify: w = x_event->xconfigure.window; break; | 1049 case MapNotify: |
1033 case Expose: | 1050 case UnmapNotify: FROB(xmap, window); break; |
1034 case GraphicsExpose: w = x_event->xexpose.window; break; | 1051 case EnterNotify: |
1035 case MapNotify: | 1052 case LeaveNotify: FROB(xcrossing, window); break; |
1036 case UnmapNotify: w = x_event->xmap.window; break; | 1053 case FocusIn: |
1037 case EnterNotify: | 1054 case FocusOut: FROB(xfocus, window); break; |
1038 case LeaveNotify: w = x_event->xcrossing.window; break; | 1055 case VisibilityNotify: FROB(xvisibility, window); break; |
1039 case FocusIn: | 1056 default: |
1040 case FocusOut: w = x_event->xfocus.window; break; | 1057 w = x_event->xany.window; |
1041 case VisibilityNotify: w = x_event->xvisibility.window; break; | 1058 *x_event_copy = *x_event; |
1042 default: w = x_event->xany.window; break; | 1059 break; |
1043 } | 1060 } |
1061 #undef FROB | |
1044 frame = x_any_window_to_frame (d, w); | 1062 frame = x_any_window_to_frame (d, w); |
1045 | 1063 |
1046 if (!frame) | 1064 if (!frame) |
1047 return 0; | 1065 return 0; |
1048 | 1066 |
1049 emacs_event->event_type = magic_event; | 1067 emacs_event->event_type = magic_event; |
1050 XSETFRAME (emacs_event->channel, frame); | 1068 XSETFRAME (emacs_event->channel, frame); |
1051 emacs_event->event.magic.underlying_x_event = *x_event; | 1069 |
1052 break; | 1070 break; |
1053 } | 1071 } |
1054 } | 1072 } |
1055 return 1; | 1073 return 1; |
1056 } | 1074 } |
1082 */ | 1100 */ |
1083 { | 1101 { |
1084 Lisp_Object frm; | 1102 Lisp_Object frm; |
1085 Lisp_Object conser; | 1103 Lisp_Object conser; |
1086 struct gcpro gcpro1; | 1104 struct gcpro gcpro1; |
1087 | 1105 |
1088 XSETFRAME (frm, f); | 1106 XSETFRAME (frm, f); |
1089 conser = Fcons (frm, Fcons (FRAME_DEVICE (f), in_p ? Qt : Qnil)); | 1107 conser = Fcons (frm, Fcons (FRAME_DEVICE (f), in_p ? Qt : Qnil)); |
1090 GCPRO1 (conser); | 1108 GCPRO1 (conser); |
1091 emacs_handle_focus_change_preliminary (conser); | 1109 emacs_handle_focus_change_preliminary (conser); |
1092 enqueue_magic_eval_event (emacs_handle_focus_change_final, | 1110 enqueue_magic_eval_event (emacs_handle_focus_change_final, |
1103 { | 1121 { |
1104 /* | 1122 /* |
1105 * It's curious that we're using x_any_window_to_frame() instead | 1123 * It's curious that we're using x_any_window_to_frame() instead |
1106 * of x_window_to_frame(). I don't know what the impact of this is. | 1124 * of x_window_to_frame(). I don't know what the impact of this is. |
1107 */ | 1125 */ |
1108 | 1126 |
1109 struct frame *f = | 1127 struct frame *f = |
1110 x_any_window_to_frame (get_device_from_display (event->xany.display), | 1128 x_any_window_to_frame (get_device_from_display (event->xany.display), |
1111 event->xfocus.window); | 1129 event->xfocus.window); |
1112 if (!f) | 1130 if (!f) |
1113 /* focus events are sometimes generated just before | 1131 /* focus events are sometimes generated just before |
1136 va_run_hook_with_args (Qmap_frame_hook, 1, frame); | 1154 va_run_hook_with_args (Qmap_frame_hook, 1, frame); |
1137 #ifdef EPOCH | 1155 #ifdef EPOCH |
1138 dispatch_epoch_event (f, event, Qx_map); | 1156 dispatch_epoch_event (f, event, Qx_map); |
1139 #endif | 1157 #endif |
1140 } | 1158 } |
1141 else if (FRAME_VISIBLE_P (f) && !is_visible) | 1159 else if (FRAME_VISIBLE_P (f) && !is_visible) |
1142 { | 1160 { |
1143 FRAME_VISIBLE_P (f) = 0; | 1161 FRAME_VISIBLE_P (f) = 0; |
1144 va_run_hook_with_args (Qunmap_frame_hook, 1, frame); | 1162 va_run_hook_with_args (Qunmap_frame_hook, 1, frame); |
1145 #ifdef EPOCH | 1163 #ifdef EPOCH |
1146 dispatch_epoch_event (f, event, Qx_unmap); | 1164 dispatch_epoch_event (f, event, Qx_unmap); |
1255 event->xclient.data.l[0] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) | 1273 event->xclient.data.l[0] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) |
1256 { | 1274 { |
1257 handle_focus_event_1 (f, 1); | 1275 handle_focus_event_1 (f, 1); |
1258 #if 0 | 1276 #if 0 |
1259 /* If there is a dialog box up, focus on it. | 1277 /* If there is a dialog box up, focus on it. |
1260 | 1278 |
1261 #### Actually, we're raising it too, which is wrong. We should | 1279 #### Actually, we're raising it too, which is wrong. We should |
1262 #### just focus on it, but lwlib doesn't currently give us an | 1280 #### just focus on it, but lwlib doesn't currently give us an |
1263 #### easy way to do that. This should be fixed. | 1281 #### easy way to do that. This should be fixed. |
1264 */ | 1282 */ |
1265 unsigned long take_focus_timestamp = event->xclient.data.l[1]; | 1283 unsigned long take_focus_timestamp = event->xclient.data.l[1]; |
1282 | 1300 |
1283 static void | 1301 static void |
1284 emacs_Xt_handle_magic_event (struct Lisp_Event *emacs_event) | 1302 emacs_Xt_handle_magic_event (struct Lisp_Event *emacs_event) |
1285 { | 1303 { |
1286 /* This function can GC */ | 1304 /* This function can GC */ |
1287 XEvent *event = (XEvent *) &emacs_event->event.magic.underlying_x_event; | 1305 XEvent *event = &emacs_event->event.magic.underlying_x_event; |
1288 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); | 1306 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); |
1289 | 1307 |
1290 if (!FRAME_LIVE_P (f)) | 1308 if (!FRAME_LIVE_P (f)) |
1291 return; | 1309 return; |
1292 | 1310 |
1293 switch (event->type) | 1311 switch (event->type) |
1294 { | 1312 { |
1295 case SelectionRequest: | 1313 case SelectionRequest: |
1296 x_handle_selection_request (&event->xselectionrequest); | 1314 x_handle_selection_request (&event->xselectionrequest); |
1297 break; | 1315 break; |
1298 | 1316 |
1299 case SelectionClear: | 1317 case SelectionClear: |
1300 x_handle_selection_clear (&event->xselectionclear); | 1318 x_handle_selection_clear (&event->xselectionclear); |
1301 break; | 1319 break; |
1302 | 1320 |
1303 case SelectionNotify: | 1321 case SelectionNotify: |
1304 x_handle_selection_notify (&event->xselection); | 1322 x_handle_selection_notify (&event->xselection); |
1305 break; | 1323 break; |
1306 | 1324 |
1307 case PropertyNotify: | 1325 case PropertyNotify: |
1308 x_handle_property_notify (&event->xproperty); | 1326 x_handle_property_notify (&event->xproperty); |
1309 #ifdef EPOCH | 1327 #ifdef EPOCH |
1310 dispatch_epoch_event (f, event, Qx_property_change); | 1328 dispatch_epoch_event (f, event, Qx_property_change); |
1311 #endif | 1329 #endif |
1312 break; | 1330 break; |
1313 | 1331 |
1314 case Expose: | 1332 case Expose: |
1315 x_redraw_exposed_area (f, event->xexpose.x, event->xexpose.y, | 1333 x_redraw_exposed_area (f, event->xexpose.x, event->xexpose.y, |
1316 event->xexpose.width, event->xexpose.height); | 1334 event->xexpose.width, event->xexpose.height); |
1317 break; | 1335 break; |
1318 | 1336 |
1319 case GraphicsExpose: /* This occurs when an XCopyArea's source area was | 1337 case GraphicsExpose: /* This occurs when an XCopyArea's source area was |
1320 obscured or not available. */ | 1338 obscured or not available. */ |
1321 x_redraw_exposed_area (f, event->xexpose.x, event->xexpose.y, | 1339 x_redraw_exposed_area (f, event->xexpose.x, event->xexpose.y, |
1322 event->xexpose.width, event->xexpose.height); | 1340 event->xexpose.width, event->xexpose.height); |
1323 break; | 1341 break; |
1324 | 1342 |
1325 case MapNotify: | 1343 case MapNotify: |
1326 case UnmapNotify: | 1344 case UnmapNotify: |
1327 handle_map_event (f, event); | 1345 handle_map_event (f, event); |
1328 break; | 1346 break; |
1329 | 1347 |
1330 case EnterNotify: | 1348 case EnterNotify: |
1331 if (event->xcrossing.detail != NotifyInferior) | 1349 if (event->xcrossing.detail != NotifyInferior) |
1332 { | 1350 { |
1333 Lisp_Object frame; | 1351 Lisp_Object frame; |
1334 | 1352 |
1335 XSETFRAME (frame, f); | 1353 XSETFRAME (frame, f); |
1336 /* FRAME_X_MOUSE_P (f) = 1; */ | 1354 /* FRAME_X_MOUSE_P (f) = 1; */ |
1337 va_run_hook_with_args (Qmouse_enter_frame_hook, 1, frame); | 1355 va_run_hook_with_args (Qmouse_enter_frame_hook, 1, frame); |
1338 } | 1356 } |
1339 break; | 1357 break; |
1340 | 1358 |
1341 case LeaveNotify: | 1359 case LeaveNotify: |
1342 if (event->xcrossing.detail != NotifyInferior) | 1360 if (event->xcrossing.detail != NotifyInferior) |
1343 { | 1361 { |
1344 Lisp_Object frame; | 1362 Lisp_Object frame; |
1345 | 1363 |
1346 XSETFRAME (frame, f); | 1364 XSETFRAME (frame, f); |
1347 /* FRAME_X_MOUSE_P (f) = 0; */ | 1365 /* FRAME_X_MOUSE_P (f) = 0; */ |
1348 va_run_hook_with_args (Qmouse_leave_frame_hook, 1, frame); | 1366 va_run_hook_with_args (Qmouse_leave_frame_hook, 1, frame); |
1349 } | 1367 } |
1350 break; | 1368 break; |
1351 | 1369 |
1352 case FocusIn: | 1370 case FocusIn: |
1353 case FocusOut: | 1371 case FocusOut: |
1354 #ifdef EXTERNAL_WIDGET | 1372 #ifdef EXTERNAL_WIDGET |
1355 /* External widget lossage: Ben said: | 1373 /* External widget lossage: Ben said: |
1356 YUCK. The only way to make focus changes work properly is to | 1374 YUCK. The only way to make focus changes work properly is to |
1359 if (FRAME_X_EXTERNAL_WINDOW_P (f)) | 1377 if (FRAME_X_EXTERNAL_WINDOW_P (f)) |
1360 break; | 1378 break; |
1361 #endif | 1379 #endif |
1362 handle_focus_event_1 (f, event->type == FocusIn); | 1380 handle_focus_event_1 (f, event->type == FocusIn); |
1363 break; | 1381 break; |
1364 | 1382 |
1365 case ClientMessage: | 1383 case ClientMessage: |
1366 handle_client_message (f, event); | 1384 handle_client_message (f, event); |
1367 break; | 1385 break; |
1368 | 1386 |
1369 case VisibilityNotify: /* window visiblity has changed */ | 1387 case VisibilityNotify: /* window visiblity has changed */ |
1370 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f))) | 1388 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f))) |
1371 { | 1389 { |
1372 FRAME_X_TOTALLY_VISIBLE_P (f) = | 1390 FRAME_X_TOTALLY_VISIBLE_P (f) = |
1373 (event->xvisibility.state == VisibilityUnobscured); | 1391 (event->xvisibility.state == VisibilityUnobscured); |
1374 /* Note that the fvwm pager only sends VisibilityNotify when | 1392 /* Note that the fvwm pager only sends VisibilityNotify when |
1375 changing pages. Is this all we need to do ? JV */ | 1393 changing pages. Is this all we need to do ? JV */ |
1376 /* Nope. We must at least trigger a redisplay here. | 1394 /* Nope. We must at least trigger a redisplay here. |
1377 Since this case seems similar to MapNotify, I've | 1395 Since this case seems similar to MapNotify, I've |
1378 factored out some code to change_frame_visibility(). | 1396 factored out some code to change_frame_visibility(). |
1379 This triggers the necessary redisplay and runs | 1397 This triggers the necessary redisplay and runs |
1380 (un)map-frame-hook. - dkindred@cs.cmu.edu */ | 1398 (un)map-frame-hook. - dkindred@cs.cmu.edu */ |
1381 /* Changed it again to support the tristate visibility flag */ | 1399 /* Changed it again to support the tristate visibility flag */ |
1382 change_frame_visibility (f, (event->xvisibility.state | 1400 change_frame_visibility (f, (event->xvisibility.state |
1383 != VisibilityFullyObscured) ? 1 : -1); | 1401 != VisibilityFullyObscured) ? 1 : -1); |
1384 } | 1402 } |
1385 break; | 1403 break; |
1386 | 1404 |
1387 case ConfigureNotify: | 1405 case ConfigureNotify: |
1388 #ifdef HAVE_XIM | 1406 #ifdef HAVE_XIM |
1389 XIM_SetGeometry (f); | 1407 XIM_SetGeometry (f); |
1390 #endif | 1408 #endif |
1391 #if 0 | 1409 #if 0 |
1568 for the tty fd when there's really only input available | 1586 for the tty fd when there's really only input available |
1569 on some process's fd. (It will subsequently get called | 1587 on some process's fd. (It will subsequently get called |
1570 for that process's fd, so returning without setting any | 1588 for that process's fd, so returning without setting any |
1571 flags will take care of it.) To see the problem, uncomment | 1589 flags will take care of it.) To see the problem, uncomment |
1572 the stderr_out below, turn NORMAL_QUIT_CHECK_TIMEOUT_MSECS | 1590 the stderr_out below, turn NORMAL_QUIT_CHECK_TIMEOUT_MSECS |
1573 down to 25, do sh -c 'xemacs -nw -q -f shell 2>/tmp/log' | 1591 down to 25, do sh -c 'xemacs -nw -q -f shell 2>/tmp/log' |
1574 and press return repeatedly. (Seen under AIX & Linux.) | 1592 and press return repeatedly. (Seen under AIX & Linux.) |
1575 -dkindred@cs.cmu.edu */ | 1593 -dkindred@cs.cmu.edu */ |
1576 if (!poll_fds_for_input (temp_mask)) | 1594 if (!poll_fds_for_input (temp_mask)) |
1577 { | 1595 { |
1578 #if 0 | 1596 #if 0 |
1579 stderr_out ("mark_what_as_being_ready: no input available (fd=%d)\n", | 1597 stderr_out ("mark_what_as_being_ready: no input available (fd=%d)\n", |
1580 closure->fd); | 1598 closure->fd); |
1581 #endif | 1599 #endif |
1617 assert (!filedesc_to_what_closure[fd]); | 1635 assert (!filedesc_to_what_closure[fd]); |
1618 | 1636 |
1619 closure = (struct what_is_ready_closure *) xmalloc (sizeof (*closure)); | 1637 closure = (struct what_is_ready_closure *) xmalloc (sizeof (*closure)); |
1620 closure->fd = fd; | 1638 closure->fd = fd; |
1621 closure->what = what; | 1639 closure->what = what; |
1622 closure->id = | 1640 closure->id = |
1623 XtAppAddInput (Xt_app_con, fd, | 1641 XtAppAddInput (Xt_app_con, fd, |
1624 (XtPointer) (XtInputReadMask /* | XtInputExceptMask */), | 1642 (XtPointer) (XtInputReadMask /* | XtInputExceptMask */), |
1625 Xt_what_callback, closure); | 1643 Xt_what_callback, closure); |
1626 filedesc_to_what_closure[fd] = closure; | 1644 filedesc_to_what_closure[fd] = closure; |
1627 } | 1645 } |
1674 } | 1692 } |
1675 | 1693 |
1676 static void | 1694 static void |
1677 emacs_Xt_select_process (struct Lisp_Process *p) | 1695 emacs_Xt_select_process (struct Lisp_Process *p) |
1678 { | 1696 { |
1679 int infd; | |
1680 Lisp_Object process; | 1697 Lisp_Object process; |
1681 | 1698 int infd = event_stream_unixoid_select_process (p); |
1682 infd = event_stream_unixoid_select_process (p); | |
1683 | 1699 |
1684 XSETPROCESS (process, p); | 1700 XSETPROCESS (process, p); |
1685 select_filedesc (infd, process); | 1701 select_filedesc (infd, process); |
1686 } | 1702 } |
1687 | 1703 |
1688 static void | 1704 static void |
1689 emacs_Xt_unselect_process (struct Lisp_Process *p) | 1705 emacs_Xt_unselect_process (struct Lisp_Process *p) |
1690 { | 1706 { |
1691 int infd; | 1707 int infd = event_stream_unixoid_unselect_process (p); |
1692 | |
1693 infd = event_stream_unixoid_unselect_process (p); | |
1694 | 1708 |
1695 unselect_filedesc (infd); | 1709 unselect_filedesc (infd); |
1696 } | 1710 } |
1697 | 1711 |
1698 /* This is called from GC when a process object is about to be freed. | 1712 /* This is called from GC when a process object is about to be freed. |
1756 select_filedesc (infd, console); | 1770 select_filedesc (infd, console); |
1757 #ifdef HAVE_GPM | 1771 #ifdef HAVE_GPM |
1758 /* On a stream device (ie: noninteractive), bad things can happen. */ | 1772 /* On a stream device (ie: noninteractive), bad things can happen. */ |
1759 if (EQ (CONSOLE_TYPE (con), Qtty)) { | 1773 if (EQ (CONSOLE_TYPE (con), Qtty)) { |
1760 mousefd = CONSOLE_TTY_MOUSE_FD (con); | 1774 mousefd = CONSOLE_TTY_MOUSE_FD (con); |
1761 if (mousefd >= 0) { | 1775 /* We check filedesc_to_what_closure[fd] here because if you run |
1776 ** XEmacs from a TTY, it will fire up GPM, select the mouse fd, then | |
1777 ** if you run gnuattach to connect to another TTY, it will fire up | |
1778 ** GPM again, and try to reselect the mouse fd. GPM uses the same | |
1779 ** fd for every connection apparently, and select_filedesc will | |
1780 ** fail its assertion if we try to select it twice. | |
1781 */ | |
1782 if ((mousefd >= 0) && !filedesc_to_what_closure[mousefd]) { | |
1762 select_filedesc (mousefd, console); | 1783 select_filedesc (mousefd, console); |
1763 } | 1784 } |
1764 } | 1785 } |
1765 #endif | 1786 #endif |
1766 } | 1787 } |
1909 describe_event_window (ev->window, ev->display); | 1930 describe_event_window (ev->window, ev->display); |
1910 stderr_out (" mode: %s\n", XEvent_mode_to_string (ev->mode)); | 1931 stderr_out (" mode: %s\n", XEvent_mode_to_string (ev->mode)); |
1911 stderr_out (" detail: %s\n", XEvent_detail_to_string(ev->detail)); | 1932 stderr_out (" detail: %s\n", XEvent_detail_to_string(ev->detail)); |
1912 break; | 1933 break; |
1913 } | 1934 } |
1914 | 1935 |
1915 case KeyPress: | 1936 case KeyPress: |
1916 { | 1937 { |
1917 XKeyEvent *ev = &event->xkey; | 1938 XKeyEvent *ev = &event->xkey; |
1918 unsigned int state = ev->state; | 1939 unsigned int state = ev->state; |
1919 | 1940 |
1920 describe_event_window (ev->window, ev->display); | 1941 describe_event_window (ev->window, ev->display); |
1921 stderr_out (" subwindow: %ld\n", ev->subwindow); | 1942 stderr_out (" subwindow: %ld\n", ev->subwindow); |
1922 stderr_out (" state: "); | 1943 stderr_out (" state: "); |
1923 /* Complete list of modifier key masks */ | 1944 /* Complete list of modifier key masks */ |
1924 if (state & ShiftMask) stderr_out ("Shift "); | 1945 if (state & ShiftMask) stderr_out ("Shift "); |
1927 if (state & Mod1Mask) stderr_out ("Mod1 "); | 1948 if (state & Mod1Mask) stderr_out ("Mod1 "); |
1928 if (state & Mod2Mask) stderr_out ("Mod2 "); | 1949 if (state & Mod2Mask) stderr_out ("Mod2 "); |
1929 if (state & Mod3Mask) stderr_out ("Mod3 "); | 1950 if (state & Mod3Mask) stderr_out ("Mod3 "); |
1930 if (state & Mod4Mask) stderr_out ("Mod4 "); | 1951 if (state & Mod4Mask) stderr_out ("Mod4 "); |
1931 if (state & Mod5Mask) stderr_out ("Mod5 "); | 1952 if (state & Mod5Mask) stderr_out ("Mod5 "); |
1932 | 1953 |
1933 if (! state) | 1954 if (! state) |
1934 stderr_out ("vanilla\n"); | 1955 stderr_out ("vanilla\n"); |
1935 else | 1956 else |
1936 stderr_out ("\n"); | 1957 stderr_out ("\n"); |
1937 if (x_key_is_modifier_p (ev->keycode, d)) | 1958 if (x_key_is_modifier_p (ev->keycode, d)) |
1938 stderr_out (" Modifier key"); | 1959 stderr_out (" Modifier key"); |
1939 stderr_out (" keycode: 0x%x\n", ev->keycode); | 1960 stderr_out (" keycode: 0x%x\n", ev->keycode); |
1940 } | 1961 } |
1941 break; | 1962 break; |
1942 | 1963 |
1943 case Expose: | 1964 case Expose: |
1944 if (x_debug_events > 1) | 1965 if (x_debug_events > 1) |
1945 { | 1966 { |
1946 XExposeEvent *ev = &event->xexpose; | 1967 XExposeEvent *ev = &event->xexpose; |
1947 describe_event_window (ev->window, ev->display); | 1968 describe_event_window (ev->window, ev->display); |
1950 stderr_out (" count: %d\n", ev->count); | 1971 stderr_out (" count: %d\n", ev->count); |
1951 } | 1972 } |
1952 else | 1973 else |
1953 stderr_out ("\n"); | 1974 stderr_out ("\n"); |
1954 break; | 1975 break; |
1955 | 1976 |
1956 case GraphicsExpose: | 1977 case GraphicsExpose: |
1957 if (x_debug_events > 1) | 1978 if (x_debug_events > 1) |
1958 { | 1979 { |
1959 XGraphicsExposeEvent *ev = &event->xgraphicsexpose; | 1980 XGraphicsExposeEvent *ev = &event->xgraphicsexpose; |
1960 describe_event_window (ev->drawable, ev->display); | 1981 describe_event_window (ev->drawable, ev->display); |
1966 stderr_out (" count: %d\n", ev->count); | 1987 stderr_out (" count: %d\n", ev->count); |
1967 } | 1988 } |
1968 else | 1989 else |
1969 stderr_out ("\n"); | 1990 stderr_out ("\n"); |
1970 break; | 1991 break; |
1971 | 1992 |
1972 case EnterNotify: | 1993 case EnterNotify: |
1973 case LeaveNotify: | 1994 case LeaveNotify: |
1974 if (x_debug_events > 1) | 1995 if (x_debug_events > 1) |
1975 { | 1996 { |
1976 XCrossingEvent *ev = &event->xcrossing; | 1997 XCrossingEvent *ev = &event->xcrossing; |
2013 stderr_out(" state: %s\n", XEvent_visibility_to_string(ev->state)); | 2034 stderr_out(" state: %s\n", XEvent_visibility_to_string(ev->state)); |
2014 } | 2035 } |
2015 else | 2036 else |
2016 stderr_out ("\n"); | 2037 stderr_out ("\n"); |
2017 break; | 2038 break; |
2018 | 2039 |
2019 case ClientMessage: | 2040 case ClientMessage: |
2020 { | 2041 { |
2021 XClientMessageEvent *ev = &event->xclient; | 2042 XClientMessageEvent *ev = &event->xclient; |
2022 char *name = XGetAtomName (ev->display, ev->message_type); | 2043 char *name = XGetAtomName (ev->display, ev->message_type); |
2023 stderr_out ("%s", name); | 2044 stderr_out ("%s", name); |
2028 } | 2049 } |
2029 XFree (name); | 2050 XFree (name); |
2030 stderr_out ("\n"); | 2051 stderr_out ("\n"); |
2031 break; | 2052 break; |
2032 } | 2053 } |
2033 | 2054 |
2034 default: | 2055 default: |
2035 stderr_out ("\n"); | 2056 stderr_out ("\n"); |
2036 break; | 2057 break; |
2037 } | 2058 } |
2038 | 2059 |
2071 | 2092 |
2072 void | 2093 void |
2073 signal_special_Xt_user_event (Lisp_Object channel, Lisp_Object function, | 2094 signal_special_Xt_user_event (Lisp_Object channel, Lisp_Object function, |
2074 Lisp_Object object) | 2095 Lisp_Object object) |
2075 { | 2096 { |
2076 Lisp_Object event; | 2097 Lisp_Object event = Fmake_event (); |
2077 | |
2078 event = Fmake_event (); | |
2079 | 2098 |
2080 XEVENT (event)->event_type = misc_user_event; | 2099 XEVENT (event)->event_type = misc_user_event; |
2081 XEVENT (event)->channel = channel; | 2100 XEVENT (event)->channel = channel; |
2082 XEVENT (event)->event.eval.function = function; | 2101 XEVENT (event)->event.eval.function = function; |
2083 XEVENT (event)->event.eval.object = object; | 2102 XEVENT (event)->event.eval.object = object; |
2084 | 2103 |
2085 enqueue_Xt_dispatch_event (event); | 2104 enqueue_Xt_dispatch_event (event); |
2086 } | 2105 } |
2087 | 2106 |
2088 static void | 2107 static void |
2089 emacs_Xt_next_event (struct Lisp_Event *emacs_event) | 2108 emacs_Xt_next_event (struct Lisp_Event *emacs_event) |
2090 { | 2109 { |
2091 we_didnt_get_an_event: | 2110 we_didnt_get_an_event: |
2147 } | 2166 } |
2148 else if (completed_timeouts) | 2167 else if (completed_timeouts) |
2149 Xt_timeout_to_emacs_event (emacs_event); | 2168 Xt_timeout_to_emacs_event (emacs_event); |
2150 else if (fake_event_occurred) | 2169 else if (fake_event_occurred) |
2151 { | 2170 { |
2152 /* A dummy event, so that a cycle of the command loop will | 2171 /* A dummy event, so that a cycle of the command loop will occur. */ |
2153 occur. */ | |
2154 fake_event_occurred = 0; | 2172 fake_event_occurred = 0; |
2155 /* eval events have nil as channel */ | 2173 /* eval events have nil as channel */ |
2156 emacs_event->event_type = eval_event; | 2174 emacs_event->event_type = eval_event; |
2157 emacs_event->event.eval.function = Qidentity; | 2175 emacs_event->event.eval.function = Qidentity; |
2158 emacs_event->event.eval.object = Qnil; | 2176 emacs_event->event.eval.object = Qnil; |
2405 will says "yes" in this case but there isn't really any | 2423 will says "yes" in this case but there isn't really any |
2406 input. Another way of fixing this problem is for the | 2424 input. Another way of fixing this problem is for the |
2407 signal_event_pipe to generate actual input in the form | 2425 signal_event_pipe to generate actual input in the form |
2408 of an identity eval event or something. (#### maybe this | 2426 of an identity eval event or something. (#### maybe this |
2409 actually happens?) */ | 2427 actually happens?) */ |
2410 | 2428 |
2411 if (poll_fds_for_input (process_only_mask)) | 2429 if (poll_fds_for_input (process_only_mask)) |
2412 return 1; | 2430 return 1; |
2413 | 2431 |
2414 pending_value = XtAppPending (Xt_app_con); | 2432 pending_value = XtAppPending (Xt_app_con); |
2415 | 2433 |
2511 Colormap colormap; | 2529 Colormap colormap; |
2512 Status status; | 2530 Status status; |
2513 String params[1]; | 2531 String params[1]; |
2514 Cardinal num_params = 1; | 2532 Cardinal num_params = 1; |
2515 XtAppContext the_app_con = XtDisplayToApplicationContext (dpy); | 2533 XtAppContext the_app_con = XtDisplayToApplicationContext (dpy); |
2516 | 2534 |
2517 if (*num_args != 2) { | 2535 if (*num_args != 2) { |
2518 XtAppWarningMsg(the_app_con, "wrongParameters", "cvtStringToPixel", | 2536 XtAppWarningMsg(the_app_con, "wrongParameters", "cvtStringToPixel", |
2519 "XtToolkitError", | 2537 "XtToolkitError", |
2520 "String to pixel conversion needs screen and colormap arguments", | 2538 "String to pixel conversion needs screen and colormap arguments", |
2521 (String *)NULL, (Cardinal *)NULL); | 2539 (String *)NULL, (Cardinal *)NULL); |
2547 &screenColor); | 2565 &screenColor); |
2548 if (status) { | 2566 if (status) { |
2549 status = allocate_nearest_color (DisplayOfScreen(screen), colormap, | 2567 status = allocate_nearest_color (DisplayOfScreen(screen), colormap, |
2550 &screenColor); | 2568 &screenColor); |
2551 } | 2569 } |
2552 | 2570 |
2553 if (status == 0) { | 2571 if (status == 0) { |
2554 params[0] = str; | 2572 params[0] = str; |
2555 /* Server returns a specific error code but Xlib discards it. Ugh */ | 2573 /* Server returns a specific error code but Xlib discards it. Ugh */ |
2556 if (XLookupColor(DisplayOfScreen(screen), colormap, (char*)str, | 2574 if (XLookupColor(DisplayOfScreen(screen), colormap, (char*) str, |
2557 &exactColor, &screenColor)) { | 2575 &exactColor, &screenColor)) { |
2558 XtAppWarningMsg(the_app_con, "noColormap", "cvtStringToPixel", | 2576 XtAppWarningMsg(the_app_con, "noColormap", "cvtStringToPixel", |
2559 "XtToolkitError", | 2577 "XtToolkitError", |
2560 "Cannot allocate colormap entry for \"%s\"", | 2578 "Cannot allocate colormap entry for \"%s\"", |
2561 params, &num_params); | 2579 params, &num_params); |
2563 } else { | 2581 } else { |
2564 XtAppWarningMsg(the_app_con, "badValue", "cvtStringToPixel", | 2582 XtAppWarningMsg(the_app_con, "badValue", "cvtStringToPixel", |
2565 "XtToolkitError", | 2583 "XtToolkitError", |
2566 "Color name \"%s\" is not defined", params, &num_params); | 2584 "Color name \"%s\" is not defined", params, &num_params); |
2567 } | 2585 } |
2568 | 2586 |
2569 *closure_ret = False; | 2587 *closure_ret = False; |
2570 return False; | 2588 return False; |
2571 } else { | 2589 } else { |
2572 *closure_ret = (char*)True; | 2590 *closure_ret = (char*)True; |
2573 done(Pixel, screenColor.pixel); | 2591 done(Pixel, screenColor.pixel); |
2668 timeout_id_tick = 1; | 2686 timeout_id_tick = 1; |
2669 pending_timeouts = 0; | 2687 pending_timeouts = 0; |
2670 completed_timeouts = 0; | 2688 completed_timeouts = 0; |
2671 | 2689 |
2672 event_stream = Xt_event_stream; | 2690 event_stream = Xt_event_stream; |
2673 | 2691 |
2674 #if defined(HAVE_XIM) || defined(USE_XFONTSET) | 2692 #if defined(HAVE_XIM) || defined(USE_XFONTSET) |
2675 Initialize_Locale(); | 2693 Initialize_Locale(); |
2676 #endif /* HAVE_XIM || USE_XFONTSET */ | 2694 #endif /* HAVE_XIM || USE_XFONTSET */ |
2677 | 2695 |
2678 XtToolkitInitialize (); | 2696 XtToolkitInitialize (); |
2679 Xt_app_con = XtCreateApplicationContext (); | 2697 Xt_app_con = XtCreateApplicationContext (); |
2680 XtAppSetFallbackResources (Xt_app_con, (String *) x_fallback_resources); | 2698 XtAppSetFallbackResources (Xt_app_con, (String *) x_fallback_resources); |
2681 | 2699 |
2682 /* In xselect.c */ | 2700 /* In xselect.c */ |
2683 x_selection_timeout = (XtAppGetSelectionTimeout (Xt_app_con) / 1000); | 2701 x_selection_timeout = (XtAppGetSelectionTimeout (Xt_app_con) / 1000); |
2684 XSetErrorHandler (x_error_handler); | 2702 XSetErrorHandler (x_error_handler); |
2685 XSetIOErrorHandler (x_IO_error_handler); | 2703 XSetIOErrorHandler (x_IO_error_handler); |
2686 | 2704 |
2699 XtAppSetTypeConverter (Xt_app_con, XtRString, XtRXimStyles, | 2717 XtAppSetTypeConverter (Xt_app_con, XtRString, XtRXimStyles, |
2700 EmacsXtCvtStringToXIMStyles, | 2718 EmacsXtCvtStringToXIMStyles, |
2701 NULL, 0, | 2719 NULL, 0, |
2702 XtCacheByDisplay, EmacsFreeXIMStyles); | 2720 XtCacheByDisplay, EmacsFreeXIMStyles); |
2703 #endif /* XIM_XLIB */ | 2721 #endif /* XIM_XLIB */ |
2704 | 2722 |
2705 } | 2723 } |