Mercurial > emacs
comparison src/frame.c @ 12379:7149fc03ea56
(next_frame, prev_frame): Consider only frames on same kbd.
(Fdelete_frame): If next_frame finds nothing, try an alternative.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 25 Jun 1995 19:05:32 +0000 |
parents | 723569a0028c |
children | 2c09b3adbb90 |
comparison
equal
deleted
inserted
replaced
12378:3171d5da8a86 | 12379:7149fc03ea56 |
---|---|
682 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) | 682 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) |
683 { | 683 { |
684 Lisp_Object f; | 684 Lisp_Object f; |
685 | 685 |
686 f = XCONS (tail)->car; | 686 f = XCONS (tail)->car; |
687 if (passed) | 687 |
688 if (passed | |
689 && FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame))) | |
688 { | 690 { |
689 /* Decide whether this frame is eligible to be returned. */ | 691 /* Decide whether this frame is eligible to be returned. */ |
690 | 692 |
691 /* If we've looped all the way around without finding any | 693 /* If we've looped all the way around without finding any |
692 eligible frames, return the original frame. */ | 694 eligible frames, return the original frame. */ |
761 abort (); | 763 abort (); |
762 | 764 |
763 if (EQ (frame, f) && !NILP (prev)) | 765 if (EQ (frame, f) && !NILP (prev)) |
764 return prev; | 766 return prev; |
765 | 767 |
766 /* Decide whether this frame is eligible to be returned, | 768 if (FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame))) |
767 according to minibuf. */ | |
768 if (NILP (minibuf)) | |
769 { | 769 { |
770 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f))) | 770 /* Decide whether this frame is eligible to be returned, |
771 according to minibuf. */ | |
772 if (NILP (minibuf)) | |
773 { | |
774 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f))) | |
775 prev = f; | |
776 } | |
777 else if (WINDOWP (minibuf)) | |
778 { | |
779 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf) | |
780 /* Check that F either is, or has forwarded its focus to, | |
781 MINIBUF's frame. */ | |
782 && (EQ (WINDOW_FRAME (XWINDOW (minibuf)), f) | |
783 || EQ (WINDOW_FRAME (XWINDOW (minibuf)), | |
784 FRAME_FOCUS_FRAME (XFRAME (f))))) | |
785 prev = f; | |
786 } | |
787 else if (EQ (minibuf, Qvisible)) | |
788 { | |
789 FRAME_SAMPLE_VISIBILITY (XFRAME (f)); | |
790 if (FRAME_VISIBLE_P (XFRAME (f))) | |
791 prev = f; | |
792 } | |
793 else if (XFASTINT (minibuf) == 0) | |
794 { | |
795 FRAME_SAMPLE_VISIBILITY (XFRAME (f)); | |
796 if (FRAME_VISIBLE_P (XFRAME (f)) | |
797 || FRAME_ICONIFIED_P (XFRAME (f))) | |
798 prev = f; | |
799 } | |
800 else | |
771 prev = f; | 801 prev = f; |
772 } | 802 } |
773 else if (WINDOWP (minibuf)) | |
774 { | |
775 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf) | |
776 /* Check that F either is, or has forwarded its focus to, | |
777 MINIBUF's frame. */ | |
778 && (EQ (WINDOW_FRAME (XWINDOW (minibuf)), f) | |
779 || EQ (WINDOW_FRAME (XWINDOW (minibuf)), | |
780 FRAME_FOCUS_FRAME (XFRAME (f))))) | |
781 prev = f; | |
782 } | |
783 else if (EQ (minibuf, Qvisible)) | |
784 { | |
785 FRAME_SAMPLE_VISIBILITY (XFRAME (f)); | |
786 if (FRAME_VISIBLE_P (XFRAME (f))) | |
787 prev = f; | |
788 } | |
789 else if (XFASTINT (minibuf) == 0) | |
790 { | |
791 FRAME_SAMPLE_VISIBILITY (XFRAME (f)); | |
792 if (FRAME_VISIBLE_P (XFRAME (f)) | |
793 || FRAME_ICONIFIED_P (XFRAME (f))) | |
794 prev = f; | |
795 } | |
796 else | |
797 prev = f; | |
798 } | 803 } |
799 | 804 |
800 /* We've scanned the entire list. */ | 805 /* We've scanned the entire list. */ |
801 if (NILP (prev)) | 806 if (NILP (prev)) |
802 /* We went through the whole frame list without finding a single | 807 /* We went through the whole frame list without finding a single |
810 } | 815 } |
811 | 816 |
812 | 817 |
813 DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, | 818 DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, |
814 "Return the next frame in the frame list after FRAME.\n\ | 819 "Return the next frame in the frame list after FRAME.\n\ |
820 It considers only frames on the same terminal as FRAME.\n\ | |
815 By default, skip minibuffer-only frames.\n\ | 821 By default, skip minibuffer-only frames.\n\ |
816 If omitted, FRAME defaults to the selected frame.\n\ | 822 If omitted, FRAME defaults to the selected frame.\n\ |
817 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\ | 823 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\ |
818 If MINIBUF is a window, include only its own frame\n\ | 824 If MINIFRAME is a window, include only its own frame\n\ |
819 and any frame now using that window as the minibuffer.\n\ | 825 and any frame now using that window as the minibuffer.\n\ |
820 If MINIFRAME is `visible', include all visible frames.\n\ | 826 If MINIFRAME is `visible', include all visible frames.\n\ |
821 If MINIBUF is 0, include all visible and iconified frames.\n\ | 827 If MINIFRAME is 0, include all visible and iconified frames.\n\ |
822 Otherwise, include all frames.") | 828 Otherwise, include all frames.") |
823 (frame, miniframe) | 829 (frame, miniframe) |
824 Lisp_Object frame, miniframe; | 830 Lisp_Object frame, miniframe; |
825 { | 831 { |
826 Lisp_Object tail; | 832 Lisp_Object tail; |
833 return next_frame (frame, miniframe); | 839 return next_frame (frame, miniframe); |
834 } | 840 } |
835 | 841 |
836 DEFUN ("previous-frame", Fprevious_frame, Sprevious_frame, 0, 2, 0, | 842 DEFUN ("previous-frame", Fprevious_frame, Sprevious_frame, 0, 2, 0, |
837 "Return the previous frame in the frame list before FRAME.\n\ | 843 "Return the previous frame in the frame list before FRAME.\n\ |
844 It considers only frames on the same terminal as FRAME.\n\ | |
838 By default, skip minibuffer-only frames.\n\ | 845 By default, skip minibuffer-only frames.\n\ |
839 If omitted, FRAME defaults to the selected frame.\n\ | 846 If omitted, FRAME defaults to the selected frame.\n\ |
840 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\ | 847 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\ |
841 If MINIBUF is a window, include only its own frame\n\ | 848 If MINIFRAME is a window, include only its own frame\n\ |
842 and any frame now using that window as the minibuffer.\n\ | 849 and any frame now using that window as the minibuffer.\n\ |
843 If MINIFRAME is `visible', include all visible frames.\n\ | 850 If MINIFRAME is `visible', include all visible frames.\n\ |
844 If MINIBUF is 0, include all visible and iconified frames.\n\ | 851 If MINIFRAME is 0, include all visible and iconified frames.\n\ |
845 Otherwise, include all frames.") | 852 Otherwise, include all frames.") |
846 (frame, miniframe) | 853 (frame, miniframe) |
847 Lisp_Object frame, miniframe; | 854 Lisp_Object frame, miniframe; |
848 { | 855 { |
849 Lisp_Object tail; | 856 Lisp_Object tail; |
953 | 960 |
954 minibuffer_selected = EQ (minibuf_window, selected_window); | 961 minibuffer_selected = EQ (minibuf_window, selected_window); |
955 | 962 |
956 /* Don't let the frame remain selected. */ | 963 /* Don't let the frame remain selected. */ |
957 if (f == selected_frame) | 964 if (f == selected_frame) |
958 do_switch_frame (next_frame (frame, Qt), Qnil, 0); | 965 { |
966 Lisp_Object tail, frame1; | |
967 | |
968 /* Look for another visible frame on the same terminal. */ | |
969 frame1 = next_frame (frame, Qvisible); | |
970 | |
971 /* If there is none, find *some* other frame. */ | |
972 if (NILP (frame1) || EQ (frame1, frame)) | |
973 { | |
974 FOR_EACH_FRAME (tail, frame1) | |
975 { | |
976 if (! EQ (frame, frame1)) | |
977 break; | |
978 } | |
979 } | |
980 | |
981 do_switch_frame (frame1, Qnil, 0); | |
982 } | |
959 | 983 |
960 /* Don't allow minibuf_window to remain on a deleted frame. */ | 984 /* Don't allow minibuf_window to remain on a deleted frame. */ |
961 if (EQ (f->minibuffer_window, minibuf_window)) | 985 if (EQ (f->minibuffer_window, minibuf_window)) |
962 { | 986 { |
963 Fset_window_buffer (selected_frame->minibuffer_window, | 987 Fset_window_buffer (selected_frame->minibuffer_window, |