diff options
| author | Eli Zaretskii | 2000-02-02 11:35:43 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-02-02 11:35:43 +0000 |
| commit | 9911648b580ac2eb226b1fb6e0ef83642da342dc (patch) | |
| tree | 7aaf85d32e5710331c1a7957ffd0cb29ca9a3a85 | |
| parent | 26b09289edeee16d2f20450bdf77dfa111ba9183 (diff) | |
| download | emacs-9911648b580ac2eb226b1fb6e0ef83642da342dc.tar.gz emacs-9911648b580ac2eb226b1fb6e0ef83642da342dc.zip | |
(frames-on-display-list, framep-on-display): New functions.
(display-mouse-p, display-popup-menus-p, display-graphic-p)
(display-selections-p, display-screens, display-pixel-width)
(display-pixel-height, display-mm-width, display-mm-height)
(display-backing-store, display-save-under, display-planes)
(display-color-cells, display-visual-class): New functions.
| -rw-r--r-- | lisp/frame.el | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index d6bc880a85e..a9d4121949b 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -508,6 +508,27 @@ on `after-make-frame-functions' are run with one arg, the newly created frame." | |||
| 508 | (function (lambda (frame) | 508 | (function (lambda (frame) |
| 509 | (eq frame (window-frame (minibuffer-window frame))))))) | 509 | (eq frame (window-frame (minibuffer-window frame))))))) |
| 510 | 510 | ||
| 511 | (defun frames-on-display-list (&optional display) | ||
| 512 | "Return a list of all frames on DISPLAY. | ||
| 513 | DISPLAY is a name of a display, a string of the form HOST:SERVER.SCREEN. | ||
| 514 | If DISPLAY is omitted or nil, it defaults to the selected frame's display." | ||
| 515 | (let* ((display (or display | ||
| 516 | (cdr (assoc 'display (frame-parameters))))) | ||
| 517 | (func | ||
| 518 | (function (lambda (frame) | ||
| 519 | (eq (cdr (assoc 'display (frame-parameters frame))) | ||
| 520 | display))))) | ||
| 521 | (filtered-frame-list func))) | ||
| 522 | |||
| 523 | (defun framep-on-display (&optional display) | ||
| 524 | "Return the type of frames on DISPLAY. | ||
| 525 | DISPLAY may be a display name or a frame. If it is a frame, its type is | ||
| 526 | returned. | ||
| 527 | If DISPLAY is omitted or nil, it defaults to the selected frame's display. | ||
| 528 | All frames on a given display are of the same type." | ||
| 529 | (or (framep display) | ||
| 530 | (framep (car (frames-on-display-list display))))) | ||
| 531 | |||
| 511 | (defun frame-remove-geometry-params (param-list) | 532 | (defun frame-remove-geometry-params (param-list) |
| 512 | "Return the parameter list PARAM-LIST, but with geometry specs removed. | 533 | "Return the parameter list PARAM-LIST, but with geometry specs removed. |
| 513 | This deletes all bindings in PARAM-LIST for `top', `left', `width', | 534 | This deletes all bindings in PARAM-LIST for `top', `left', `width', |
| @@ -768,6 +789,157 @@ one frame, otherwise the name is displayed on the frame's caption bar." | |||
| 768 | (modify-frame-parameters (selected-frame) | 789 | (modify-frame-parameters (selected-frame) |
| 769 | (list (cons 'name name)))) | 790 | (list (cons 'name name)))) |
| 770 | 791 | ||
| 792 | ;;;; Frame/display capabilities. | ||
| 793 | (defun display-mouse-p (&optional display) | ||
| 794 | "Return non-nil if DISPLAY has a mouse available. | ||
| 795 | DISPLAY can be a display name, a frame, or nil (meaning the selected | ||
| 796 | frame's display)." | ||
| 797 | (let ((frame-type (framep-on-display display))) | ||
| 798 | (cond | ||
| 799 | ((eq frame-type 'pc) | ||
| 800 | (msdos-mouse-p)) | ||
| 801 | ((eq system-type 'windows-nt) | ||
| 802 | (> w32-num-mouse-buttons 0)) | ||
| 803 | ((memq frame-type '(x mac)) | ||
| 804 | t) ;; We assume X and Mac *always* have a pointing device | ||
| 805 | (t | ||
| 806 | (featurep 'xt-mouse))))) | ||
| 807 | |||
| 808 | (defun display-popup-menus-p (&optional display) | ||
| 809 | "Return non-nil if popup menus are supported on DISPLAY. | ||
| 810 | DISPLAY can be a display name, a frame, or nil (meaning the selected | ||
| 811 | frame's display). | ||
| 812 | Support for popup menus requires that the mouse be available." | ||
| 813 | (and | ||
| 814 | (let ((frame-type (framep-on-display display))) | ||
| 815 | (memq frame-type '(x w32 pc mac))) | ||
| 816 | (display-mouse-p display))) | ||
| 817 | |||
| 818 | (defun display-graphic-p (&optional display) | ||
| 819 | "Return non-nil if DISPLAY is a graphic display. | ||
| 820 | Graphical displays are those which are capable of displaying several | ||
| 821 | frames and several different fonts at once. This is true for displays | ||
| 822 | that use a window system such as X, and false for text-only terminals. | ||
| 823 | DISPLAY can be a display name, a frame, or nil (meaning the selected | ||
| 824 | frame's display)." | ||
| 825 | (not (null (memq (framep-on-display display) '(x w32 mac))))) | ||
| 826 | |||
| 827 | (defun display-selections-p (&optional display) | ||
| 828 | "Return non-nil if DISPLAY supports selections. | ||
| 829 | A selection is a way to transfer text or other data between programs | ||
| 830 | via special system buffers called `selection' or `cut buffer' or | ||
| 831 | `clipboard'. | ||
| 832 | DISPLAY can be a display name, a frame, or nil (meaning the selected | ||
| 833 | frame's display)." | ||
| 834 | (let ((frame-type (framep-on-display display))) | ||
| 835 | (cond | ||
| 836 | ((eq frame-type 'pc) | ||
| 837 | ;; MS-DOG frames support selections when Emacs runs inside | ||
| 838 | ;; the Windows' DOS Box. | ||
| 839 | (not (null dos-windows-version))) | ||
| 840 | ((memq frame-type '(x w32 mac)) | ||
| 841 | t) ;; FIXME? | ||
| 842 | (t | ||
| 843 | nil)))) | ||
| 844 | |||
| 845 | (defun display-screens (&optional display) | ||
| 846 | "Return the number of screens associated with DISPLAY." | ||
| 847 | (let ((frame-type (framep-on-display display))) | ||
| 848 | (cond | ||
| 849 | ((memq frame-type '(x w32)) | ||
| 850 | (x-display-screens display)) | ||
| 851 | (t ;; FIXME: is this correct for the Mac? | ||
| 852 | 1)))) | ||
| 853 | |||
| 854 | (defun display-pixel-height (&optional display) | ||
| 855 | "Return the height of DISPLAY's screen in pixels. | ||
| 856 | For character terminals, each character counts as a single pixel." | ||
| 857 | (let ((frame-type (framep-on-display display))) | ||
| 858 | (cond | ||
| 859 | ((memq frame-type '(x w32 mac)) | ||
| 860 | (x-display-pixel-height display)) | ||
| 861 | (t | ||
| 862 | (frame-height (if (framep display) display (selected-frame))))))) | ||
| 863 | |||
| 864 | (defun display-pixel-width (&optional display) | ||
| 865 | "Return the width of DISPLAY's screen in pixels. | ||
| 866 | For character terminals, each character counts as a single pixel." | ||
| 867 | (let ((frame-type (framep-on-display display))) | ||
| 868 | (cond | ||
| 869 | ((memq frame-type '(x w32 mac)) | ||
| 870 | (x-display-pixel-width display)) | ||
| 871 | (t | ||
| 872 | (frame-width (if (framep display) display (selected-frame))))))) | ||
| 873 | |||
| 874 | (defun display-mm-height (&optional display) | ||
| 875 | "Return the height of DISPLAY's screen in millimeters. | ||
| 876 | If the information is unavailable, value is nil." | ||
| 877 | (and (memq (framep-on-display display) '(x w32 mac)) | ||
| 878 | (x-display-mm-height display))) | ||
| 879 | |||
| 880 | (defun display-mm-width (&optional display) | ||
| 881 | "Return the width of DISPLAY's screen in millimeters. | ||
| 882 | If the information is unavailable, value is nil." | ||
| 883 | (and (memq (framep-on-display display) '(x w32 mac)) | ||
| 884 | (x-display-mm-width display))) | ||
| 885 | |||
| 886 | (defun display-backing-store (&optional display) | ||
| 887 | "Return the backing store capability of DISPLAY's screen. | ||
| 888 | The value may be `always', `when-mapped', `not-useful', or nil if | ||
| 889 | the question is inapplicable to a certain kind of display." | ||
| 890 | (let ((frame-type (framep-on-display display))) | ||
| 891 | (cond | ||
| 892 | ((memq frame-type '(x w32 mac)) | ||
| 893 | (x-display-backing-store display)) | ||
| 894 | (t | ||
| 895 | 'not-useful)))) | ||
| 896 | |||
| 897 | (defun display-save-under (&optional display) | ||
| 898 | "Return non-nil if DISPLAY's screen supports the SaveUnder feature." | ||
| 899 | (let ((frame-type (framep-on-display display))) | ||
| 900 | (cond | ||
| 901 | ((memq frame-type '(x w32 mac)) | ||
| 902 | (x-display-save-under display)) | ||
| 903 | (t | ||
| 904 | 'not-useful)))) | ||
| 905 | |||
| 906 | (defun display-planes (&optional display) | ||
| 907 | "Return the number of planes supported by DISPLAY." | ||
| 908 | (let ((frame-type (framep-on-display display))) | ||
| 909 | (cond | ||
| 910 | ((memq frame-type '(x w32 mac)) | ||
| 911 | (x-display-planes display)) | ||
| 912 | ((eq frame-type 'pc) | ||
| 913 | 4) | ||
| 914 | (t | ||
| 915 | (truncate (log (length (tty-color-alist)) 2)))))) | ||
| 916 | |||
| 917 | (defun display-color-cells (&optional display) | ||
| 918 | "Return the number of color cells supported by DISPLAY." | ||
| 919 | (let ((frame-type (framep-on-display display))) | ||
| 920 | (cond | ||
| 921 | ((memq frame-type '(x w32 mac)) | ||
| 922 | (x-display-color-cells display)) | ||
| 923 | ((eq frame-type 'pc) | ||
| 924 | 16) | ||
| 925 | (t | ||
| 926 | (length (tty-color-alist)))))) | ||
| 927 | |||
| 928 | (defun display-visual-class (&optional display) | ||
| 929 | "Returns the visual class of DISPLAY. | ||
| 930 | The value is one of the symbols `static-gray', `gray-scale', | ||
| 931 | `static-color', `pseudo-color', `true-color', or `direct-color'." | ||
| 932 | (let ((frame-type (framep-on-display display))) | ||
| 933 | (cond | ||
| 934 | ((memq frame-type '(x w32 mac)) | ||
| 935 | (x-display-visual-class display)) | ||
| 936 | ((and (memq frame-type '(pc t)) | ||
| 937 | (tty-display-color-p display)) | ||
| 938 | 'static-color) | ||
| 939 | (t | ||
| 940 | 'static-gray)))) | ||
| 941 | |||
| 942 | |||
| 771 | ;;;; Aliases for backward compatibility with Emacs 18. | 943 | ;;;; Aliases for backward compatibility with Emacs 18. |
| 772 | (defalias 'screen-height 'frame-height) | 944 | (defalias 'screen-height 'frame-height) |
| 773 | (defalias 'screen-width 'frame-width) | 945 | (defalias 'screen-width 'frame-width) |