209
|
1 ;;; device.el --- miscellaneous device functions not written in C
|
|
2
|
|
3 ;; Copyright (C) 1994-5, 1997 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1995, 1996 Ben Wing
|
|
5
|
|
6 ;; Maintainer: XEmacs Development Team
|
|
7 ;; Keywords: internal, dumped
|
|
8
|
|
9 ;; This file is part of XEmacs.
|
|
10
|
|
11 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
12 ;; under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 ;; General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
|
24 ;; Boston, MA 02111-1307, USA.
|
|
25
|
|
26 ;;; Synched up with: Not in FSF.
|
|
27
|
|
28 ;;; Commentary:
|
|
29
|
|
30 ;; This file is dumped with XEmacs.
|
|
31
|
|
32 ;;; Code:
|
|
33
|
|
34 (defun device-list ()
|
|
35 "Return a list of all devices."
|
|
36 (apply 'nconc (mapcar 'console-device-list (console-list))))
|
|
37
|
|
38 (defun device-type (&optional device)
|
|
39 "Return the type of the specified device (e.g. `x' or `tty').
|
|
40 This is equivalent to the type of the device's console.
|
|
41 Value is `tty' for a tty device (a character-only terminal),
|
|
42 `x' for a device that is a screen on an X display,
|
|
43 `ns' for a device that is a NeXTstep connection (not yet implemented),
|
213
|
44 `mswindows' for a device that is a Windows or Windows NT connection,
|
209
|
45 `pc' for a device that is a direct-write MS-DOS screen (not yet implemented),
|
|
46 `stream' for a stream device (which acts like a stdio stream), and
|
|
47 `dead' for a deleted device."
|
|
48 (or device (setq device (selected-device)))
|
|
49 (if (not (device-live-p device)) 'dead
|
|
50 (console-type (device-console device))))
|
|
51
|
|
52 (defun make-tty-device (&optional tty terminal-type controlling-process)
|
|
53 "Create a new device on TTY.
|
|
54 TTY should be the name of a tty device file (e.g. \"/dev/ttyp3\" under
|
|
55 SunOS et al.), as returned by the `tty' command. A value of nil means
|
|
56 use the stdin and stdout as passed to XEmacs from the shell.
|
|
57 If TERMINAL-TYPE is non-nil, it should be a string specifying the
|
|
58 type of the terminal attached to the specified tty. If it is nil,
|
|
59 the terminal type will be inferred from the TERM environment variable.
|
|
60 If CONTROLLING-PROCESS is non-nil, it should be an integer
|
|
61 specifying the process id of the process in control of the specified tty. If
|
|
62 it is nil, it is assumes to be the value returned by emacs-pid."
|
|
63 (make-device 'tty tty (list 'terminal-type terminal-type
|
|
64 'controlling-process controlling-process)))
|
|
65
|
282
|
66 (defun device-pixel-width (&optional device)
|
|
67 "Return the width in pixels of DEVICE, or nil if unknown."
|
284
|
68 (let ((ds (device-system-metric device 'size-device)))
|
282
|
69 (and ds (car ds))))
|
|
70
|
|
71 (defun device-pixel-height (&optional device)
|
|
72 "Return the height in pixels of DEVICE, or nil if unknown."
|
284
|
73 (let ((ds (device-system-metric device 'size-device)))
|
282
|
74 (and ds (cdr ds))))
|
|
75
|
|
76 (defun device-mm-width (&optional device)
|
|
77 "Return the width in millimeters of DEVICE, or nil if unknown."
|
284
|
78 (let ((ds (device-system-metric device 'size-device-mm)))
|
282
|
79 (and ds (car ds))))
|
|
80
|
|
81 (defun device-mm-height (&optional device)
|
|
82 "Return the height in millimeters of DEVICE, or nil if unknown."
|
284
|
83 (let ((ds (device-system-metric device 'size-device-mm)))
|
282
|
84 (and ds (cdr ds))))
|
|
85
|
|
86 (defun device-bitplanes (&optional device)
|
|
87 "Return the number of bitplanes of DEVICE, or nil if unknown."
|
284
|
88 (device-system-metric device 'num-bit-planes))
|
282
|
89
|
|
90 (defun device-color-cells (&optional device)
|
|
91 "Return the number of color cells of DEVICE, or nil if unknown."
|
284
|
92 (device-system-metric device 'num-color-cells))
|
282
|
93
|
209
|
94 (defun make-x-device (&optional display)
|
|
95 "Create a new device connected to DISPLAY."
|
|
96 (make-device 'x display))
|
|
97
|
213
|
98 (defun make-mswindows-device ()
|
|
99 "Create a new mswindows device."
|
|
100 (make-device 'mswindows nil))
|
209
|
101
|
|
102 (defun device-on-window-system-p (&optional device)
|
|
103 "Return non-nil if DEVICE is on a window system.
|
|
104 This generally means that there is support for the mouse, the menubar,
|
|
105 the toolbar, glyphs, etc."
|
|
106 (or device (setq device (selected-device)))
|
|
107 (console-on-window-system-p (device-console device)))
|
|
108
|
|
109 (defalias 'valid-device-type-p 'valid-console-type-p)
|
|
110 (defalias 'device-type-list 'console-type-list)
|
|
111 (defalias 'device-pixel-depth 'device-bitplanes)
|
|
112
|
|
113 ;;; device.el ends here
|