comparison lisp/prim/frame.el @ 30:ec9a17fef872 r19-15b98

Import from CVS: tag r19-15b98
author cvs
date Mon, 13 Aug 2007 08:52:29 +0200
parents 8fc7fe29b841
children 8d2a9b52c682
comparison
equal deleted inserted replaced
29:7976500f47f9 30:ec9a17fef872
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
846 (matching-frames '()) 850 (matching-frames '())
847 frames frame already-visible) 851 frames frame already-visible)
848 ;; Sort the list so that iconic frames will be found last. They 852 ;; Sort the list so that iconic frames will be found last. They
849 ;; will be used too, but mapped frames take precedence. And 853 ;; will be used too, but mapped frames take precedence. And
850 ;; fully visible frames come before occluded frames. 854 ;; fully visible frames come before occluded frames.
855 ;; Hidden frames come after really visible ones
851 (setq frames 856 (setq frames
852 (sort (frame-list) 857 (sort (frame-list)
853 #'(lambda (s1 s2) 858 #'(lambda (s1 s2)
854 (cond ((frame-totally-visible-p s2) 859 (cond ((frame-totally-visible-p s2)
855 nil) 860 nil)
856 ((not (frame-visible-p s2)) 861 ((not (frame-visible-p s2))
857 (frame-visible-p s1)) 862 (frame-visible-p s1))
863 ((eq (frame-visible-p s2) 'hidden)
864 (eq (frame-visible-p s1) t ))
858 ((not (frame-totally-visible-p s2)) 865 ((not (frame-totally-visible-p s2))
859 (and (frame-visible-p s1) 866 (and (frame-visible-p s1)
860 (frame-totally-visible-p s1))))))) 867 (frame-totally-visible-p s1)))))))
861 ;; but the selected frame should come first, even if it's occluded, 868 ;; but the selected frame should come first, even if it's occluded,
862 ;; to minimize thrashing. 869 ;; to minimize thrashing.
900 (or (frame-visible-p x) 907 (or (frame-visible-p x)
901 (frame-iconified-p x)))) 908 (frame-iconified-p x))))
902 #'(lambda (s1 s2) 909 #'(lambda (s1 s2)
903 (cond ((and (frame-visible-p s1) 910 (cond ((and (frame-visible-p s1)
904 (not (frame-visible-p s2)))) 911 (not (frame-visible-p s2))))
912 ((and (eq (frame-visible-p s1) t)
913 (eq (frame-visible-p s2) 'hidden)))
905 ((and (frame-visible-p s2) 914 ((and (frame-visible-p s2)
906 (not (frame-visible-p s1))) 915 (not (frame-visible-p s1)))
907 nil) 916 nil)
908 ((and (equal (frame-name s1) defname) 917 ((and (equal (frame-name s1) defname)
909 (not (equal (frame-name s2) defname)))) 918 (not (equal (frame-name s2) defname))))
1000 nil 1009 nil
1001 (if (eq cur-frame next-frame) 1010 (if (eq cur-frame next-frame)
1002 (setq save-frame next-frame) 1011 (setq save-frame next-frame)
1003 (and 1012 (and
1004 (or (not visible-only) 1013 (or (not visible-only)
1005 (eq t (frame-visible-p next-frame))) 1014 (frame-visible-p next-frame))
1006 (setq frames (append frames (list next-frame)))))) 1015 (setq frames (append frames (list next-frame))))))
1007 (setq list (cdr list))) 1016 (setq list (cdr list)))
1008 1017
1009 (if save-frame 1018 (if save-frame
1010 (append (list save-frame) frames) 1019 (append (list save-frame) frames)