comparison lisp/prim/frame.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents 0d2f883870bc
children 9f59509498e1
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
530 (defun frame-type (&optional frame) 530 (defun frame-type (&optional frame)
531 "Return the type of the specified frame (e.g. `x' or `tty'). 531 "Return the type of the specified frame (e.g. `x' or `tty').
532 This is equivalent to the type of the frame's device. 532 This is equivalent to the type of the frame's device.
533 Value is `tty' for a tty frame (a character-only terminal), 533 Value is `tty' for a tty frame (a character-only terminal),
534 `x' for a frame that is an X window, 534 `x' for a frame that is an X window,
535 `ns' for a frame that is a NeXTstep window (not yet implemeted), 535 `ns' for a frame that is a NeXTstep window (not yet implemented),
536 `win32' for a frame that is a Windows or Windows NT window (not yet 536 `win32' for a frame that is a Windows or Windows NT window (not yet
537 implemented), 537 implemented),
538 `pc' for a frame that is a direct-write MS-DOS frame (not yet implemented), 538 `pc' for a frame that is a direct-write MS-DOS frame (not yet implemented),
539 `stream' for a stream frame (which acts like a stdio stream), and 539 `stream' for a stream frame (which acts like a stdio stream), and
540 `dead' for a deleted frame." 540 `dead' for a deleted frame."
739 (setq iconification-data (cdr iconification-data)))) 739 (setq iconification-data (cdr iconification-data))))
740 740
741 (defun suspend-or-iconify-emacs () 741 (defun suspend-or-iconify-emacs ()
742 "Calls iconify-emacs if frame is an X frame, otherwise calls suspend-emacs" 742 "Calls iconify-emacs if frame is an X frame, otherwise calls suspend-emacs"
743 (interactive) 743 (interactive)
744 (if (eq (frame-type (selected-frame)) 'x) 744 (cond
745 (iconify-emacs) 745 ((eq (frame-type (selected-frame)) 'x) (iconify-emacs))
746 (suspend-emacs))) 746 ((and (eq (frame-type (selected-frame)) 'tty)
747 (console-tty-controlling-process (selected-console)))
748 (suspend-console (selected-console)))
749 (t
750 (suspend-emacs))))
747 751
748 752
749 ;;; auto-raise and auto-lower 753 ;;; auto-raise and auto-lower
750 754
751 (defvar auto-raise-frame nil 755 (defvar auto-raise-frame nil
858 (matching-frames '()) 862 (matching-frames '())
859 frames frame already-visible) 863 frames frame already-visible)
860 ;; Sort the list so that iconic frames will be found last. They 864 ;; Sort the list so that iconic frames will be found last. They
861 ;; will be used too, but mapped frames take precedence. And 865 ;; will be used too, but mapped frames take precedence. And
862 ;; fully visible frames come before occluded frames. 866 ;; fully visible frames come before occluded frames.
867 ;; Hidden frames come after really visible ones
863 (setq frames 868 (setq frames
864 (sort (frame-list) 869 (sort (frame-list)
865 #'(lambda (s1 s2) 870 #'(lambda (s1 s2)
866 (cond ((frame-totally-visible-p s2) 871 (cond ((frame-totally-visible-p s2)
867 nil) 872 nil)
868 ((not (frame-visible-p s2)) 873 ((not (frame-visible-p s2))
869 (frame-visible-p s1)) 874 (frame-visible-p s1))
875 ((eq (frame-visible-p s2) 'hidden)
876 (eq (frame-visible-p s1) t ))
870 ((not (frame-totally-visible-p s2)) 877 ((not (frame-totally-visible-p s2))
871 (and (frame-visible-p s1) 878 (and (frame-visible-p s1)
872 (frame-totally-visible-p s1))))))) 879 (frame-totally-visible-p s1)))))))
873 ;; but the selected frame should come first, even if it's occluded, 880 ;; but the selected frame should come first, even if it's occluded,
874 ;; to minimize thrashing. 881 ;; to minimize thrashing.
912 (or (frame-visible-p x) 919 (or (frame-visible-p x)
913 (frame-iconified-p x)))) 920 (frame-iconified-p x))))
914 #'(lambda (s1 s2) 921 #'(lambda (s1 s2)
915 (cond ((and (frame-visible-p s1) 922 (cond ((and (frame-visible-p s1)
916 (not (frame-visible-p s2)))) 923 (not (frame-visible-p s2))))
924 ((and (eq (frame-visible-p s1) t)
925 (eq (frame-visible-p s2) 'hidden)))
917 ((and (frame-visible-p s2) 926 ((and (frame-visible-p s2)
918 (not (frame-visible-p s1))) 927 (not (frame-visible-p s1)))
919 nil) 928 nil)
920 ((and (equal (frame-name s1) defname) 929 ((and (equal (frame-name s1) defname)
921 (not (equal (frame-name s2) defname)))) 930 (not (equal (frame-name s2) defname))))
1012 nil 1021 nil
1013 (if (eq cur-frame next-frame) 1022 (if (eq cur-frame next-frame)
1014 (setq save-frame next-frame) 1023 (setq save-frame next-frame)
1015 (and 1024 (and
1016 (or (not visible-only) 1025 (or (not visible-only)
1017 (eq t (frame-visible-p next-frame))) 1026 (frame-visible-p next-frame))
1018 (setq frames (append frames (list next-frame)))))) 1027 (setq frames (append frames (list next-frame))))))
1019 (setq list (cdr list))) 1028 (setq list (cdr list)))
1020 1029
1021 (if save-frame 1030 (if save-frame
1022 (append (list save-frame) frames) 1031 (append (list save-frame) frames)