Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 56c54cf7c5b6 |
children | 54cc21c15cbb |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
45 | 45 |
46 #include "xintrinsicp.h" /* CoreP.h needs this */ | 46 #include "xintrinsicp.h" /* CoreP.h needs this */ |
47 #include <X11/CoreP.h> /* Numerous places access the fields of | 47 #include <X11/CoreP.h> /* Numerous places access the fields of |
48 a core widget directly. We could | 48 a core widget directly. We could |
49 use XtVaGetValues(), but ... */ | 49 use XtVaGetValues(), but ... */ |
50 #ifdef HAVE_XIM | |
51 #ifdef XIM_MOTIF | |
52 #include <Xm/Xm.h> | |
53 #endif | |
54 #include "lstream.h" | |
55 #include "mule-coding.h" | |
56 #endif | |
50 | 57 |
51 static void enqueue_Xt_dispatch_event (Lisp_Object event); | 58 static void enqueue_Xt_dispatch_event (Lisp_Object event); |
52 | 59 |
53 static struct event_stream *Xt_event_stream; | 60 static struct event_stream *Xt_event_stream; |
54 | 61 |
530 clear_sticky_modifiers (struct device *d) | 537 clear_sticky_modifiers (struct device *d) |
531 { | 538 { |
532 struct x_device *xd = DEVICE_X_DATA (d); | 539 struct x_device *xd = DEVICE_X_DATA (d); |
533 | 540 |
534 xd->need_to_add_mask = 0; | 541 xd->need_to_add_mask = 0; |
535 xd->last_downkey = 0; | 542 xd->last_downkey = 0; |
536 xd->release_time = 0; | 543 xd->release_time = 0; |
537 xd->down_mask = 0; | 544 xd->down_mask = 0; |
538 } | 545 } |
539 | 546 |
540 static int | 547 static int |
541 keysym_obeys_caps_lock_p (KeySym sym, struct device *d) | 548 keysym_obeys_caps_lock_p (KeySym sym, struct device *d) |
542 { | 549 { |
590 | 597 |
591 /************************************************************************/ | 598 /************************************************************************/ |
592 /* X to Emacs event conversion */ | 599 /* X to Emacs event conversion */ |
593 /************************************************************************/ | 600 /************************************************************************/ |
594 | 601 |
602 #if (defined(sun) || defined(__sun)) && defined(__GNUC__) | |
603 # define SUNOS_GCC_L0_BUG | |
604 #endif | |
605 | |
606 #ifdef SUNOS_GCC_L0_BUG | |
607 static void | |
608 x_to_emacs_keysym_sunos_bug (Lisp_Object *return_value_sunos_bug, /* #### */ | |
609 XKeyPressedEvent *event, int simple_p) | |
610 #else /* !SUNOS_GCC_L0_BUG */ | |
595 static Lisp_Object | 611 static Lisp_Object |
596 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) | 612 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) |
613 #endif /* !SUNOS_GCC_L0_BUG */ | |
597 /* simple_p means don't try too hard (ASCII only) */ | 614 /* simple_p means don't try too hard (ASCII only) */ |
598 { | 615 { |
599 char *name; | 616 char *name; |
600 KeySym keysym = 0; | 617 KeySym keysym = 0; |
601 /* Apparently it's necessary to specify a dummy here (rather than | 618 /* Apparently it's necessary to specify a dummy here (rather than |
602 passing in 0) to avoid crashes on German IRIX */ | 619 passing in 0) to avoid crashes on German IRIX */ |
603 char dummy[256]; | 620 char dummy[256]; |
604 | 621 |
605 /* ### FIX this by replacing with calls to XmbLookupString. | 622 #ifdef HAVE_XIM |
606 XLookupString should never be called. --mrb */ | 623 int len; |
624 char buffer[64]; | |
625 char *bufptr = buffer; | |
626 int bufsiz = sizeof (buffer); | |
627 Status status; | |
628 #endif | |
629 | |
630 #ifdef SUNOS_GCC_L0_BUG | |
631 # define return(lose) \ | |
632 do {*return_value_sunos_bug = (lose); goto return_it; } while (0) | |
633 #endif | |
634 | |
635 #ifdef HAVE_XIM | |
636 #ifdef XIM_MOTIF | |
637 #define LOOKUPSTRING \ | |
638 len = XmImMbLookupString (XtWindowToWidget (event->display, event->window), \ | |
639 event, bufptr, bufsiz, &keysym, &status); | |
640 #else /* XIM_XLIB */ | |
641 #define LOOKUPSTRING \ | |
642 len = XmbLookupString \ | |
643 (FRAME_X_XIC (x_window_to_frame \ | |
644 (get_device_from_display (event->display), event->window)), \ | |
645 event, bufptr, bufsiz, &keysym, &status); | |
646 #endif /* XIM_XLIB */ | |
647 LOOKUPSTRING; | |
648 check_status: | |
649 | |
650 #ifdef DEBUG_XEMACS | |
651 if (x_debug_events > 0) | |
652 { | |
653 stderr_out (" status="); | |
654 #define print_status_when(S) if (status == S) stderr_out (#S) | |
655 print_status_when (XLookupKeySym); | |
656 print_status_when (XLookupBoth); | |
657 print_status_when (XLookupChars); | |
658 print_status_when (XLookupNone); | |
659 print_status_when (XBufferOverflow); | |
660 | |
661 if (status == XLookupKeySym || status == XLookupBoth) | |
662 stderr_out (" keysym=%s", XKeysymToString (keysym)); | |
663 if (status == XLookupChars || status == XLookupBoth) | |
664 { | |
665 if (len != 1) | |
666 { | |
667 int j; | |
668 stderr_out (" chars=\""); | |
669 for (j=0; j<len; j++) | |
670 stderr_out ("%c", bufptr[j]); | |
671 stderr_out ("\""); | |
672 } | |
673 else if (bufptr[0] <= 32 || bufptr[0] >= 127) | |
674 stderr_out (" char=0x%x", bufptr[0]); | |
675 else | |
676 stderr_out (" char=%c", bufptr[0]); | |
677 } | |
678 stderr_out ("\n"); | |
679 } | |
680 #endif /* DEBUG_XEMACS */ | |
681 | |
682 switch (status) | |
683 { | |
684 case XLookupKeySym: | |
685 case XLookupBoth: break; | |
686 | |
687 case XLookupChars: | |
688 { | |
689 /* Generate multiple emacs events */ | |
690 struct device *d = get_device_from_display (event->display); | |
691 Emchar ch; | |
692 Lisp_Object instream = | |
693 make_fixed_buffer_input_stream ((unsigned char *) bufptr, len); | |
694 | |
695 /* ### Use Fget_coding_system (Vcomposed_input_coding_system) */ | |
696 instream = | |
697 make_decoding_input_stream (XLSTREAM (instream), | |
698 Fget_coding_system (Qautodetect)); | |
699 | |
700 while ((ch = Lstream_get_emchar (XLSTREAM (instream))) != EOF) | |
701 { | |
702 Lisp_Object emacs_event = Fmake_event (); | |
703 XEVENT (emacs_event)->channel = DEVICE_CONSOLE (d); | |
704 XEVENT (emacs_event)->event_type = key_press_event; | |
705 XEVENT (emacs_event)->timestamp = event->time; | |
706 XEVENT (emacs_event)->event.key.modifiers = 0; | |
707 XEVENT (emacs_event)->event.key.keysym = make_char (ch); | |
708 enqueue_Xt_dispatch_event (emacs_event); | |
709 } | |
710 Lstream_close (XLSTREAM (instream)); | |
711 return Qnil; | |
712 } | |
713 case XLookupNone: return Qnil; | |
714 case XBufferOverflow: | |
715 bufptr = alloca (len+1); | |
716 bufsiz = len+1; | |
717 LOOKUPSTRING; | |
718 goto check_status; | |
719 } | |
720 #else /* ! HAVE_XIM */ | |
607 XLookupString (event, dummy, 200, &keysym, 0); | 721 XLookupString (event, dummy, 200, &keysym, 0); |
722 #endif /* HAVE_XIM */ | |
608 | 723 |
609 if (keysym >= XK_exclam && keysym <= XK_asciitilde) | 724 if (keysym >= XK_exclam && keysym <= XK_asciitilde) |
610 /* We must assume that the X keysym numbers for the ASCII graphic | 725 /* We must assume that the X keysym numbers for the ASCII graphic |
611 characters are the same as their ASCII codes. */ | 726 characters are the same as their ASCII codes. */ |
612 return make_char (keysym); | 727 return (make_char (keysym)); |
613 | 728 |
614 switch (keysym) | 729 switch (keysym) |
615 { | 730 { |
616 /* These would be handled correctly by the default case, but by | 731 /* These would be handled correctly by the default case, but by |
617 special-casing them here we don't garbage a string or call intern(). | 732 special-casing them here we don't garbage a string or call intern(). |
618 */ | 733 */ |
619 case XK_BackSpace: return QKbackspace; | 734 case XK_BackSpace: return (QKbackspace); |
620 case XK_Tab: return QKtab; | 735 case XK_Tab: return (QKtab); |
621 case XK_Linefeed: return QKlinefeed; | 736 case XK_Linefeed: return (QKlinefeed); |
622 case XK_Return: return QKreturn; | 737 case XK_Return: return (QKreturn); |
623 case XK_Escape: return QKescape; | 738 case XK_Escape: return (QKescape); |
624 case XK_space: return QKspace; | 739 case XK_space: return (QKspace); |
625 case XK_Delete: return QKdelete; | 740 case XK_Delete: return (QKdelete); |
626 case 0: return Qnil; | 741 case 0: return (Qnil); |
627 /* This kludge prevents bogus Xlib compose conversions. | |
628 Don't ask why. The following case must be removed when we | |
629 switch to using XmbLookupString */ | |
630 case XK_Multi_key: XLookupString (event, dummy, 200, &keysym, 0); | |
631 /* Fallthrough!! */ | |
632 default: | 742 default: |
633 if (simple_p) return Qnil; | 743 if (simple_p) return (Qnil); |
634 /* #### without return_value_sunos_bug, %l0 (GCC struct return pointer) | 744 /* #### without return_value_sunos_bug, %l0 (GCC struct return pointer) |
635 * #### gets roached (top 8 bits cleared) around this call. | 745 * #### gets roached (top 8 bits cleared) around this call. |
636 */ | 746 */ |
637 /* !!#### not Mule-ized */ | 747 /* !!#### not Mule-ized */ |
638 name = XKeysymToString (keysym); | 748 name = XKeysymToString (keysym); |
639 if (!name || !name[0]) /* this shouldn't happen... */ | 749 if (!name || !name[0]) /* this shouldn't happen... */ |
640 { | 750 { |
641 char buf [255]; | 751 char buf [255]; |
642 sprintf (buf, "unknown_keysym_0x%X", (int) keysym); | 752 sprintf (buf, "unknown_keysym_0x%X", (int) keysym); |
643 return KEYSYM (buf); | 753 return (KEYSYM (buf)); |
644 } | 754 } |
645 /* If it's got a one-character name, that's good enough. */ | 755 /* If it's got a one-character name, that's good enough. */ |
646 if (!name[1]) | 756 if (!name[1]) return (make_char (name[0])); |
647 return make_char (name[0]); | |
648 | 757 |
649 /* If it's in the "Keyboard" character set, downcase it. | 758 /* If it's in the "Keyboard" character set, downcase it. |
650 The case of those keysyms is too totally random for us to | 759 The case of those keysyms is too totally random for us to |
651 force anyone to remember them. | 760 force anyone to remember them. |
652 The case of the other character sets is significant, however. | 761 The case of the other character sets is significant, however. |
653 */ | 762 */ |
654 if ((((unsigned int) keysym) & (~0x1FF)) == ((unsigned int) 0xFE00)) | 763 if ((((unsigned int) keysym) & (~0xFF)) == ((unsigned int) 0xFF00)) |
655 { | 764 { |
656 char buf [255]; | 765 char buf [255]; |
657 char *s1, *s2; | 766 char *s1, *s2; |
658 for (s1 = name, s2 = buf; *s1; s1++, s2++) { | 767 for (s1 = name, s2 = buf; *s1; s1++, s2++) |
659 if (*s1 == '_') { | 768 *s2 = tolower (* (unsigned char *) s1); |
660 *s2 = '-'; | |
661 } else { | |
662 *s2 = tolower (* (unsigned char *) s1); | |
663 } | |
664 } | |
665 *s2 = 0; | 769 *s2 = 0; |
666 return KEYSYM (buf); | 770 return (KEYSYM (buf)); |
667 } | 771 } |
668 return KEYSYM (name); | 772 return (KEYSYM (name)); |
669 } | 773 } |
670 } | 774 #ifdef SUNOS_GCC_L0_BUG |
775 # undef return | |
776 return_it: | |
777 return; | |
778 #endif | |
779 } | |
780 | |
781 #ifdef SUNOS_GCC_L0_BUG | |
782 /* #### */ | |
783 static Lisp_Object | |
784 x_to_emacs_keysym (XKeyPressedEvent *event, int simple_p) | |
785 { | |
786 Lisp_Object return_value_sunos_bug; | |
787 x_to_emacs_keysym_sunos_bug (&return_value_sunos_bug, event, simple_p); | |
788 return (return_value_sunos_bug); | |
789 } | |
790 #endif | |
671 | 791 |
672 static void | 792 static void |
673 set_last_server_timestamp (struct device *d, XEvent *x_event) | 793 set_last_server_timestamp (struct device *d, XEvent *x_event) |
674 { | 794 { |
675 Time t; | 795 Time t; |
746 /* Ignore the Caps_Lock key if: | 866 /* Ignore the Caps_Lock key if: |
747 - any other modifiers are down, so that Caps_Lock doesn't | 867 - any other modifiers are down, so that Caps_Lock doesn't |
748 turn C-x into C-X, which would suck. | 868 turn C-x into C-X, which would suck. |
749 - the event was a mouse event. */ | 869 - the event was a mouse event. */ |
750 if (modifiers || ! key_event_p) | 870 if (modifiers || ! key_event_p) |
751 *state &= (~LockMask); | 871 *state &= (~LockMask); |
752 | 872 |
753 shift_p = *state & ShiftMask; | 873 shift_p = *state & ShiftMask; |
754 lock_p = *state & LockMask; | 874 lock_p = *state & LockMask; |
755 | 875 |
756 if (shift_p || lock_p) | 876 if (shift_p || lock_p) |
767 | 887 |
768 /* This used to compute the frame from the given X window and | 888 /* This used to compute the frame from the given X window and |
769 store it here, but we really don't care about the frame. */ | 889 store it here, but we really don't care about the frame. */ |
770 emacs_event->channel = DEVICE_CONSOLE (d); | 890 emacs_event->channel = DEVICE_CONSOLE (d); |
771 keysym = x_to_emacs_keysym (&x_event->xkey, 0); | 891 keysym = x_to_emacs_keysym (&x_event->xkey, 0); |
772 | 892 |
773 /* If the emacs keysym is nil, then that means that the | 893 /* If the emacs keysym is nil, then that means that the |
774 X keysym was NoSymbol, which probably means that | 894 X keysym was NoSymbol, which probably means that |
775 we're in the midst of reading a Multi_key sequence, | 895 we're in the midst of reading a Multi_key sequence, |
776 or a "dead" key prefix. Ignore it. */ | 896 or a "dead" key prefix. Ignore it. */ |
777 if (NILP (keysym)) | 897 if (NILP (keysym)) |
820 XButtonEvent *ev = &x_event->xbutton; | 940 XButtonEvent *ev = &x_event->xbutton; |
821 struct frame *frame = x_window_to_frame (d, ev->window); | 941 struct frame *frame = x_window_to_frame (d, ev->window); |
822 if (! frame) | 942 if (! frame) |
823 return 0; /* not for us */ | 943 return 0; /* not for us */ |
824 XSETFRAME (emacs_event->channel, frame); | 944 XSETFRAME (emacs_event->channel, frame); |
825 | 945 |
826 emacs_event->event_type = (x_event->type == ButtonPress) ? | 946 emacs_event->event_type = (x_event->type == ButtonPress) ? |
827 button_press_event : button_release_event; | 947 button_press_event : button_release_event; |
828 | 948 |
829 emacs_event->event.button.modifiers = modifiers; | 949 emacs_event->event.button.modifiers = modifiers; |
830 emacs_event->timestamp = ev->time; | 950 emacs_event->timestamp = ev->time; |
831 emacs_event->event.button.button = ev->button; | 951 emacs_event->event.button.button = ev->button; |
832 emacs_event->event.button.x = ev->x; | 952 emacs_event->event.button.x = ev->x; |
833 emacs_event->event.button.y = ev->y; | 953 emacs_event->event.button.y = ev->y; |
834 } | 954 } |
835 } | 955 } |
836 break; | 956 break; |
837 | 957 |
838 case MotionNotify: | 958 case MotionNotify: |
839 { | 959 { |
934 } | 1054 } |
935 } | 1055 } |
936 return 1; | 1056 return 1; |
937 } | 1057 } |
938 | 1058 |
1059 | |
939 | 1060 |
940 /************************************************************************/ | 1061 /************************************************************************/ |
941 /* magic-event handling */ | 1062 /* magic-event handling */ |
942 /************************************************************************/ | 1063 /************************************************************************/ |
943 | 1064 |
944 static void | 1065 static void |
945 handle_focus_event_1 (struct frame *f, int in_p) | 1066 handle_focus_event_1 (struct frame *f, int in_p) |
946 { | 1067 { |
1068 #ifdef HAVE_XIM | |
1069 XIM_focus_event (f, in_p); | |
1070 #endif /* HAVE_XIM */ | |
1071 | |
947 /* On focus change, clear all memory of sticky modifiers | 1072 /* On focus change, clear all memory of sticky modifiers |
948 to avoid non-intuitive behavior. */ | 1073 to avoid non-intuitive behavior. */ |
949 clear_sticky_modifiers (XDEVICE (FRAME_DEVICE (f))); | 1074 clear_sticky_modifiers (XDEVICE (FRAME_DEVICE (f))); |
950 | 1075 |
951 /* We don't want to handle the focus change now, because we might | 1076 /* We don't want to handle the focus change now, because we might |
990 a frame is destroyed. */ | 1115 a frame is destroyed. */ |
991 return; | 1116 return; |
992 handle_focus_event_1 (f, event->type == FocusIn); | 1117 handle_focus_event_1 (f, event->type == FocusIn); |
993 } | 1118 } |
994 | 1119 |
995 /* both MapNotify and VisibilityNotify can cause this | |
996 JV is_visible has the same semantics as f->visible*/ | |
997 static void | |
998 change_frame_visibility (struct frame *f, int is_visible) | |
999 { | |
1000 Lisp_Object frame = Qnil; | |
1001 | |
1002 XSETFRAME (frame, f); | |
1003 | |
1004 if (!FRAME_VISIBLE_P (f) && is_visible) | |
1005 { | |
1006 FRAME_VISIBLE_P (f) = is_visible; | |
1007 /* This improves the double flicker when uniconifying a frame | |
1008 some. A lot of it is not showing a buffer which has changed | |
1009 while the frame was iconified. To fix it further requires | |
1010 the good 'ol double redisplay structure. */ | |
1011 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); | |
1012 va_run_hook_with_args (Qmap_frame_hook, 1, frame); | |
1013 #ifdef EPOCH | |
1014 dispatch_epoch_event (f, event, Qx_map); | |
1015 #endif | |
1016 } | |
1017 else if (FRAME_VISIBLE_P (f) && !is_visible) | |
1018 { | |
1019 FRAME_VISIBLE_P (f) = 0; | |
1020 va_run_hook_with_args (Qunmap_frame_hook, 1, frame); | |
1021 #ifdef EPOCH | |
1022 dispatch_epoch_event (f, event, Qx_unmap); | |
1023 #endif | |
1024 } | |
1025 else if (FRAME_VISIBLE_P (f) * is_visible < 0) | |
1026 { | |
1027 FRAME_VISIBLE_P(f) = - FRAME_VISIBLE_P(f); | |
1028 if (FRAME_REPAINT_P(f)) | |
1029 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); | |
1030 va_run_hook_with_args (Qmap_frame_hook, 1, frame); | |
1031 #ifdef EPOCH | |
1032 dispatch_epoch_event (f, event, Qx_map); | |
1033 #endif | |
1034 } | |
1035 } | |
1036 | |
1037 static void | 1120 static void |
1038 handle_map_event (struct frame *f, XEvent *event) | 1121 handle_map_event (struct frame *f, XEvent *event) |
1039 { | 1122 { |
1040 Lisp_Object frame = Qnil; | 1123 Lisp_Object frame = Qnil; |
1041 | 1124 |
1088 Note that `frame-iconified-p' queries the server | 1171 Note that `frame-iconified-p' queries the server |
1089 to determine whether the frame is currently iconified, | 1172 to determine whether the frame is currently iconified, |
1090 rather than consulting some internal (and likely | 1173 rather than consulting some internal (and likely |
1091 inaccurate) state flag. Therefore, ignoring the MapNotify | 1174 inaccurate) state flag. Therefore, ignoring the MapNotify |
1092 is correct. */ | 1175 is correct. */ |
1093 if (!FRAME_VISIBLE_P (f) && NILP (Fframe_iconified_p (frame))) | 1176 if (!f->visible && NILP (Fframe_iconified_p (frame))) |
1094 #endif | 1177 #endif |
1095 change_frame_visibility (f, 1); | 1178 if (!f->visible) |
1179 { | |
1180 f->visible = 1; | |
1181 /* This improves the double flicker when uniconifying a frame | |
1182 some. A lot of it is not showing a buffer which has changed | |
1183 while the frame was iconified. To fix it further requires | |
1184 the good 'ol double redisplay structure. */ | |
1185 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); | |
1186 va_run_hook_with_args (Qmap_frame_hook, 1, frame); | |
1187 #ifdef EPOCH | |
1188 dispatch_epoch_event (f, event, Qx_map); | |
1189 #endif | |
1190 } | |
1096 } | 1191 } |
1097 else | 1192 else |
1098 { | 1193 { |
1099 FRAME_X_TOTALLY_VISIBLE_P (f) = 0; | 1194 FRAME_X_TOTALLY_VISIBLE_P (f) = 0; |
1100 change_frame_visibility (f, 0); | 1195 if (f->visible) |
1196 { | |
1197 f->visible = 0; | |
1198 va_run_hook_with_args (Qunmap_frame_hook, 1, frame); | |
1199 #ifdef EPOCH | |
1200 dispatch_epoch_event (f, event, Qx_unmap); | |
1201 #endif | |
1202 } | |
1203 | |
1101 /* Calling Fframe_iconified_p is the only way we have to | 1204 /* Calling Fframe_iconified_p is the only way we have to |
1102 correctly update FRAME_ICONIFIED_P */ | 1205 correctly update FRAME_ICONIFIED_P */ |
1103 Fframe_iconified_p (frame); | 1206 Fframe_iconified_p (frame); |
1104 } | 1207 } |
1105 } | 1208 } |
1121 have been sent as a result of mouse motion or some other implicit | 1224 have been sent as a result of mouse motion or some other implicit |
1122 action. (Call this a "heuristic"...) The reason for caring about | 1225 action. (Call this a "heuristic"...) The reason for caring about |
1123 this is so that clicking on the close-box will make emacs prompt | 1226 this is so that clicking on the close-box will make emacs prompt |
1124 using a dialog box instead of the minibuffer if there are unsaved | 1227 using a dialog box instead of the minibuffer if there are unsaved |
1125 buffers. | 1228 buffers. |
1126 */ | 1229 */ |
1127 enqueue_misc_user_event (frame, Qeval, | 1230 enqueue_misc_user_event (frame, Qeval, |
1128 list3 (Qdelete_frame, frame, Qt)); | 1231 list3 (Qdelete_frame, frame, Qt)); |
1129 } | 1232 } |
1130 else if (event->xclient.message_type == DEVICE_XATOM_WM_PROTOCOLS (d) && | 1233 else if (event->xclient.message_type == DEVICE_XATOM_WM_PROTOCOLS (d) && |
1131 event->xclient.data.l[0] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) | 1234 event->xclient.data.l[0] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) |
1241 case ClientMessage: | 1344 case ClientMessage: |
1242 handle_client_message (f, event); | 1345 handle_client_message (f, event); |
1243 break; | 1346 break; |
1244 | 1347 |
1245 case VisibilityNotify: /* window visiblity has changed */ | 1348 case VisibilityNotify: /* window visiblity has changed */ |
1246 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f))) | 1349 if (event->xvisibility.state == VisibilityUnobscured) |
1247 { | 1350 FRAME_X_TOTALLY_VISIBLE_P (f) = 1; |
1248 FRAME_X_TOTALLY_VISIBLE_P (f) = | 1351 else |
1249 (event->xvisibility.state == VisibilityUnobscured); | 1352 FRAME_X_TOTALLY_VISIBLE_P (f) = 0; |
1250 /* Note that the fvwm pager only sends VisibilityNotify when | |
1251 changing pages. Is this all we need to do ? JV */ | |
1252 /* Nope. We must at least trigger a redisplay here. | |
1253 Since this case seems similar to MapNotify, I've | |
1254 factored out some code to change_frame_visibility(). | |
1255 This triggers the necessary redisplay and runs | |
1256 (un)map-frame-hook. - dkindred@cs.cmu.edu */ | |
1257 /* Changed it again to support the tristate visibility flag */ | |
1258 change_frame_visibility (f, (event->xvisibility.state | |
1259 != VisibilityFullyObscured) ? 1 : -1); | |
1260 } | |
1261 break; | 1353 break; |
1262 | 1354 |
1263 case ConfigureNotify: | 1355 case ConfigureNotify: |
1264 #ifdef HAVE_XIM | 1356 #ifdef HAVE_XIM |
1265 XIM_SetGeometry (f); | 1357 XIM_SetGeometry (f); |
1266 #endif | 1358 #endif |
1359 #if 0 | |
1267 /* ### If the following code fails to work, simply always call | 1360 /* ### If the following code fails to work, simply always call |
1268 x_smash_bastardly_shell_position always. In this case we no | 1361 x_smash_bastardly_shell_position always. In this case we no |
1269 longer rely on the data in the events, merely on their | 1362 longer rely on the data in the events, merely on their |
1270 occurrence. */ | 1363 occurrence. */ |
1271 /* ### Well, actually we shouldn't have to ever call | 1364 /* ### Well, actually we shouldn't have to ever call |
1279 { | 1372 { |
1280 FRAME_X_SHELL_WIDGET (f)->core.x = ev->x; | 1373 FRAME_X_SHELL_WIDGET (f)->core.x = ev->x; |
1281 FRAME_X_SHELL_WIDGET (f)->core.y = ev->y; | 1374 FRAME_X_SHELL_WIDGET (f)->core.y = ev->y; |
1282 } | 1375 } |
1283 } | 1376 } |
1377 #endif | |
1284 break; | 1378 break; |
1285 | 1379 |
1286 default: | 1380 default: |
1287 break; | 1381 break; |
1288 } | 1382 } |
2519 timeout_id_tick = 1; | 2613 timeout_id_tick = 1; |
2520 pending_timeouts = 0; | 2614 pending_timeouts = 0; |
2521 completed_timeouts = 0; | 2615 completed_timeouts = 0; |
2522 | 2616 |
2523 event_stream = Xt_event_stream; | 2617 event_stream = Xt_event_stream; |
2618 | |
2619 #ifdef HAVE_XIM | |
2620 Initialize_Locale(); | |
2621 #endif /* HAVE_XIM */ | |
2622 | |
2524 XtToolkitInitialize (); | 2623 XtToolkitInitialize (); |
2525 Xt_app_con = XtCreateApplicationContext (); | 2624 Xt_app_con = XtCreateApplicationContext (); |
2526 XtAppSetFallbackResources (Xt_app_con, (String *) x_fallback_resources); | 2625 XtAppSetFallbackResources (Xt_app_con, (String *) x_fallback_resources); |
2527 | 2626 |
2528 /* In xselect.c */ | 2627 /* In xselect.c */ |
2536 | 2635 |
2537 XtAppSetTypeConverter (Xt_app_con, XtRString, XtRPixel, | 2636 XtAppSetTypeConverter (Xt_app_con, XtRString, XtRPixel, |
2538 EmacsXtCvtStringToPixel, | 2637 EmacsXtCvtStringToPixel, |
2539 (XtConvertArgList) colorConvertArgs, | 2638 (XtConvertArgList) colorConvertArgs, |
2540 2, XtCacheByDisplay, EmacsFreePixel); | 2639 2, XtCacheByDisplay, EmacsFreePixel); |
2541 } | 2640 |
2641 #ifdef XIM_XLIB | |
2642 XtAppSetTypeConverter (Xt_app_con, XtRString, XtRXimStyles, | |
2643 EmacsXtCvtStringToXIMStyles, | |
2644 NULL, 0, | |
2645 XtCacheByDisplay, EmacsFreeXIMStyles); | |
2646 #endif /* XIM_XLIB */ | |
2647 | |
2648 } |