comparison src/window.h @ 24996:429ec2c075e4

(struct window): Add vscroll. (struct window): New member cursor_off_p. (struct window): Remove phys_cursor_glyph. (struct window): New members phys_cursor_ascent and phys_cursor_descent. (struct window): New flag pseudo_window_p. (struct window): Add left_margin_width, right_margin_width. New member last_cursor. (WINDOW_LEFT_MARGIN): Remove FRAME_LEFT_SCROLL_BAR. (WINDOW_TO_FRAME_VPOS): Convert window vpos to frame vpos. (WINDOW_TO_FRAME_HPOS): Convert window hpos to frame hpos. (FRAME_TO_WINDOW_VPOS): Convert frame vpos to window vpos. (FRAME_TO_WINDOW_HPOS): Convert frame hpos to window hpos. (WINDOW_TOPMOST_P): Added. (struct window): Rewrittenf for new glyphs.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 21 Jul 1999 21:43:52 +0000
parents f4c17bc26d52
children 631f514ef580
comparison
equal deleted inserted replaced
24995:b52cdabf9253 24996:429ec2c075e4
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, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 #ifndef WINDOW_H_INCLUDED
22 #define WINDOW_H_INCLUDED
23
24 #include "dispextern.h"
21 25
22 /* Windows are allocated as if they were vectors, but then the 26 /* Windows are allocated as if they were vectors, but then the
23 Lisp data type is changed to Lisp_Window. They are garbage 27 Lisp data type is changed to Lisp_Window. They are garbage
24 collected along with the vectors. 28 collected along with the vectors.
25 29
69 the root window is the minibuf window. On minibufferless screens or 73 the root window is the minibuf window. On minibufferless screens or
70 minibuffer-only screens, the root window and the minibuffer window are 74 minibuffer-only screens, the root window and the minibuffer window are
71 one and the same, so its prev and next members are nil. 75 one and the same, so its prev and next members are nil.
72 76
73 A dead window has its buffer, hchild, and vchild windows all nil. */ 77 A dead window has its buffer, hchild, and vchild windows all nil. */
78
79 struct cursor_pos
80 {
81 /* Pixel position. These are always window relative. */
82 int x, y;
83
84 /* Glyph matrix position. */
85 int hpos, vpos;
86 };
74 87
75 struct window 88 struct window
76 { 89 {
77 /* The first two fields are really the header of a vector */ 90 /* The first two fields are really the header of a vector */
78 /* The window code does not refer to them. */ 91 /* The window code does not refer to them. */
137 scroll bars; it can store anything it likes here. If this 150 scroll bars; it can store anything it likes here. If this
138 window is newly created and we haven't displayed a scroll bar in 151 window is newly created and we haven't displayed a scroll bar in
139 it yet, or if the frame doesn't have any scroll bars, this is nil. */ 152 it yet, or if the frame doesn't have any scroll bars, this is nil. */
140 Lisp_Object vertical_scroll_bar; 153 Lisp_Object vertical_scroll_bar;
141 154
155 /* Width of left and right marginal areas. A value of nil means
156 no margin. */
157 Lisp_Object left_margin_width;
158 Lisp_Object right_margin_width;
159
142 /* The rest are currently not used or only half used */ 160 /* The rest are currently not used or only half used */
143 /* Frame coords of point at that time */
144 Lisp_Object last_point_x;
145 Lisp_Object last_point_y;
146 /* Frame coords of mark as of last time display completed */ 161 /* Frame coords of mark as of last time display completed */
147 /* May be nil if mark does not exist or was not on frame */ 162 /* May be nil if mark does not exist or was not on frame */
148 Lisp_Object last_mark_x; 163 Lisp_Object last_mark_x;
149 Lisp_Object last_mark_y; 164 Lisp_Object last_mark_y;
150 /* Number of characters in buffer past bottom of window, 165 /* Z - the buffer position of the last glyph in the current matrix
151 as of last redisplay that finished. */ 166 of W. Only valid if WINDOW_END_VALID is not nil. */
152 Lisp_Object window_end_pos; 167 Lisp_Object window_end_pos;
168 /* Glyph matrix row of the last glyph in the current matrix
169 of W. Only valid if WINDOW_END_VALID is not nil. */
170 Lisp_Object window_end_vpos;
153 /* t if window_end_pos is truly valid. 171 /* t if window_end_pos is truly valid.
154 This is nil if nontrivial redisplay is preempted 172 This is nil if nontrivial redisplay is preempted
155 since in that case the frame image that window_end_pos 173 since in that case the frame image that window_end_pos
156 did not get onto the frame. */ 174 did not get onto the frame. */
157 Lisp_Object window_end_valid; 175 Lisp_Object window_end_valid;
158 /* Vertical position (relative to window top) of that buffer position
159 of the first of those characters */
160 Lisp_Object window_end_vpos;
161 /* Non-nil means must regenerate mode line of this window */ 176 /* Non-nil means must regenerate mode line of this window */
162 Lisp_Object update_mode_line; 177 Lisp_Object update_mode_line;
163 /* Non-nil means current value of `start' 178 /* Non-nil means current value of `start'
164 was the beginning of a line when it was chosen. */ 179 was the beginning of a line when it was chosen. */
165 Lisp_Object start_at_line_beg; 180 Lisp_Object start_at_line_beg;
183 or nil if column numbers are not being displayed. */ 198 or nil if column numbers are not being displayed. */
184 Lisp_Object column_number_displayed; 199 Lisp_Object column_number_displayed;
185 /* If redisplay in this window goes beyond this buffer position, 200 /* If redisplay in this window goes beyond this buffer position,
186 must run the redisplay-end-trigger-hook. */ 201 must run the redisplay-end-trigger-hook. */
187 Lisp_Object redisplay_end_trigger; 202 Lisp_Object redisplay_end_trigger;
188 }; 203
204 /* No Lisp data may follow below this point without changing
205 mark_object in alloc.c. The member current_matrix must be the
206 first non-Lisp member. */
207
208 /* Glyph matrices. */
209 struct glyph_matrix *current_matrix;
210 struct glyph_matrix *desired_matrix;
211
212 /* Cursor position as of last update that completed without
213 pause. This is the position of last_point. */
214 struct cursor_pos last_cursor;
215
216 /* Intended cursor position. This is a position within the
217 glyph matrix. */
218 struct cursor_pos cursor;
219
220 /* Where the cursor actually is. */
221 struct cursor_pos phys_cursor;
222
223 /* Cursor type last drawn on the window. Used for X frames; -1
224 initially. */
225 int phys_cursor_type;
226
227 /* This is handy for undrawing the cursor. */
228 int phys_cursor_ascent, phys_cursor_height;
229
230 /* Non-zero means the cursor is currently displayed. This can be
231 set to zero by functions overpainting the cursor image. */
232 unsigned phys_cursor_on_p : 1;
233
234 /* 0 means cursor is logically on, 1 means it's off. Used for
235 blinking cursor. */
236 unsigned cursor_off_p : 1;
237
238 /* Value of cursor_off_p as of the last redisplay. */
239 unsigned last_cursor_off_p : 1;
240
241 /* 1 means desired matrix has been build and window must be
242 updated in update_frame. */
243 unsigned must_be_updated_p : 1;
244
245 /* Flag indicating that this window is not a real one.
246 Currently only used for menu bar windows of frames. */
247 unsigned pseudo_window_p : 1;
248
249 /* Amount by which lines of this window are scrolled in
250 y-direction (smooth scrolling). */
251 int vscroll;
252
253 /* Z_BYTE - the buffer position of the last glyph in the current matrix
254 of W. Only valid if WINDOW_END_VALID is not nil. */
255 int window_end_bytepos;
256 };
189 257
190 /* 1 if W is a minibuffer window. */ 258 /* 1 if W is a minibuffer window. */
191 259
192 #define MINI_WINDOW_P(W) (!EQ ((W)->mini_p, Qnil)) 260 #define MINI_WINDOW_P(W) (!EQ ((W)->mini_p, Qnil))
193 261
194 /* Return the frame column at which the text in window W starts. 262 /* Return the window column at which the text in window W starts.
195 This is different from the `left' field because it does not include 263 This is different from the `left' field because it does not include
196 a left-hand scroll bar if any. */ 264 a left-hand scroll bar if any. */
197 265
198 #define WINDOW_LEFT_MARGIN(W) \ 266 #define WINDOW_LEFT_MARGIN(W) \
199 (XFASTINT ((W)->left) \ 267 (XFASTINT ((W)->left) \
200 + FRAME_LEFT_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME (W)))) 268 + FRAME_LEFT_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME (W))))
201 269
202 /* Return the frame column before window W ends. 270 /* Return the window column before which window W ends.
203 This includes a right-hand scroll bar, if any. */ 271 This includes a right-hand scroll bar, if any. */
204 272
205 #define WINDOW_RIGHT_EDGE(W) \ 273 #define WINDOW_RIGHT_EDGE(W) \
206 (XFASTINT ((W)->left) + XFASTINT ((W)->width)) 274 (XFASTINT ((W)->left) + XFASTINT ((W)->width))
207 275
208 /* Return the frame column before which the text in window W ends. 276 /* Return the window column before which the text in window W ends.
209 This is different from WINDOW_RIGHT_EDGE because it does not include 277 This is different from WINDOW_RIGHT_EDGE because it does not include
210 a scroll bar or window-separating line on the right edge. */ 278 a scroll bar or window-separating line on the right edge. */
211 279
212 #define WINDOW_RIGHT_MARGIN(W) \ 280 #define WINDOW_RIGHT_MARGIN(W) \
213 (WINDOW_RIGHT_EDGE (W) \ 281 (WINDOW_RIGHT_EDGE (W) \
214 - (! FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (WINDOW_FRAME (W))) \ 282 - (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (XFRAME (WINDOW_FRAME (W))) \
215 ? ((WINDOW_RIGHTMOST_P (W)) ? 0 : 1) \ 283 ? FRAME_SCROLL_BAR_COLS (XFRAME (WINDOW_FRAME (W))) \
216 : FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (XFRAME (WINDOW_FRAME (W))) \ 284 : 0))
217 ? FRAME_SCROLL_BAR_COLS (XFRAME (WINDOW_FRAME (W))) \
218 : 0))
219 285
220 /* 1 if window W takes up the full width of its frame. */ 286 /* 1 if window W takes up the full width of its frame. */
221 287
222 #define WINDOW_FULL_WIDTH_P(W) \ 288 #define WINDOW_FULL_WIDTH_P(W) \
223 (XFASTINT ((W)->width) == FRAME_WINDOW_WIDTH (XFRAME (WINDOW_FRAME (W)))) 289 (XFASTINT ((W)->width) == FRAME_WINDOW_WIDTH (XFRAME (WINDOW_FRAME (W))))
225 /* 1 if window W's has no other windows to its right in its frame. */ 291 /* 1 if window W's has no other windows to its right in its frame. */
226 292
227 #define WINDOW_RIGHTMOST_P(W) \ 293 #define WINDOW_RIGHTMOST_P(W) \
228 (WINDOW_RIGHT_EDGE (W) == FRAME_WINDOW_WIDTH (XFRAME (WINDOW_FRAME (W)))) 294 (WINDOW_RIGHT_EDGE (W) == FRAME_WINDOW_WIDTH (XFRAME (WINDOW_FRAME (W))))
229 295
296
230 /* This is the window in which the terminal's cursor should 297 /* This is the window in which the terminal's cursor should
231 be left when nothing is being done with it. This must 298 be left when nothing is being done with it. This must
232 always be a leaf window, and its buffer is selected by 299 always be a leaf window, and its buffer is selected by
233 the top level editing loop at the end of each command. 300 the top level editing loop at the end of each command.
234 301
247 Note that you cannot test for minibufferness of an arbitrary window 314 Note that you cannot test for minibufferness of an arbitrary window
248 by comparing against this; use the MINI_WINDOW_P macro instead. */ 315 by comparing against this; use the MINI_WINDOW_P macro instead. */
249 316
250 extern Lisp_Object minibuf_window; 317 extern Lisp_Object minibuf_window;
251 318
252 /* Non-nil => window to for C-M-v to scroll 319 /* Non-nil => window to for C-M-v to scroll when the minibuffer is
253 when the minibuffer is selected. */ 320 selected. */
321
254 extern Lisp_Object Vminibuf_scroll_window; 322 extern Lisp_Object Vminibuf_scroll_window;
255 323
256 /* nil or a symbol naming the window system 324 /* Nil or a symbol naming the window system under which emacs is
257 under which emacs is running 325 running ('x is the only current possibility) */
258 ('x is the only current possibility) */ 326
259 extern Lisp_Object Vwindow_system; 327 extern Lisp_Object Vwindow_system;
260 328
261 /* Version number of X windows: 10, 11 or nil. */ 329 /* Version number of X windows: 10, 11 or nil. */
330
262 extern Lisp_Object Vwindow_system_version; 331 extern Lisp_Object Vwindow_system_version;
263 332
264 /* Window that the mouse is over (nil if no mouse support). */ 333 /* Window that the mouse is over (nil if no mouse support). */
334
265 extern Lisp_Object Vmouse_window; 335 extern Lisp_Object Vmouse_window;
266 336
267 /* Last mouse-click event (nil if no mouse support). */ 337 /* Last mouse-click event (nil if no mouse support). */
338
268 extern Lisp_Object Vmouse_event; 339 extern Lisp_Object Vmouse_event;
269 340
270 EXFUN (Fnext_window, 3); 341 EXFUN (Fnext_window, 3);
271 EXFUN (Fselect_window, 1); 342 EXFUN (Fselect_window, 1);
272 EXFUN (Fdisplay_buffer, 3); 343 EXFUN (Fdisplay_buffer, 3);
273 EXFUN (Fset_window_buffer, 2); 344 EXFUN (Fset_window_buffer, 2);
345 EXFUN (Fset_window_hscroll, 2);
346 EXFUN (Fwindow_hscroll, 1);
347 EXFUN (Fset_window_vscroll, 2);
348 EXFUN (Fwindow_vscroll, 1);
349 EXFUN (Fset_window_margins, 3);
274 extern Lisp_Object make_window P_ ((void)); 350 extern Lisp_Object make_window P_ ((void));
275 extern void delete_window P_ ((Lisp_Object)); 351 extern void delete_window P_ ((Lisp_Object));
276 extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int, int *)); 352 extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int, int *, int));
277 EXFUN (Fwindow_dedicated_p, 1); 353 EXFUN (Fwindow_dedicated_p, 1);
278 extern int window_height P_ ((Lisp_Object)); 354 extern int window_height P_ ((Lisp_Object));
279 extern int window_width P_ ((Lisp_Object)); 355 extern int window_width P_ ((Lisp_Object));
280 extern void set_window_height P_ ((Lisp_Object, int, int)); 356 extern void set_window_height P_ ((Lisp_Object, int, int));
281 extern void set_window_width P_ ((Lisp_Object, int, int)); 357 extern void set_window_width P_ ((Lisp_Object, int, int));
282 extern void change_window_height P_ ((int, int)); 358 extern void change_window_height P_ ((int, int));
283 extern void delete_all_subwindows P_ ((struct window *)); 359 extern void delete_all_subwindows P_ ((struct window *));
284 360
361 /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero
362 means it's allowed to run hooks. See make_frame for a case where
363 it's not allowed. */
364
365 void set_window_buffer P_ ((Lisp_Object window, Lisp_Object buffer,
366 int run_hooks_p));
367
285 /* Prompt to display in front of the minibuffer contents. */ 368 /* Prompt to display in front of the minibuffer contents. */
369
286 extern Lisp_Object minibuf_prompt; 370 extern Lisp_Object minibuf_prompt;
287 371
288 /* The visual width of the above. */ 372 /* The visual width of the above. */
373
289 extern int minibuf_prompt_width; 374 extern int minibuf_prompt_width;
290 375
291 /* Message to display instead of minibuffer contents. 376 /* Message to display instead of minibuffer contents. This is what
292 This is what the functions error and message make, 377 the functions error and message make, and command echoing uses it
293 and command echoing uses it as well. It overrides the 378 as well. It overrides the minibuf_prompt as well as the buffer. */
294 minibuf_prompt as well as the buffer. */ 379
295 extern char *echo_area_glyphs; 380 extern char *echo_area_glyphs;
296 381
382 /* A Lisp string to display instead of mini-buffer contents, analogous
383 to echo_area_glyphs. If this is a string, display that string.
384 Otherwise, if echo_area_glyphs is non-null, display that. */
385
386 extern Lisp_Object echo_area_message;
387
297 /* This is the length of the message in echo_area_glyphs. */ 388 /* This is the length of the message in echo_area_glyphs. */
389
298 extern int echo_area_glyphs_length; 390 extern int echo_area_glyphs_length;
299 391
300 /* Value of echo_area_glyphs when it was last acted on. 392 /* Value of echo_area_glyphs when it was last acted on. If this is
301 If this is nonzero, there is a message on the frame 393 nonzero, there is a message on the frame in the minibuffer and it
302 in the minibuffer and it should be erased as soon 394 should be erased as soon as it is no longer requested to appear. */
303 as it is no longer requested to appear. */ 395
304 extern char *previous_echo_glyphs; 396 extern char *previous_echo_glyphs;
305 397
306 /* This is the window where the echo area message was displayed. 398 extern Lisp_Object previous_echo_area_message;
307 It is always a minibuffer window, but it may not be the 399
308 same window currently active as a minibuffer. */ 400 /* This is the window where the echo area message was displayed. It
401 is always a minibuffer window, but it may not be the same window
402 currently active as a minibuffer. */
403
309 extern Lisp_Object echo_area_window; 404 extern Lisp_Object echo_area_window;
310 405
311 /* Depth in recursive edits. */ 406 /* Depth in recursive edits. */
407
312 extern int command_loop_level; 408 extern int command_loop_level;
313 409
314 /* Depth in minibuffer invocations. */ 410 /* Depth in minibuffer invocations. */
411
315 extern int minibuf_level; 412 extern int minibuf_level;
316 413
317 /* true iff we should redraw the mode lines on the next redisplay. */ 414 /* true iff we should redraw the mode lines on the next redisplay. */
415
318 extern int update_mode_lines; 416 extern int update_mode_lines;
319 417
320 /* Minimum value of GPT - BEG since last redisplay that finished. */ 418 /* Minimum value of GPT - BEG since last redisplay that finished. */
321 419
322 extern int beg_unchanged; 420 extern int beg_unchanged;
323 421
324 /* Minimum value of Z - GPT since last redisplay that finished. */ 422 /* Minimum value of Z - GPT since last redisplay that finished. */
325 423
326 extern int end_unchanged; 424 extern int end_unchanged;
327 425
328 /* MODIFF as of last redisplay that finished; 426 /* MODIFF as of last redisplay that finished; if it matches MODIFF,
329 if it matches MODIFF, beg_unchanged and end_unchanged 427 beg_unchanged and end_unchanged contain no useful information. */
330 contain no useful information. */ 428
331 extern int unchanged_modified; 429 extern int unchanged_modified;
332 430
333 /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that finished; 431 /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that
334 if it matches BUF_OVERLAY_MODIFF, beg_unchanged and end_unchanged 432 finished; if it matches BUF_OVERLAY_MODIFF, beg_unchanged and
335 contain no useful information. */ 433 end_unchanged contain no useful information. */
434
336 extern int overlay_unchanged_modified; 435 extern int overlay_unchanged_modified;
337 436
338 /* Nonzero if BEGV - BEG or Z - ZV of current buffer has changed 437 /* Nonzero if BEGV - BEG or Z - ZV of current buffer has changed since
339 since last redisplay that finished. */ 438 last redisplay that finished. */
439
340 extern int clip_changed; 440 extern int clip_changed;
341 441
342 /* Nonzero if window sizes or contents have changed 442 /* Nonzero if window sizes or contents have changed since last
343 since last redisplay that finished */ 443 redisplay that finished */
444
344 extern int windows_or_buffers_changed; 445 extern int windows_or_buffers_changed;
345 446
346 /* Number of windows displaying the selected buffer. 447 /* Number of windows displaying the selected buffer. Normally this is
347 Normally this is 1, but it can be more. */ 448 1, but it can be more. */
449
348 extern int buffer_shared; 450 extern int buffer_shared;
349 451
350 /* If *ROWS or *COLS are too small a size for FRAME, set them to the 452 /* If *ROWS or *COLS are too small a size for FRAME, set them to the
351 minimum allowable size. */ 453 minimum allowable size. */
454
352 extern void check_frame_size P_ ((struct frame *frame, int *rows, int *cols)); 455 extern void check_frame_size P_ ((struct frame *frame, int *rows, int *cols));
456
457 /* Return a pointer to the glyph W's physical cursor is on. Value is
458 null if W's current matrix is invalid, so that no meaningfull glyph
459 can be returned. */
460
461 struct glyph *get_phys_cursor_glyph P_ ((struct window *w));
462
463 #endif /* not WINDOW_H_INCLUDED */