261
|
1 /* Define screen-object for GNU Emacs.
|
|
2 Copyright (C) 1988 Free Software Foundation, Inc.
|
|
3
|
|
4 This file is part of GNU Emacs.
|
|
5
|
|
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
|
|
8 the Free Software Foundation; either version 1, or (at your option)
|
|
9 any later version.
|
|
10
|
|
11 GNU Emacs is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 GNU General Public License for more details.
|
|
15
|
|
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
|
|
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
19
|
|
20
|
|
21 #ifdef MULTI_SCREEN
|
|
22
|
|
23 enum output_method
|
|
24 { output_termcap, output_x_window };
|
|
25
|
|
26 struct screen
|
|
27 {
|
|
28 int size;
|
|
29 struct Lisp_Vector *next;
|
|
30
|
|
31 /* glyphs as they appear on the screen */
|
|
32 struct screen_glyphs *current_glyphs;
|
|
33
|
|
34 /* glyphs we'd like to appear on the screen */
|
|
35 struct screen_glyphs *desired_glyphs;
|
|
36
|
|
37 /* Cost of inserting 1 line on this screen */
|
|
38 int *insert_line_cost;
|
|
39
|
|
40 /* Cost of deleting 1 line on this screen */
|
|
41 int *delete_line_cost;
|
|
42
|
|
43 /* Cost of inserting n lines on this screen */
|
|
44 int *insert_n_lines_cost;
|
|
45
|
|
46 /* Cost of deleting n lines on this screen */
|
|
47 int *delete_n_lines_cost;
|
|
48
|
|
49 /* glyphs for the mode line */
|
|
50 struct screen_glyphs *temp_glyphs;
|
|
51
|
|
52 /* Intended cursor position of this screen.
|
|
53 Measured in characters, counting from upper left corner
|
|
54 within the screen. */
|
|
55 int cursor_x;
|
|
56 int cursor_y;
|
|
57
|
|
58 /* Actual cursor position of this screen.
|
|
59 (Not used for terminal screens.) */
|
|
60 int phys_cursor_x;
|
|
61 int phys_cursor_y;
|
|
62
|
|
63 /* Size of this screen, in units of characters. */
|
|
64 int height;
|
|
65 int width;
|
|
66
|
|
67 /* New height and width for pending size change. 0 if no change pending. */
|
|
68 int new_height, new_width;
|
|
69
|
|
70 /* Name of this screen: a Lisp string. */
|
|
71 Lisp_Object name;
|
|
72
|
357
|
73 /* The screen which should recieve keystrokes that occur in this
|
|
74 screen. This is usually the screen itself, but if the screen is
|
|
75 minibufferless, this points to the minibuffer screen when it is
|
|
76 active. */
|
|
77 Lisp_Object focus_screen;
|
|
78
|
261
|
79 /* This screen's root window. Every screen has one.
|
|
80 If the screen has only a minibuffer window, this is it.
|
|
81 Otherwise, if the screen has a minibuffer window, this is its sibling. */
|
|
82 Lisp_Object root_window;
|
|
83
|
|
84 /* This screen's selected window.
|
|
85 Each screen has its own window hierarchy
|
|
86 and one of the windows in it is selected within the screen.
|
|
87 The selected window of the selected screen is Emacs's selected window. */
|
|
88 Lisp_Object selected_window;
|
|
89
|
|
90 /* This screen's minibuffer window.
|
|
91 Most screens have their own minibuffer windows,
|
|
92 but only the selected screen's minibuffer window
|
|
93 can actually appear to exist. */
|
|
94 Lisp_Object minibuffer_window;
|
|
95
|
|
96 /* Parameter alist of this screen.
|
|
97 These are the parameters specified when creating the screen
|
|
98 or modified with modify-screen-parameters. */
|
|
99 Lisp_Object param_alist;
|
|
100
|
|
101 /* The output method says how the contents of this screen
|
|
102 are displayed. It could be using termcap, or using an X window. */
|
|
103 enum output_method output_method;
|
|
104
|
|
105 /* A structure of auxiliary data used for displaying the contents.
|
|
106 struct x_display is used for X window screens;
|
|
107 it is defined in xterm.h. */
|
|
108 union display { struct x_display *x; int nothing; } display;
|
|
109
|
|
110 /* Nonzero if last attempt at redisplay on this screen was preempted. */
|
|
111 char display_preempted;
|
|
112
|
|
113 /* Nonzero if screen is currently displayed. */
|
|
114 char visible;
|
|
115
|
|
116 /* Nonzero if window is currently iconified.
|
|
117 This and visible are mutually exclusive. */
|
|
118 char iconified;
|
|
119
|
|
120 /* Nonzero if this screen should be redrawn. */
|
|
121 char garbaged;
|
|
122
|
|
123 /* True if screen actually has a minibuffer window on it.
|
|
124 0 if using a minibuffer window that isn't on this screen. */
|
|
125 char has_minibuffer;
|
|
126
|
|
127 /* 0 means, if this screen has just one window,
|
|
128 show no modeline for that window. */
|
|
129 char wants_modeline;
|
|
130
|
|
131 /* Non-0 means raise this screen to the top of the heap when selected. */
|
|
132 char auto_raise;
|
|
133
|
|
134 /* Non-0 means lower this screen to the bottom of the stack when left. */
|
|
135 char auto_lower;
|
|
136
|
|
137 /* True if screen's root window can't be split. */
|
|
138 char no_split;
|
|
139
|
|
140 /* Storage for messages to this screen. */
|
|
141 char *message_buf;
|
|
142
|
|
143 /* Nonnegative if current redisplay should not do scroll computation
|
|
144 for lines beyond a certain vpos. This is the vpos. */
|
|
145 int scroll_bottom_vpos;
|
|
146 };
|
|
147
|
|
148 typedef struct screen *SCREEN_PTR;
|
|
149
|
|
150 #define XSCREEN(p) ((struct screen *) XPNTR (p))
|
|
151 #define XSETSCREEN(p, v) ((struct screen *) XSETPNTR (p, v))
|
|
152
|
|
153 #define WINDOW_SCREEN(w) (w)->screen
|
|
154
|
|
155 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1, s->garbaged = 1)
|
|
156 #define SCREEN_IS_TERMCAP(s) ((s)->output_method == output_termcap)
|
|
157 #define SCREEN_IS_X(s) ((s)->output_method == output_x_window)
|
|
158 #define SCREEN_CURRENT_GLYPHS(s) (s)->current_glyphs
|
|
159 #define SCREEN_DESIRED_GLYPHS(s) (s)->desired_glyphs
|
|
160 #define SCREEN_TEMP_GLYPHS(s) (s)->temp_glyphs
|
|
161 #define SCREEN_HEIGHT(s) (s)->height
|
|
162 #define SCREEN_WIDTH(s) (s)->width
|
|
163 #define SCREEN_NEW_HEIGHT(s) (s)->new_height
|
|
164 #define SCREEN_NEW_WIDTH(s) (s)->new_width
|
|
165 #define SCREEN_CURSOR_X(s) (s)->cursor_x
|
|
166 #define SCREEN_CURSOR_Y(s) (s)->cursor_y
|
|
167 #define SCREEN_VISIBLE_P(s) (s)->visible
|
|
168 #define SCREEN_GARBAGED_P(s) (s)->garbaged
|
|
169 #define SCREEN_NO_SPLIT_P(s) (s)->no_split
|
|
170 #define SCREEN_WANTS_MODELINE_P(s) (s)->wants_modeline
|
|
171 #define SCREEN_ICONIFIED_P(s) (s)->iconified
|
|
172 #define SCREEN_MINIBUF_WINDOW(s) (s)->minibuffer_window
|
|
173 #define SCREEN_ROOT_WINDOW(s) (s)->root_window
|
|
174 #define SCREEN_SELECTED_WINDOW(s) (s)->selected_window
|
|
175 #define SCREENP(s) (XTYPE(s) == Lisp_Screen)
|
|
176 #define SET_GLYPHS_SCREEN(glyphs,screen) ((glyphs)->screen = (screen))
|
|
177 #define SCREEN_INSERT_COST(s) (s)->insert_line_cost
|
|
178 #define SCREEN_DELETE_COST(s) (s)->delete_line_cost
|
|
179 #define SCREEN_INSERTN_COST(s) (s)->insert_n_lines_cost
|
|
180 #define SCREEN_DELETEN_COST(s) (s)->delete_n_lines_cost
|
|
181 #define SCREEN_MESSAGE_BUF(s) (s)->message_buf
|
|
182 #define SCREEN_SCROLL_BOTTOM_VPOS(s) (s)->scroll_bottom_vpos
|
357
|
183 #define SCREEN_FOCUS_SCREEN(s) (s)->focus_screen
|
261
|
184
|
|
185 #define CHECK_SCREEN(x, i) \
|
|
186 { if (XTYPE ((x)) != Lisp_Screen) x = wrong_type_argument (Qscreenp, (x)); }
|
|
187 extern Lisp_Object Qscreenp;
|
|
188
|
|
189 extern struct screen *selected_screen;
|
357
|
190 extern struct screen *last_nonminibuf_screen;
|
261
|
191
|
|
192 extern struct screen *make_terminal_screen ();
|
|
193 extern struct screen *make_screen ();
|
|
194 extern struct screen *make_minibuffer_screen ();
|
|
195 extern struct screen *make_screen_without_minibuffer ();
|
|
196
|
|
197 extern Lisp_Object Vscreen_list;
|
|
198 extern Lisp_Object Vglobal_minibuffer_screen;
|
385
|
199 extern Lisp_Object Vdefault_screen_alist;
|
261
|
200
|
|
201 extern Lisp_Object Vterminal_screen;
|
|
202
|
|
203 #else /* not MULTI_SCREEN */
|
|
204
|
|
205 /* These definitions are used in a single-screen version of Emacs. */
|
|
206
|
|
207 #define SCREEN_PTR int
|
|
208
|
|
209 extern int selected_screen;
|
357
|
210 #define last_nonminibuf_screen selected_screen
|
261
|
211
|
|
212 #define XSCREEN(s) selected_screen
|
|
213 #define WINDOW_SCREEN(w) selected_screen
|
|
214
|
|
215 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1)
|
|
216 #define SCREEN_IS_TERMCAP(s) 1
|
|
217 #define SCREEN_CURRENT_GLYPHS(s) current_glyphs
|
|
218 #define SCREEN_DESIRED_GLYPHS(s) desired_glyphs
|
|
219 #define SCREEN_TEMP_GLYPHS(s) temp_glyphs
|
|
220 #define SCREEN_HEIGHT(s) screen_height
|
|
221 #define SCREEN_WIDTH(s) screen_width
|
|
222 #define SCREEN_NEW_HEIGHT(s) delayed_screen_height
|
|
223 #define SCREEN_NEW_WIDTH(s) delayed_screen_width
|
|
224 #define SCREEN_CURSOR_X(s) cursX
|
|
225 #define SCREEN_CURSOR_Y(s) cursY
|
|
226 #define SCREEN_VISIBLE_P(s) 1
|
|
227 #define SCREEN_GARBAGED_P(s) screen_garbaged
|
|
228 #define SCREEN_NO_SPLIT_P(s) 0
|
|
229 #define SCREEN_WANTS_MODELINE_P(s) 1
|
|
230 #define SCREEN_ICONIFIED_P(s) 0
|
|
231 #define SCREEN_MINIBUF_WINDOW(s) minibuf_window
|
|
232 #define SCREEN_ROOT_WINDOW(s) root_window
|
|
233 #define SCREEN_SELECTED_WINDOW(s) selected_window
|
|
234 #define SCREENP(s) 0
|
|
235 #define SET_GLYPHS_SCREEN(glyphs,screen)
|
|
236 #define SCREEN_INSERT_COST(screen) insert_line_cost
|
|
237 #define SCREEN_DELETE_COST(screen) delete_line_cost
|
|
238 #define SCREEN_INSERTN_COST(screen) insert_n_lines_cost
|
|
239 #define SCREEN_DELETEN_COST(screen) delete_n_lines_cost
|
|
240 #define SCREEN_MESSAGE_BUF(s) message_buf
|
357
|
241 #define SCREEN_SCROLL_BOTTOM_VPOS(s) scroll_bottom_vpos
|
|
242
|
|
243 #define CHECK_SCREEN(x, i) { ; }
|
261
|
244
|
|
245 extern int screen_width, screen_height;
|
|
246 extern int cursX, cursY;
|
|
247
|
|
248 #endif /* not MULTI_SCREEN */
|