diff options
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/term.c b/src/term.c index bc30e3fb0d8..9c733a46abb 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2105,17 +2105,17 @@ set_tty_color_mode (f, val) | |||
| 2105 | 2105 | ||
| 2106 | /* Return the display object specified by DISPLAY. DISPLAY may be a | 2106 | /* Return the display object specified by DISPLAY. DISPLAY may be a |
| 2107 | display id, a frame, or nil for the display device of the current | 2107 | display id, a frame, or nil for the display device of the current |
| 2108 | frame. */ | 2108 | frame. If THROW is zero, return NULL for failure, otherwise throw |
| 2109 | an error. */ | ||
| 2109 | 2110 | ||
| 2110 | struct display * | 2111 | struct display * |
| 2111 | get_display (Lisp_Object display) | 2112 | get_display (Lisp_Object display, int throw) |
| 2112 | { | 2113 | { |
| 2114 | Lisp_Object result = NULL; | ||
| 2115 | |||
| 2113 | if (NILP (display)) | 2116 | if (NILP (display)) |
| 2114 | display = selected_frame; | 2117 | display = selected_frame; |
| 2115 | 2118 | ||
| 2116 | if (! INTEGERP (display) && ! FRAMEP (display)) | ||
| 2117 | return NULL; | ||
| 2118 | |||
| 2119 | if (INTEGERP (display)) | 2119 | if (INTEGERP (display)) |
| 2120 | { | 2120 | { |
| 2121 | struct display *d; | 2121 | struct display *d; |
| @@ -2123,15 +2123,21 @@ get_display (Lisp_Object display) | |||
| 2123 | for (d = display_list; d; d = d->next_display) | 2123 | for (d = display_list; d; d = d->next_display) |
| 2124 | { | 2124 | { |
| 2125 | if (d->id == XINT (display)) | 2125 | if (d->id == XINT (display)) |
| 2126 | return d; | 2126 | { |
| 2127 | result = d; | ||
| 2128 | break; | ||
| 2129 | } | ||
| 2127 | } | 2130 | } |
| 2128 | return NULL; | ||
| 2129 | } | 2131 | } |
| 2130 | else if (FRAMEP (display)) | 2132 | else if (FRAMEP (display)) |
| 2131 | { | 2133 | { |
| 2132 | return FRAME_DISPLAY (XFRAME (display)); | 2134 | result = FRAME_DISPLAY (XFRAME (display)); |
| 2133 | } | 2135 | } |
| 2134 | return NULL; | 2136 | |
| 2137 | if (result == NULL && throw) | ||
| 2138 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2139 | |||
| 2140 | return result; | ||
| 2135 | } | 2141 | } |
| 2136 | 2142 | ||
| 2137 | /* Return the tty display object specified by DISPLAY. */ | 2143 | /* Return the tty display object specified by DISPLAY. */ |
| @@ -2139,7 +2145,7 @@ get_display (Lisp_Object display) | |||
| 2139 | static struct display * | 2145 | static struct display * |
| 2140 | get_tty_display (Lisp_Object display) | 2146 | get_tty_display (Lisp_Object display) |
| 2141 | { | 2147 | { |
| 2142 | struct display *d = get_display (display); | 2148 | struct display *d = get_display (display, 0); |
| 2143 | 2149 | ||
| 2144 | if (d && d->type == output_initial) | 2150 | if (d && d->type == output_initial) |
| 2145 | d = NULL; | 2151 | d = NULL; |
| @@ -2194,10 +2200,7 @@ frame's display). */) | |||
| 2194 | (display) | 2200 | (display) |
| 2195 | Lisp_Object display; | 2201 | Lisp_Object display; |
| 2196 | { | 2202 | { |
| 2197 | struct display *d = get_display (display); | 2203 | struct display *d = get_display (display, 1); |
| 2198 | |||
| 2199 | if (!d) | ||
| 2200 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2201 | 2204 | ||
| 2202 | if (d->name) | 2205 | if (d->name) |
| 2203 | return build_string (d->name); | 2206 | return build_string (d->name); |
| @@ -2210,10 +2213,8 @@ DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0, | |||
| 2210 | (display) | 2213 | (display) |
| 2211 | Lisp_Object display; | 2214 | Lisp_Object display; |
| 2212 | { | 2215 | { |
| 2213 | struct display *d = get_display (display); | 2216 | struct display *d = get_display (display, 1); |
| 2214 | 2217 | ||
| 2215 | if (!d) | ||
| 2216 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2217 | if (d->type != output_termcap) | 2218 | if (d->type != output_termcap) |
| 2218 | error ("Display %d is not a termcap display", d->id); | 2219 | error ("Display %d is not a termcap display", d->id); |
| 2219 | 2220 | ||
| @@ -2228,10 +2229,7 @@ DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_control | |||
| 2228 | (display) | 2229 | (display) |
| 2229 | Lisp_Object display; | 2230 | Lisp_Object display; |
| 2230 | { | 2231 | { |
| 2231 | struct display *d = get_display (display); | 2232 | struct display *d = get_display (display, 1); |
| 2232 | |||
| 2233 | if (!d) | ||
| 2234 | wrong_type_argument (Qdisplay_live_p, display); | ||
| 2235 | 2233 | ||
| 2236 | if (d->type != output_termcap || d->display_info.tty->name) | 2234 | if (d->type != output_termcap || d->display_info.tty->name) |
| 2237 | return Qnil; | 2235 | return Qnil; |
| @@ -3157,7 +3155,7 @@ but if the second argument FORCE is non-nil, you may do so. */) | |||
| 3157 | { | 3155 | { |
| 3158 | struct display *d, *p; | 3156 | struct display *d, *p; |
| 3159 | 3157 | ||
| 3160 | d = get_display (display); | 3158 | d = get_display (display, 0); |
| 3161 | 3159 | ||
| 3162 | if (!d) | 3160 | if (!d) |
| 3163 | return Qnil; | 3161 | return Qnil; |
| @@ -3193,7 +3191,7 @@ Displays are represented by their integer identifiers. */) | |||
| 3193 | if (!INTEGERP (object)) | 3191 | if (!INTEGERP (object)) |
| 3194 | return Qnil; | 3192 | return Qnil; |
| 3195 | 3193 | ||
| 3196 | d = get_display (object); | 3194 | d = get_display (object, 0); |
| 3197 | 3195 | ||
| 3198 | if (!d) | 3196 | if (!d) |
| 3199 | return Qnil; | 3197 | return Qnil; |