from them. Some display attributes may not be used together with
color; the termcap capability `NC' specifies which ones. */
-#define MAY_USE_WITH_COLORS_P(ATTR) \
- (TN_max_colors > 0 \
- ? (TN_no_color_video & (ATTR)) == 0 \
- : 1)
+#define MAY_USE_WITH_COLORS_P(tty, ATTR) \
+ (tty->TN_max_colors > 0 \
+ ? (tty->TN_no_color_video & (ATTR)) == 0 \
+ : 1)
- /* Turn appearances of face FACE_ID on tty frame F on. */
+ /* Turn appearances of face FACE_ID on tty frame F on.
+ FACE_ID is a realized face ID number, in the face cache. */
static void
turn_on_face (f, face_id)
#endif /* !WINDOWSNT */
- DISPLAY can be a display, a frame, or nil (meaning the selected
+\f
+
+/* Return the display object specified by DISPLAY. DISPLAY may be a
+ display id, a frame, or nil for the display device of the current
+ frame. If THROW is zero, return NULL for failure, otherwise throw
+ an error. */
+
+struct display *
+get_display (Lisp_Object display, int throw)
+{
+ struct display *result = NULL;
+
+ if (NILP (display))
+ display = selected_frame;
+
+ if (INTEGERP (display))
+ {
+ struct display *d;
+
+ for (d = display_list; d; d = d->next_display)
+ {
+ if (d->id == XINT (display))
+ {
+ result = d;
+ break;
+ }
+ }
+ }
+ else if (FRAMEP (display))
+ {
+ result = FRAME_DISPLAY (XFRAME (display));
+ }
+
+ if (result == NULL && throw)
+ wrong_type_argument (Qdisplay_live_p, display);
+
+ return result;
+}
+
+/* Return the tty display object specified by DISPLAY. */
+
+static struct display *
+get_tty_display (Lisp_Object display)
+{
+ struct display *d = get_display (display, 0);
+
+ if (d && d->type == output_initial)
+ d = NULL;
+
+ if (d && d->type != output_termcap)
+ {
+#if 0 /* XXX We need a predicate as the first argument; find one. */
+ wrong_type_argument ("Not a termcap display", display);
+#else /* Until we fix the wrong_type_argument call above, simply throw
+ a dumb error. */
+ error ("DISPLAY is not a termcap display");
+#endif
+ }
+
+ return d;
+}
+
+/* Return the active termcap display that uses the tty device with the
+ given name. If NAME is NULL, return the display corresponding to
+ our controlling terminal.
+
+ This function ignores suspended displays.
+
+ Returns NULL if the named terminal device is not opened. */
+
+struct display *
+get_named_tty_display (name)
+ char *name;
+{
+ struct display *d;
+
+ for (d = display_list; d; d = d->next_display) {
+ if (d->type == output_termcap
+ && ((d->display_info.tty->name == 0 && name == 0)
+ || (name && d->display_info.tty->name
+ && !strcmp (d->display_info.tty->name, name)))
+ && DISPLAY_ACTIVE_P (d))
+ return d;
+ };
+
+ return 0;
+}
+
+\f
+
+DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0,
+ doc: /* Return the name of the device that DISPLAY uses.
+It is not guaranteed that the returned value is unique among opened displays.
+
- doc: /* Return the type of the TTY device that DISPLAY uses. */)
++DISPLAY may be a display, a frame, or nil (meaning the selected
+frame's display). */)
+ (display)
+ Lisp_Object display;
+{
+ struct display *d = get_display (display, 1);
+
+ if (d->name)
+ return build_string (d->name);
+ else
+ return Qnil;
+}
+
+DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
- doc: /* Return non-nil if DISPLAY is on the controlling tty of the Emacs process. */)
++ doc: /* Return the type of the TTY device that DISPLAY uses.
++
++DISPLAY may be a display, a frame, or nil (meaning the selected
++frame's display). */)
+ (display)
+ Lisp_Object display;
+{
+ struct display *d = get_display (display, 1);
+
+ if (d->type != output_termcap)
+ error ("Display %d is not a termcap display", d->id);
+
+ if (d->display_info.tty->type)
+ return build_string (d->display_info.tty->type);
+ else
+ return Qnil;
+}
+
+DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0,
++ doc: /* Return non-nil if DISPLAY is on the controlling tty of the Emacs process.
++
++DISPLAY may be a display, a frame, or nil (meaning the selected
++frame's display). */)
+ (display)
+ Lisp_Object display;
+{
+ struct display *d = get_display (display, 1);
+
+ if (d->type != output_termcap || d->display_info.tty->name)
+ return Qnil;
+ else
+ return Qt;
+}
+
++DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
++ doc: /* Declare that the tty used by DISPLAY does not handle underlining.
++This is used to override the terminfo data, for certain terminals that
++do not really do underlining, but say that they do. This function has
++no effect if used on a non-tty display.
++
++DISPLAY may be a display, a frame, or nil (meaning the selected
++frame's display). */)
++ (display)
++ Lisp_Object display;
++{
++ struct display *d = get_display (display, 1);
++
++ if (d->type == output_termcap)
++ d->display_info.tty->TS_enter_underline_mode = 0;
++ return Qnil;
++}
++
++
\f
/***********************************************************************
Initialization
The function should accept no arguments. */);
Vring_bell_function = Qnil;
+ DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
+ doc: /* Functions to be run after suspending a tty.
+The functions are run with one argument, the name of the tty to be suspended.
+See `suspend-tty'. */);
+ Vsuspend_tty_functions = Qnil;
+
+
+ DEFVAR_LISP ("resume-tty-functions", &Vresume_tty_functions,
+ doc: /* Functions to be run after resuming a tty.
+The functions are run with one argument, the name of the tty that was revived.
+See `resume-tty'. */);
+ Vresume_tty_functions = Qnil;
+
defsubr (&Stty_display_color_p);
defsubr (&Stty_display_color_cells);
+ defsubr (&Stty_no_underline);
+ defsubr (&Sdisplay_name);
+ defsubr (&Sdisplay_tty_type);
+ defsubr (&Sdisplay_controlling_tty_p);
+ defsubr (&Sdelete_display);
+ defsubr (&Sdisplay_live_p);
+ defsubr (&Sdisplay_list);
+ defsubr (&Ssuspend_tty);
+ defsubr (&Sresume_tty);
+
+ Fprovide (intern ("multi-tty"), Qnil);
+
}
+
+
/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
(do not change this comment) */