comparison src/frame.h @ 732:a8d94735277e

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Tue, 30 Jun 1992 13:54:21 +0000
parents 8c615e453683
children e4093444f9f8
comparison
equal deleted inserted replaced
731:5c6db33a9ef6 732:a8d94735277e
1 /* Define screen-object for GNU Emacs. 1 /* Define screen-object for GNU Emacs.
2 Copyright (C) 1988 Free Software Foundation, Inc. 2 Copyright (C) 1988, 1992 Free Software Foundation, Inc.
3 3
4 This file is part of GNU Emacs. 4 This file is part of GNU Emacs.
5 5
6 GNU Emacs is free software; you can redistribute it and/or modify 6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option) 8 the Free Software Foundation; either version 2, or (at your option)
9 any later version. 9 any later version.
10 10
11 GNU Emacs is distributed in the hope that it will be useful, 11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to 17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20 20
21 #ifdef MULTI_SCREEN 21 /* The structure representing a screen.
22
23 We declare this even if MULTI_SCREEN is not defined, because when
24 we lack multi-screen support, we use one instance of this structure
25 to represent the one screen we support. This is cleaner than
26 having miscellaneous random variables scattered about. */
22 27
23 enum output_method 28 enum output_method
24 { output_termcap, output_x_window }; 29 { output_termcap, output_x_window };
25 30
26 struct screen 31 struct screen
32 struct screen_glyphs *current_glyphs; 37 struct screen_glyphs *current_glyphs;
33 38
34 /* glyphs we'd like to appear on the screen */ 39 /* glyphs we'd like to appear on the screen */
35 struct screen_glyphs *desired_glyphs; 40 struct screen_glyphs *desired_glyphs;
36 41
42 /* See do_line_insertion_deletion_costs for info on these arrays. */
37 /* Cost of inserting 1 line on this screen */ 43 /* Cost of inserting 1 line on this screen */
38 int *insert_line_cost; 44 int *insert_line_cost;
39
40 /* Cost of deleting 1 line on this screen */ 45 /* Cost of deleting 1 line on this screen */
41 int *delete_line_cost; 46 int *delete_line_cost;
42
43 /* Cost of inserting n lines on this screen */ 47 /* Cost of inserting n lines on this screen */
44 int *insert_n_lines_cost; 48 int *insert_n_lines_cost;
45
46 /* Cost of deleting n lines on this screen */ 49 /* Cost of deleting n lines on this screen */
47 int *delete_n_lines_cost; 50 int *delete_n_lines_cost;
48 51
49 /* glyphs for the mode line */ 52 /* glyphs for the mode line */
50 struct screen_glyphs *temp_glyphs; 53 struct screen_glyphs *temp_glyphs;
146 /* Nonnegative if current redisplay should not do scroll computation 149 /* Nonnegative if current redisplay should not do scroll computation
147 for lines beyond a certain vpos. This is the vpos. */ 150 for lines beyond a certain vpos. This is the vpos. */
148 int scroll_bottom_vpos; 151 int scroll_bottom_vpos;
149 }; 152 };
150 153
154 #ifdef MULTI_SCREEN
155
151 typedef struct screen *SCREEN_PTR; 156 typedef struct screen *SCREEN_PTR;
152 157
153 #define XSCREEN(p) ((struct screen *) XPNTR (p)) 158 #define XSCREEN(p) ((struct screen *) XPNTR (p))
154 #define XSETSCREEN(p, v) ((struct screen *) XSETPNTR (p, v)) 159 #define XSETSCREEN(p, v) ((struct screen *) XSETPNTR (p, v))
155 160
156 #define WINDOW_SCREEN(w) (w)->screen 161 #define WINDOW_SCREEN(w) (w)->screen
157 162
158 #define SCREENP(s) (XTYPE(s) == Lisp_Screen) 163 #define SCREENP(s) (XTYPE(s) == Lisp_Screen)
159 #define SCREEN_LIVE_P(s) ((s)->display.nothing != 0) 164 #define SCREEN_LIVE_P(s) ((s)->display.nothing != 0)
160 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1, s->garbaged = 1)
161 #define SCREEN_IS_TERMCAP(s) ((s)->output_method == output_termcap) 165 #define SCREEN_IS_TERMCAP(s) ((s)->output_method == output_termcap)
162 #define SCREEN_IS_X(s) ((s)->output_method == output_x_window) 166 #define SCREEN_IS_X(s) ((s)->output_method == output_x_window)
163 #define SCREEN_MINIBUF_ONLY_P(s) \ 167 #define SCREEN_MINIBUF_ONLY_P(s) \
164 EQ (SCREEN_ROOT_WINDOW (s), SCREEN_MINIBUF_WINDOW (s)) 168 EQ (SCREEN_ROOT_WINDOW (s), SCREEN_MINIBUF_WINDOW (s))
165 #define SCREEN_HAS_MINIBUF(s) ((s)->has_minibuffer) 169 #define SCREEN_HAS_MINIBUF(s) ((s)->has_minibuffer)
171 #define SCREEN_NEW_HEIGHT(s) (s)->new_height 175 #define SCREEN_NEW_HEIGHT(s) (s)->new_height
172 #define SCREEN_NEW_WIDTH(s) (s)->new_width 176 #define SCREEN_NEW_WIDTH(s) (s)->new_width
173 #define SCREEN_CURSOR_X(s) (s)->cursor_x 177 #define SCREEN_CURSOR_X(s) (s)->cursor_x
174 #define SCREEN_CURSOR_Y(s) (s)->cursor_y 178 #define SCREEN_CURSOR_Y(s) (s)->cursor_y
175 #define SCREEN_VISIBLE_P(s) (s)->visible 179 #define SCREEN_VISIBLE_P(s) (s)->visible
180 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1, s->garbaged = 1)
176 #define SCREEN_GARBAGED_P(s) (s)->garbaged 181 #define SCREEN_GARBAGED_P(s) (s)->garbaged
177 #define SCREEN_NO_SPLIT_P(s) (s)->no_split 182 #define SCREEN_NO_SPLIT_P(s) (s)->no_split
178 #define SCREEN_WANTS_MODELINE_P(s) (s)->wants_modeline 183 #define SCREEN_WANTS_MODELINE_P(s) (s)->wants_modeline
179 #define SCREEN_ICONIFIED_P(s) (s)->iconified 184 #define SCREEN_ICONIFIED_P(s) (s)->iconified
180 #define SCREEN_MINIBUF_WINDOW(s) (s)->minibuffer_window 185 #define SCREEN_MINIBUF_WINDOW(s) (s)->minibuffer_window
200 if (! SCREENP (x) \ 205 if (! SCREENP (x) \
201 || ! SCREEN_LIVE_P (XSCREEN (x))) \ 206 || ! SCREEN_LIVE_P (XSCREEN (x))) \
202 x = wrong_type_argument (Qlive_screen_p, (x)); \ 207 x = wrong_type_argument (Qlive_screen_p, (x)); \
203 } 208 }
204 209
210 /* FOR_EACH_SCREEN (LIST_VAR, SCREEN_VAR) followed by a statement is a
211 `for' loop which iterates over the elements of Vscreen_list. The
212 loop will set SCREEN_VAR, a SCREEN_PTR, to each screen in
213 Vscreen_list in succession and execute the statement. LIST_VAR
214 should be a Lisp_Object; it is used to iterate through the
215 Vscreen_list.
216
217 If MULTI_SCREEN isn't defined, then this loop expands to something which
218 executes the statement once. */
219 #define FOR_EACH_SCREEN(list_var, screen_var) \
220 for ((list_var) = Vscreen_list; \
221 (CONSP (list_var) \
222 && (screen_var = XSCREEN (XCONS (list_var)->car), 1)); \
223 list_var = XCONS (list_var)->cdr)
224
225
205 extern Lisp_Object Qscreenp, Qlive_screen_p; 226 extern Lisp_Object Qscreenp, Qlive_screen_p;
206 227
207 extern struct screen *selected_screen; 228 extern struct screen *selected_screen;
208 extern struct screen *last_nonminibuf_screen; 229 extern struct screen *last_nonminibuf_screen;
209 230
210 extern struct screen *make_terminal_screen (); 231 extern struct screen *make_terminal_screen ();
211 extern struct screen *make_screen (); 232 extern struct screen *make_screen ();
212 extern struct screen *make_minibuffer_screen (); 233 extern struct screen *make_minibuffer_screen ();
213 extern struct screen *make_screen_without_minibuffer (); 234 extern struct screen *make_screen_without_minibuffer ();
214 235
236 /* Nonzero means SCREEN_MESSAGE_BUF (selected_screen) is being used by
237 print. */
238 extern int message_buf_print;
239
215 extern Lisp_Object Vscreen_list; 240 extern Lisp_Object Vscreen_list;
216 extern Lisp_Object Vdefault_screen_alist; 241 extern Lisp_Object Vdefault_screen_alist;
217 242
218 extern Lisp_Object Vterminal_screen; 243 extern Lisp_Object Vterminal_screen;
219 244
221 246
222 /* These definitions are used in a single-screen version of Emacs. */ 247 /* These definitions are used in a single-screen version of Emacs. */
223 248
224 #define SCREEN_PTR int 249 #define SCREEN_PTR int
225 250
251 extern struct screen the_only_screen;
252
226 extern int selected_screen; 253 extern int selected_screen;
227 #define last_nonminibuf_screen selected_screen 254 extern int last_nonminibuf_screen;
255
256 /* Nonzero means SCREEN_MESSAGE_BUF (selected_screen) is being used by
257 print. */
258 extern int message_buf_print;
228 259
229 #define XSCREEN(s) selected_screen 260 #define XSCREEN(s) selected_screen
230 #define WINDOW_SCREEN(w) selected_screen 261 #define WINDOW_SCREEN(w) selected_screen
231 262
232 #define SCREENP(s) (XTYPE(s) == Lisp_Screen) 263 #define SCREENP(s) (XTYPE(s) == Lisp_Screen)
233 #define SCREEN_LIVE_P(s) 1 264 #define SCREEN_LIVE_P(s) 1
234 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1)
235 #define SCREEN_IS_TERMCAP(s) 1 265 #define SCREEN_IS_TERMCAP(s) 1
236 #define SCREEN_IS_X(s) 0 266 #define SCREEN_IS_X(s) 0
237 #define SCREEN_IS_MINIBUF_ONLY(s) 0 267 #define SCREEN_MINIBUF_ONLY_P(s) 0
238 #define SCREEN_HAS_MINIBUF(s) 1 268 #define SCREEN_HAS_MINIBUF(s) 1
239 #define SCREEN_CURRENT_GLYPHS(s) current_glyphs 269 #define SCREEN_CURRENT_GLYPHS(s) the_only_screen.current_glyphs
240 #define SCREEN_DESIRED_GLYPHS(s) desired_glyphs 270 #define SCREEN_DESIRED_GLYPHS(s) the_only_screen.desired_glyphs
241 #define SCREEN_TEMP_GLYPHS(s) temp_glyphs 271 #define SCREEN_TEMP_GLYPHS(s) the_only_screen.temp_glyphs
242 #define SCREEN_HEIGHT(s) screen_height 272 #define SCREEN_HEIGHT(s) the_only_screen.height
243 #define SCREEN_WIDTH(s) screen_width 273 #define SCREEN_WIDTH(s) the_only_screen.width
244 #define SCREEN_NEW_HEIGHT(s) delayed_screen_height 274 #define SCREEN_NEW_HEIGHT(s) the_only_screen.new_height
245 #define SCREEN_NEW_WIDTH(s) delayed_screen_width 275 #define SCREEN_NEW_WIDTH(s) the_only_screen.new_width
246 #define SCREEN_CURSOR_X(s) cursX 276 #define SCREEN_CURSOR_X(s) the_only_screen.cursor_x
247 #define SCREEN_CURSOR_Y(s) cursY 277 #define SCREEN_CURSOR_Y(s) the_only_screen.cursor_y
248 #define SCREEN_VISIBLE_P(s) 1 278 #define SCREEN_VISIBLE_P(s) 1
279 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1)
249 #define SCREEN_GARBAGED_P(s) screen_garbaged 280 #define SCREEN_GARBAGED_P(s) screen_garbaged
250 #define SCREEN_NO_SPLIT_P(s) 0 281 #define SCREEN_NO_SPLIT_P(s) 0
251 #define SCREEN_WANTS_MODELINE_P(s) 1 282 #define SCREEN_WANTS_MODELINE_P(s) 1
252 #define SCREEN_ICONIFIED_P(s) 0 283 #define SCREEN_ICONIFIED_P(s) 0
253 #define SCREEN_MINIBUF_WINDOW(s) minibuf_window 284 #define SCREEN_MINIBUF_WINDOW(s) minibuf_window
254 #define SCREEN_ROOT_WINDOW(s) root_window 285 #define SCREEN_ROOT_WINDOW(s) the_only_screen.root_window
255 #define SCREEN_SELECTED_WINDOW(s) selected_window 286 #define SCREEN_SELECTED_WINDOW(s) selected_window
256 #define SET_GLYPHS_SCREEN(glyphs,screen) 287 #define SET_GLYPHS_SCREEN(glyphs,screen)
257 #define SCREEN_INSERT_COST(screen) insert_line_cost 288 #define SCREEN_INSERT_COST(screen) the_only_screen.insert_line_cost
258 #define SCREEN_DELETE_COST(screen) delete_line_cost 289 #define SCREEN_DELETE_COST(screen) the_only_screen.delete_line_cost
259 #define SCREEN_INSERTN_COST(screen) insert_n_lines_cost 290 #define SCREEN_INSERTN_COST(screen) the_only_screen.insert_n_lines_cost
260 #define SCREEN_DELETEN_COST(screen) delete_n_lines_cost 291 #define SCREEN_DELETEN_COST(screen) the_only_screen.delete_n_lines_cost
261 #define SCREEN_MESSAGE_BUF(s) message_buf 292 #define SCREEN_MESSAGE_BUF(s) the_only_screen.message_buf
262 #define SCREEN_SCROLL_BOTTOM_VPOS(s) scroll_bottom_vpos 293 #define SCREEN_SCROLL_BOTTOM_VPOS(s) the_only_screen.scroll_bottom_vpos
294 #define SCREEN_FOCUS_SCREEN(s) 0
263 295
264 #define CHECK_SCREEN(x, i) { ; } 296 #define CHECK_SCREEN(x, i) { ; }
265 297 #define CHECK_LIVE_SCREEN(x, y) { ; }
266 extern int screen_width, screen_height; 298
267 extern int cursX, cursY; 299 /* FOR_EACH_SCREEN (LIST_VAR, SCREEN_VAR) followed by a statement is a
300 `for' loop which iterates over the elements of Vscreen_list. The
301 loop will set SCREEN_VAR, a SCREEN_PTR, to each screen in
302 Vscreen_list in succession and execute the statement. LIST_VAR
303 should be a Lisp_Object; it is used to iterate through the
304 Vscreen_list.
305
306 If MULTI_SCREEN _is_ defined, then this loop expands to a real
307 `for' loop which traverses Vscreen_list using LIST_VAR and
308 SCREEN_VAR. */
309 #define FOR_EACH_SCREEN(list_var, screen_var) \
310 for (screen_var = (SCREEN_PTR) 1; screen_var; screen_var = (SCREEN_PTR) 0)
268 311
269 #endif /* not MULTI_SCREEN */ 312 #endif /* not MULTI_SCREEN */