summaryrefslogtreecommitdiff
path: root/lisp/frame.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-09-20 21:57:23 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-09-20 21:57:23 +0000
commit371fed4ea49cb23061a39549c0e74aeed85e84df (patch)
tree31ffd502dc12c3c5098b9a3b2fb66901f779e43d /lisp/frame.el
parentd3615887a6bfcae39f08e79483dd25062d13e441 (diff)
downloademacs-371fed4ea49cb23061a39549c0e74aeed85e84df.tar.gz
(get-device-terminal): New function. Moved from termdev.el.
(frames-on-display-list): Use it.
Diffstat (limited to 'lisp/frame.el')
-rw-r--r--lisp/frame.el38
1 files changed, 28 insertions, 10 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index 8da6c508a2d..7f5cdbe19dc 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -31,9 +31,8 @@
(list (cons nil
(if (fboundp 'tty-create-frame-with-faces)
'tty-create-frame-with-faces
- (function
- (lambda (parameters)
- (error "Can't create multiple frames without a window system"))))))
+ (lambda (parameters)
+ (error "Can't create multiple frames without a window system")))))
"Alist of window-system dependent functions to call to create a new frame.
The window system startup file should add its frame creation
function to this list, which should take an alist of parameters
@@ -757,16 +756,35 @@ setup is for focus to follow the pointer."
(lambda (frame)
(eq frame (window-frame (minibuffer-window frame))))))
-(defun frames-on-display-list (&optional terminal)
- "Return a list of all frames on TERMINAL.
-
-TERMINAL should be a terminal, a frame,
-or a name of an X display (a string of the form
+;; Used to be called `terminal-id' in termdev.el.
+(defun get-device-terminal (device)
+ "Return the terminal corresponding to DEVICE.
+DEVICE can be a terminal, a frame, nil (meaning the selected frame's terminal),
+the name of an X display device (HOST.SERVER.SCREEN) or a tty device file."
+ (cond
+ ((or (null device) (framep device))
+ (frame-terminal device))
+ ((stringp device)
+ (let ((f (car (filtered-frame-list
+ (lambda (frame)
+ (or (equal (frame-parameter frame 'display) device)
+ (equal (frame-parameter frame 'tty) device)))))))
+ (or f (error "Display %s does not exist" device))
+ (frame-terminal f)))
+ ((terminal-live-p device) device)
+ (t
+ (error "Invalid argument %s in `get-device-terminal'" device))))
+
+(defun frames-on-display-list (&optional device)
+ "Return a list of all frames on DEVICE.
+
+DEVICE should be a terminal, a frame,
+or a name of an X display or tty (a string of the form
HOST:SERVER.SCREEN).
-If TERMINAL is omitted or nil, it defaults to the selected
+If DEVICE is omitted or nil, it defaults to the selected
frame's terminal device."
- (let* ((terminal (terminal-id terminal))
+ (let* ((terminal (get-device-terminal device))
(func #'(lambda (frame)
(eq (frame-terminal frame) terminal))))
(filtered-frame-list func)))