Mercurial > hg > xemacs-beta
comparison src/window.c @ 185:3d6bfa290dbd r20-3b19
Import from CVS: tag r20-3b19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:55:28 +0200 |
parents | 8eaf7971accc |
children | a2f645c6b9f8 |
comparison
equal
deleted
inserted
replaced
184:bcd2674570bf | 185:3d6bfa290dbd |
---|---|
40 | 40 |
41 Lisp_Object Qwindowp, Qwindow_live_p; | 41 Lisp_Object Qwindowp, Qwindow_live_p; |
42 Lisp_Object Qwindow_configurationp; | 42 Lisp_Object Qwindow_configurationp; |
43 Lisp_Object Qscroll_up; | 43 Lisp_Object Qscroll_up; |
44 Lisp_Object Qscroll_down; | 44 Lisp_Object Qscroll_down; |
45 Lisp_Object Qtemp_buffer_show_hook; | |
46 Lisp_Object Qdisplay_buffer; | 45 Lisp_Object Qdisplay_buffer; |
47 | 46 |
48 #ifdef MEMORY_USAGE_STATS | 47 #ifdef MEMORY_USAGE_STATS |
49 Lisp_Object Qface_cache; | 48 Lisp_Object Qface_cache; |
50 Lisp_Object Qglyph_cache; | 49 Lisp_Object Qglyph_cache; |
222 char buf[200]; | 221 char buf[200]; |
223 | 222 |
224 if (print_readably) | 223 if (print_readably) |
225 error ("printing unreadable object #<window 0x%x>", | 224 error ("printing unreadable object #<window 0x%x>", |
226 XWINDOW (obj)->header.uid); | 225 XWINDOW (obj)->header.uid); |
227 | 226 |
228 write_c_string ("#<window", printcharfun); | 227 write_c_string ("#<window", printcharfun); |
229 if (!NILP (XWINDOW (obj)->buffer)) | 228 if (!NILP (XWINDOW (obj)->buffer)) |
230 { | 229 { |
231 Lisp_Object name = XBUFFER (XWINDOW (obj)->buffer)->name; | 230 Lisp_Object name = XBUFFER (XWINDOW (obj)->buffer)->name; |
232 write_c_string (" on ", printcharfun); | 231 write_c_string (" on ", printcharfun); |
287 reset_face_cachels will fail. */ | 286 reset_face_cachels will fail. */ |
288 Lisp_Object | 287 Lisp_Object |
289 allocate_window (void) | 288 allocate_window (void) |
290 { | 289 { |
291 Lisp_Object val = Qnil; | 290 Lisp_Object val = Qnil; |
292 struct window *p = alloc_lcrecord (sizeof (struct window), | 291 struct window *p = alloc_lcrecord_type (struct window, lrecord_window); |
293 lrecord_window); | |
294 | 292 |
295 zero_lcrecord (p); | 293 zero_lcrecord (p); |
296 XSETWINDOW (val, p); | 294 XSETWINDOW (val, p); |
297 | 295 |
298 p->dead = 0; | 296 p->dead = 0; |
299 p->frame = Qnil; | 297 p->frame = Qnil; |
300 p->mini_p = Qnil; | 298 p->mini_p = Qnil; |
301 p->next = Qnil; | 299 p->next = Qnil; |
302 p->prev = Qnil; | 300 p->prev = Qnil; |
303 p->hchild = Qnil; | 301 p->hchild = Qnil; |
304 p->vchild = Qnil; | 302 p->vchild = Qnil; |
305 p->parent = Qnil; | 303 p->parent = Qnil; |
306 p->buffer = Qnil; | 304 p->buffer = Qnil; |
307 INIT_DISP_VARIABLE (start, Fmake_marker ()); | 305 INIT_DISP_VARIABLE (start, Fmake_marker ()); |
308 INIT_DISP_VARIABLE (pointm, Fmake_marker ()); | 306 INIT_DISP_VARIABLE (pointm, Fmake_marker ()); |
309 p->sb_point = Fmake_marker (); | 307 p->sb_point = Fmake_marker (); |
310 p->use_time = Qzero; | 308 p->use_time = Qzero; |
311 INIT_DISP_VARIABLE (last_modified, Qzero); | 309 INIT_DISP_VARIABLE (last_modified, Qzero); |
312 INIT_DISP_VARIABLE (last_point, Fmake_marker ()); | 310 INIT_DISP_VARIABLE (last_point, Fmake_marker ()); |
313 INIT_DISP_VARIABLE (last_start, Fmake_marker ()); | 311 INIT_DISP_VARIABLE (last_start, Fmake_marker ()); |
314 INIT_DISP_VARIABLE (last_facechange, Qzero); | 312 INIT_DISP_VARIABLE (last_facechange, Qzero); |
315 p->face_cachels = Dynarr_new (struct face_cachel); | 313 p->face_cachels = Dynarr_new (face_cachel); |
316 p->glyph_cachels = Dynarr_new (struct glyph_cachel); | 314 p->glyph_cachels = Dynarr_new (glyph_cachel); |
317 p->line_start_cache = Dynarr_new (struct line_start_cache); | 315 p->line_start_cache = Dynarr_new (line_start_cache); |
318 p->line_cache_last_updated = Qzero; | 316 p->line_cache_last_updated = Qzero; |
319 INIT_DISP_VARIABLE (last_point_x, 0); | 317 INIT_DISP_VARIABLE (last_point_x, 0); |
320 INIT_DISP_VARIABLE (last_point_y, 0); | 318 INIT_DISP_VARIABLE (last_point_y, 0); |
321 INIT_DISP_VARIABLE (window_end_pos, 0); | 319 INIT_DISP_VARIABLE (window_end_pos, 0); |
322 p->redisplay_end_trigger = Qnil; | 320 p->redisplay_end_trigger = Qnil; |
379 /* Create a new window mirror structure and associated redisplay | 377 /* Create a new window mirror structure and associated redisplay |
380 structs. */ | 378 structs. */ |
381 static struct window_mirror * | 379 static struct window_mirror * |
382 new_window_mirror (struct frame *f) | 380 new_window_mirror (struct frame *f) |
383 { | 381 { |
384 struct window_mirror *t; | 382 struct window_mirror *t = xnew_and_zero (struct window_mirror); |
385 | |
386 t = (struct window_mirror *) | |
387 xmalloc (sizeof (struct window_mirror)); | |
388 memset (t, 0, sizeof (struct window_mirror)); | |
389 | 383 |
390 t->frame = f; | 384 t->frame = f; |
391 | 385 |
392 t->current_display_lines = Dynarr_new (struct display_line); | 386 t->current_display_lines = Dynarr_new (display_line); |
393 t->desired_display_lines = Dynarr_new (struct display_line); | 387 t->desired_display_lines = Dynarr_new (display_line); |
394 t->buffer = NULL; | 388 t->buffer = NULL; |
395 | 389 |
396 #ifdef HAVE_SCROLLBARS | 390 #ifdef HAVE_SCROLLBARS |
397 t->scrollbar_vertical_instance = NULL; | 391 t->scrollbar_vertical_instance = NULL; |
398 t->scrollbar_horizontal_instance = NULL; | 392 t->scrollbar_horizontal_instance = NULL; |
436 { | 430 { |
437 /* The redisplay structures are big. Leaving them around in | 431 /* The redisplay structures are big. Leaving them around in |
438 non-leaf windows can add up to a lot of wasted space. So | 432 non-leaf windows can add up to a lot of wasted space. So |
439 don't do it. */ | 433 don't do it. */ |
440 free_display_structs (mir); | 434 free_display_structs (mir); |
441 mir->current_display_lines = Dynarr_new (struct display_line); | 435 mir->current_display_lines = Dynarr_new (display_line); |
442 mir->desired_display_lines = Dynarr_new (struct display_line); | 436 mir->desired_display_lines = Dynarr_new (display_line); |
443 | 437 |
444 #ifdef HAVE_SCROLLBARS | 438 #ifdef HAVE_SCROLLBARS |
445 update_window_scrollbars (XWINDOW (win), mir, 0, 0); | 439 update_window_scrollbars (XWINDOW (win), mir, 0, 0); |
446 #endif | 440 #endif |
447 mir->buffer = NULL; | 441 mir->buffer = NULL; |
1025 } | 1019 } |
1026 | 1020 |
1027 int | 1021 int |
1028 window_bottom_gutter_height (struct window *w) | 1022 window_bottom_gutter_height (struct window *w) |
1029 { | 1023 { |
1030 int other_height; | 1024 int other_height; |
1031 | 1025 |
1032 if (!NILP (w->hchild) || !NILP (w->vchild)) | 1026 if (!NILP (w->hchild) || !NILP (w->vchild)) |
1033 return 0; | 1027 return 0; |
1034 else | 1028 else |
1035 other_height = | 1029 other_height = |
1406 VALUE should be a buffer position (typically a marker) or nil. | 1400 VALUE should be a buffer position (typically a marker) or nil. |
1407 If it is a buffer position, then if redisplay in WINDOW reaches a position | 1401 If it is a buffer position, then if redisplay in WINDOW reaches a position |
1408 beyond VALUE, the functions in `redisplay-end-trigger-functions' are called | 1402 beyond VALUE, the functions in `redisplay-end-trigger-functions' are called |
1409 with two arguments: WINDOW, and the end trigger value. | 1403 with two arguments: WINDOW, and the end trigger value. |
1410 Afterwards the end-trigger value is reset to nil. | 1404 Afterwards the end-trigger value is reset to nil. |
1411 */ | 1405 */ |
1412 (window, value)) | 1406 (window, value)) |
1413 { | 1407 { |
1414 return (decode_window (window)->redisplay_end_trigger = value); | 1408 return (decode_window (window)->redisplay_end_trigger = value); |
1415 } | 1409 } |
1416 | 1410 |
1752 So, we check by scanning all the ancestors of the | 1746 So, we check by scanning all the ancestors of the |
1753 frame's selected window and comparing each one with | 1747 frame's selected window and comparing each one with |
1754 WINDOW. */ | 1748 WINDOW. */ |
1755 { | 1749 { |
1756 Lisp_Object pwindow; | 1750 Lisp_Object pwindow; |
1757 | 1751 |
1758 pwindow = FRAME_SELECTED_WINDOW (f); | 1752 pwindow = FRAME_SELECTED_WINDOW (f); |
1759 | 1753 |
1760 while (!NILP (pwindow)) | 1754 while (!NILP (pwindow)) |
1761 { | 1755 { |
1762 if (EQ (window, pwindow)) | 1756 if (EQ (window, pwindow)) |
1763 break; | 1757 break; |
1764 pwindow = XWINDOW (pwindow)->parent; | 1758 pwindow = XWINDOW (pwindow)->parent; |
1767 if (EQ (window, pwindow)) | 1761 if (EQ (window, pwindow)) |
1768 { | 1762 { |
1769 /* OK, we found it. */ | 1763 /* OK, we found it. */ |
1770 Lisp_Object alternative; | 1764 Lisp_Object alternative; |
1771 alternative = Fnext_window (window, Qlambda, Qnil, Qnil); | 1765 alternative = Fnext_window (window, Qlambda, Qnil, Qnil); |
1772 | 1766 |
1773 /* If we're about to delete the selected window on the | 1767 /* If we're about to delete the selected window on the |
1774 selected frame, then we should use Fselect_window to select | 1768 selected frame, then we should use Fselect_window to select |
1775 the new window. On the other hand, if we're about to | 1769 the new window. On the other hand, if we're about to |
1776 delete the selected window on any other frame, we shouldn't do | 1770 delete the selected window on any other frame, we shouldn't do |
1777 anything but set the frame's selected_window slot. */ | 1771 anything but set the frame's selected_window slot. */ |
1796 unchain_marker (w->sb_point); | 1790 unchain_marker (w->sb_point); |
1797 /* This breaks set-window-configuration if windows in the saved | 1791 /* This breaks set-window-configuration if windows in the saved |
1798 configuration get deleted and multiple frames are in use. */ | 1792 configuration get deleted and multiple frames are in use. */ |
1799 /* w->buffer = Qnil; */ | 1793 /* w->buffer = Qnil; */ |
1800 } | 1794 } |
1801 | 1795 |
1802 /* close up the hole in the sibling list */ | 1796 /* close up the hole in the sibling list */ |
1803 if (!NILP (w->next)) | 1797 if (!NILP (w->next)) |
1804 XWINDOW (w->next)->prev = w->prev; | 1798 XWINDOW (w->next)->prev = w->prev; |
1805 if (!NILP (w->prev)) | 1799 if (!NILP (w->prev)) |
1806 XWINDOW (w->prev)->next = w->next; | 1800 XWINDOW (w->prev)->next = w->next; |
1820 children. */ | 1814 children. */ |
1821 sib = w->next; | 1815 sib = w->next; |
1822 WINDOW_TOP (XWINDOW (sib)) = WINDOW_TOP (w); | 1816 WINDOW_TOP (XWINDOW (sib)) = WINDOW_TOP (w); |
1823 WINDOW_LEFT (XWINDOW (sib)) = WINDOW_LEFT (w); | 1817 WINDOW_LEFT (XWINDOW (sib)) = WINDOW_LEFT (w); |
1824 } | 1818 } |
1825 | 1819 |
1826 /* Stretch that sibling. */ | 1820 /* Stretch that sibling. */ |
1827 if (!NILP (par->vchild)) | 1821 if (!NILP (par->vchild)) |
1828 set_window_pixheight | 1822 set_window_pixheight |
1829 (sib, (WINDOW_HEIGHT (XWINDOW (sib)) + WINDOW_HEIGHT (w)), 1); | 1823 (sib, (WINDOW_HEIGHT (XWINDOW (sib)) + WINDOW_HEIGHT (w)), 1); |
1830 if (!NILP (par->hchild)) | 1824 if (!NILP (par->hchild)) |
2277 GET_BUFFER_MRU_WINDOW /* Arg is buffer */ | 2271 GET_BUFFER_MRU_WINDOW /* Arg is buffer */ |
2278 }; | 2272 }; |
2279 | 2273 |
2280 static Lisp_Object | 2274 static Lisp_Object |
2281 window_loop (enum window_loop type, | 2275 window_loop (enum window_loop type, |
2282 Lisp_Object obj, | 2276 Lisp_Object obj, |
2283 int mini, | 2277 int mini, |
2284 Lisp_Object frames, | 2278 Lisp_Object frames, |
2285 int dedicated_too, | 2279 int dedicated_too, |
2286 Lisp_Object console) | 2280 Lisp_Object console) |
2287 { | 2281 { |
2294 Lisp_Object frame_arg = Qt; | 2288 Lisp_Object frame_arg = Qt; |
2295 int count = 0; /* for GET_BUFFER_WINDOW_COUNT */ | 2289 int count = 0; /* for GET_BUFFER_WINDOW_COUNT */ |
2296 /* #### I think the change of "precomputing" last_window and next_window | 2290 /* #### I think the change of "precomputing" last_window and next_window |
2297 * #### catch the lossage this is meant(?) to punt on... | 2291 * #### catch the lossage this is meant(?) to punt on... |
2298 */ | 2292 */ |
2299 int lose_lose = 0; | 2293 int lose_lose = 0; |
2300 Lisp_Object devcons, concons; | 2294 Lisp_Object devcons, concons; |
2301 | 2295 |
2302 /* FRAME_ARG is Qlambda to stick to one frame, | 2296 /* FRAME_ARG is Qlambda to stick to one frame, |
2303 Qvisible to consider all visible frames, | 2297 Qvisible to consider all visible frames, |
2304 or Qt otherwise. */ | 2298 or Qt otherwise. */ |
2317 frame_arg = Qlambda; | 2311 frame_arg = Qlambda; |
2318 else if (ZEROP (frames)) | 2312 else if (ZEROP (frames)) |
2319 frame_arg = frames; | 2313 frame_arg = frames; |
2320 else if (EQ (frames, Qvisible)) | 2314 else if (EQ (frames, Qvisible)) |
2321 frame_arg = frames; | 2315 frame_arg = frames; |
2322 | 2316 |
2323 DEVICE_LOOP_NO_BREAK (devcons, concons) | 2317 DEVICE_LOOP_NO_BREAK (devcons, concons) |
2324 { | 2318 { |
2325 Lisp_Object device = XCAR (devcons); | 2319 Lisp_Object device = XCAR (devcons); |
2326 Lisp_Object the_frame = Qnil; | 2320 Lisp_Object the_frame = Qnil; |
2327 | 2321 |
2360 /* Pick the next window now, since some operations will delete | 2354 /* Pick the next window now, since some operations will delete |
2361 the current window. */ | 2355 the current window. */ |
2362 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg, Qt); | 2356 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg, Qt); |
2363 | 2357 |
2364 /* #### Still needed ?? */ | 2358 /* #### Still needed ?? */ |
2365 /* Given the outstanding quality of the rest of this code, | 2359 /* Given the outstanding quality of the rest of this code, |
2366 I feel no shame about putting this piece of shit in. */ | 2360 I feel no shame about putting this piece of shit in. */ |
2367 if (++lose_lose >= 500) | 2361 if (++lose_lose >= 500) |
2368 return Qnil; | 2362 return Qnil; |
2369 | 2363 |
2370 /* Note that we do not pay attention here to whether | 2364 /* Note that we do not pay attention here to whether |
2554 } | 2548 } |
2555 } | 2549 } |
2556 break; | 2550 break; |
2557 } | 2551 } |
2558 | 2552 |
2559 default: | 2553 default: |
2560 abort (); | 2554 abort (); |
2561 } | 2555 } |
2562 | 2556 |
2563 if (EQ (w, last_window)) | 2557 if (EQ (w, last_window)) |
2564 break; | 2558 break; |
2585 } | 2579 } |
2586 | 2580 |
2587 int | 2581 int |
2588 buffer_window_mru (struct window *w) | 2582 buffer_window_mru (struct window *w) |
2589 { | 2583 { |
2590 Lisp_Object window = | 2584 Lisp_Object window = |
2591 window_loop (GET_BUFFER_MRU_WINDOW, w->buffer, 0, w->frame, 1, Qnil); | 2585 window_loop (GET_BUFFER_MRU_WINDOW, w->buffer, 0, w->frame, 1, Qnil); |
2592 | 2586 |
2593 if (NILP (window)) | 2587 if (NILP (window)) |
2594 return 0; | 2588 return 0; |
2595 else if (XWINDOW (window) == w) | 2589 else if (XWINDOW (window) == w) |
3075 */ | 3069 */ |
3076 (window)) | 3070 (window)) |
3077 { | 3071 { |
3078 struct window *w; | 3072 struct window *w; |
3079 Lisp_Object old_selected_window = Fselected_window (Qnil); | 3073 Lisp_Object old_selected_window = Fselected_window (Qnil); |
3080 | 3074 |
3081 CHECK_LIVE_WINDOW (window); | 3075 CHECK_LIVE_WINDOW (window); |
3082 w = XWINDOW (window); | 3076 w = XWINDOW (window); |
3083 | 3077 |
3084 /* we have already caught dead-window errors */ | 3078 /* we have already caught dead-window errors */ |
3085 if (!NILP (w->hchild) || !NILP (w->vchild)) | 3079 if (!NILP (w->hchild) || !NILP (w->vchild)) |
3107 MARK_WINDOWS_CHANGED (ow); | 3101 MARK_WINDOWS_CHANGED (ow); |
3108 } | 3102 } |
3109 | 3103 |
3110 /* now select the window's frame */ | 3104 /* now select the window's frame */ |
3111 set_frame_selected_window (XFRAME (WINDOW_FRAME (w)), window); | 3105 set_frame_selected_window (XFRAME (WINDOW_FRAME (w)), window); |
3112 | 3106 |
3113 select_frame_1 (WINDOW_FRAME (w)); | 3107 select_frame_1 (WINDOW_FRAME (w)); |
3114 | 3108 |
3115 /* also select the window's buffer */ | 3109 /* also select the window's buffer */ |
3116 Frecord_buffer (w->buffer); | 3110 Frecord_buffer (w->buffer); |
3117 Fset_buffer (w->buffer); | 3111 Fset_buffer (w->buffer); |
3174 w->hscroll = 0; | 3168 w->hscroll = 0; |
3175 set_marker_restricted (w->start[CURRENT_DISP], make_int (1), buf); | 3169 set_marker_restricted (w->start[CURRENT_DISP], make_int (1), buf); |
3176 set_marker_restricted (w->pointm[CURRENT_DISP], make_int (1), buf); | 3170 set_marker_restricted (w->pointm[CURRENT_DISP], make_int (1), buf); |
3177 set_marker_restricted (w->sb_point, make_int (1), buf); | 3171 set_marker_restricted (w->sb_point, make_int (1), buf); |
3178 | 3172 |
3179 /* Run temp-buffer-show-hook, with the chosen window selected. */ | 3173 /* Run temp-buffer-show-hook, with the chosen window selected. */ |
3180 if (!preparing_for_armageddon) | 3174 if (!preparing_for_armageddon) |
3181 { | 3175 { |
3182 Lisp_Object tem; | 3176 Lisp_Object tem; |
3183 tem = Fboundp (Qtemp_buffer_show_hook); | 3177 tem = Fboundp (Qtemp_buffer_show_hook); |
3184 if (!NILP (tem)) | 3178 if (!NILP (tem)) |
3205 static void | 3199 static void |
3206 make_dummy_parent (Lisp_Object window) | 3200 make_dummy_parent (Lisp_Object window) |
3207 { | 3201 { |
3208 Lisp_Object new = Qnil; | 3202 Lisp_Object new = Qnil; |
3209 struct window *o = XWINDOW (window); | 3203 struct window *o = XWINDOW (window); |
3210 struct window *p = alloc_lcrecord (sizeof (struct window), | 3204 struct window *p = alloc_lcrecord_type (struct window, lrecord_window); |
3211 lrecord_window); | |
3212 | 3205 |
3213 XSETWINDOW (new, p); | 3206 XSETWINDOW (new, p); |
3214 copy_lcrecord (p, o); | 3207 copy_lcrecord (p, o); |
3215 | 3208 |
3216 /* Don't copy the pointers to the line start cache or the face | 3209 /* Don't copy the pointers to the line start cache or the face |
3217 instances. */ | 3210 instances. */ |
3218 p->line_start_cache = Dynarr_new (struct line_start_cache); | 3211 p->line_start_cache = Dynarr_new (line_start_cache); |
3219 p->face_cachels = Dynarr_new (struct face_cachel); | 3212 p->face_cachels = Dynarr_new (face_cachel); |
3220 p->glyph_cachels = Dynarr_new (struct glyph_cachel); | 3213 p->glyph_cachels = Dynarr_new (glyph_cachel); |
3221 | 3214 |
3222 /* Put new into window structure in place of window */ | 3215 /* Put new into window structure in place of window */ |
3223 replace_window (window, new); | 3216 replace_window (window, new); |
3224 | 3217 |
3225 o->next = Qnil; | 3218 o->next = Qnil; |
3295 if (NILP (horflag)) | 3288 if (NILP (horflag)) |
3296 { | 3289 { |
3297 if (size < window_min_height) | 3290 if (size < window_min_height) |
3298 error ("Window height %d too small (after splitting)", size); | 3291 error ("Window height %d too small (after splitting)", size); |
3299 if (size + window_min_height > window_char_height (o, 1)) | 3292 if (size + window_min_height > window_char_height (o, 1)) |
3300 error ("Window height %d too small (after splitting)", | 3293 error ("Window height %d too small (after splitting)", |
3301 window_char_height (o, 1) - size); | 3294 window_char_height (o, 1) - size); |
3302 if (NILP (o->parent) | 3295 if (NILP (o->parent) |
3303 || NILP (XWINDOW (o->parent)->vchild)) | 3296 || NILP (XWINDOW (o->parent)->vchild)) |
3304 { | 3297 { |
3305 make_dummy_parent (window); | 3298 make_dummy_parent (window); |
3312 else | 3305 else |
3313 { | 3306 { |
3314 if (size < window_min_width) | 3307 if (size < window_min_width) |
3315 error ("Window width %d too small (after splitting)", size); | 3308 error ("Window width %d too small (after splitting)", size); |
3316 if (size + window_min_width > window_char_width (o, 0)) | 3309 if (size + window_min_width > window_char_width (o, 0)) |
3317 error ("Window width %d too small (after splitting)", | 3310 error ("Window width %d too small (after splitting)", |
3318 window_char_width (o, 0) - size); | 3311 window_char_width (o, 0) - size); |
3319 if (NILP (o->parent) | 3312 if (NILP (o->parent) |
3320 || NILP (XWINDOW (o->parent)->hchild)) | 3313 || NILP (XWINDOW (o->parent)->hchild)) |
3321 { | 3314 { |
3322 make_dummy_parent (window); | 3315 make_dummy_parent (window); |
3344 p->parent = o->parent; | 3337 p->parent = o->parent; |
3345 p->buffer = Qt; | 3338 p->buffer = Qt; |
3346 | 3339 |
3347 reset_face_cachels (p); | 3340 reset_face_cachels (p); |
3348 reset_glyph_cachels (p); | 3341 reset_glyph_cachels (p); |
3349 | 3342 |
3350 | 3343 |
3351 /* Apportion the available frame space among the two new windows */ | 3344 /* Apportion the available frame space among the two new windows */ |
3352 | 3345 |
3353 if (!NILP (horflag)) | 3346 if (!NILP (horflag)) |
3354 { | 3347 { |
3415 { | 3408 { |
3416 int avail_height; | 3409 int avail_height; |
3417 int defheight, defwidth; | 3410 int defheight, defwidth; |
3418 int char_height; | 3411 int char_height; |
3419 Lisp_Object window; | 3412 Lisp_Object window; |
3420 | 3413 |
3421 XSETWINDOW (window, w); | 3414 XSETWINDOW (window, w); |
3422 | 3415 |
3423 avail_height = (pixel_height - | 3416 avail_height = (pixel_height - |
3424 (include_gutters_p ? 0 : | 3417 (include_gutters_p ? 0 : |
3425 window_top_gutter_height (w) + | 3418 window_top_gutter_height (w) + |
3426 window_bottom_gutter_height (w))); | 3419 window_bottom_gutter_height (w))); |
3427 | 3420 |
3428 default_face_height_and_width (window, &defheight, &defwidth); | 3421 default_face_height_and_width (window, &defheight, &defwidth); |
3429 | 3422 |
3430 char_height = avail_height / defheight; | 3423 char_height = avail_height / defheight; |
3431 | 3424 |
3432 /* It's the calling function's responsibility to check these values | 3425 /* It's the calling function's responsibility to check these values |
3447 int avail_height; | 3440 int avail_height; |
3448 int defheight, defwidth; | 3441 int defheight, defwidth; |
3449 int pixel_height; | 3442 int pixel_height; |
3450 | 3443 |
3451 Lisp_Object window; | 3444 Lisp_Object window; |
3452 | 3445 |
3453 XSETWINDOW (window, w); | 3446 XSETWINDOW (window, w); |
3454 | 3447 |
3455 default_face_height_and_width (window, &defheight, &defwidth); | 3448 default_face_height_and_width (window, &defheight, &defwidth); |
3456 | 3449 |
3457 avail_height = char_height * defheight; | 3450 avail_height = char_height * defheight; |
3458 pixel_height = (avail_height + | 3451 pixel_height = (avail_height + |
3459 (include_gutters_p ? 0 : | 3452 (include_gutters_p ? 0 : |
3564 { | 3557 { |
3565 int avail_width; | 3558 int avail_width; |
3566 int char_width; | 3559 int char_width; |
3567 int defheight, defwidth; | 3560 int defheight, defwidth; |
3568 Lisp_Object window; | 3561 Lisp_Object window; |
3569 | 3562 |
3570 XSETWINDOW (window, w); | 3563 XSETWINDOW (window, w); |
3571 | 3564 |
3572 avail_width = (pixel_width - | 3565 avail_width = (pixel_width - |
3573 window_left_gutter_width (w, 0) - | 3566 window_left_gutter_width (w, 0) - |
3574 window_right_gutter_width (w, 0) - | 3567 window_right_gutter_width (w, 0) - |
3575 (include_margins_p ? 0 : window_left_margin_width (w)) - | 3568 (include_margins_p ? 0 : window_left_margin_width (w)) - |
3576 (include_margins_p ? 0 : window_right_margin_width (w))); | 3569 (include_margins_p ? 0 : window_right_margin_width (w))); |
3577 | 3570 |
3578 default_face_height_and_width (window, &defheight, &defwidth); | 3571 default_face_height_and_width (window, &defheight, &defwidth); |
3579 | 3572 |
3580 char_width = (avail_width / defwidth); | 3573 char_width = (avail_width / defwidth); |
3581 | 3574 |
3582 /* It's the calling function's responsibility to check these values | 3575 /* It's the calling function's responsibility to check these values |
3583 and make sure they're not out of range. | 3576 and make sure they're not out of range. |
3584 | 3577 |
3723 ? (*sizefun) (parent) - *sizep | 3716 ? (*sizefun) (parent) - *sizep |
3724 : ((!NILP (w->next)) | 3717 : ((!NILP (w->next)) |
3725 ? (*sizefun) (w->next) - MINSIZE (w->next) | 3718 ? (*sizefun) (w->next) - MINSIZE (w->next) |
3726 : ((!NILP (w->prev)) | 3719 : ((!NILP (w->prev)) |
3727 ? (*sizefun) (w->prev) - MINSIZE (w->prev) | 3720 ? (*sizefun) (w->prev) - MINSIZE (w->prev) |
3728 /* This is a frame with only one window, | 3721 /* This is a frame with only one window, |
3729 a minibuffer-only or a minibufferless frame. */ | 3722 a minibuffer-only or a minibufferless frame. */ |
3730 : (delta = 0)))); | 3723 : (delta = 0)))); |
3731 | 3724 |
3732 if (delta > maxdelta) | 3725 if (delta > maxdelta) |
3733 /* This case traps trying to make the minibuffer | 3726 /* This case traps trying to make the minibuffer |
4038 window_scroll (Fselected_window (Qnil), n, -1, errb); | 4031 window_scroll (Fselected_window (Qnil), n, -1, errb); |
4039 return Qnil; | 4032 return Qnil; |
4040 } | 4033 } |
4041 | 4034 |
4042 DEFUN ("other-window-for-scrolling", Fother_window_for_scrolling, 0, 0, 0, /* | 4035 DEFUN ("other-window-for-scrolling", Fother_window_for_scrolling, 0, 0, 0, /* |
4043 Return the other window for \"other window scroll\" commands. | 4036 Return the other window for "other window scroll" commands. |
4044 If in the minibuffer, `minibuffer-scroll-window' if non-nil | 4037 If in the minibuffer, `minibuffer-scroll-window' if non-nil |
4045 specifies the window. | 4038 specifies the window. |
4046 If `other-window-scroll-buffer' is non-nil, a window | 4039 If `other-window-scroll-buffer' is non-nil, a window |
4047 showing that buffer is used. | 4040 showing that buffer is used. |
4048 */ | 4041 */ |
4178 | 4171 |
4179 startp = start_with_point_on_display_line (w, opoint, XINT (n)); | 4172 startp = start_with_point_on_display_line (w, opoint, XINT (n)); |
4180 } | 4173 } |
4181 | 4174 |
4182 Fset_marker (w->start[CURRENT_DISP], make_int (startp), w->buffer); | 4175 Fset_marker (w->start[CURRENT_DISP], make_int (startp), w->buffer); |
4183 | 4176 |
4184 w->start_at_line_beg = beginning_of_line_p (b, startp); | 4177 w->start_at_line_beg = beginning_of_line_p (b, startp); |
4185 w->force_start = 1; | 4178 w->force_start = 1; |
4186 MARK_WINDOWS_CHANGED (w); | 4179 MARK_WINDOWS_CHANGED (w); |
4187 return Qnil; | 4180 return Qnil; |
4188 } | 4181 } |
4306 static int | 4299 static int |
4307 map_windows_1 (Lisp_Object window, | 4300 map_windows_1 (Lisp_Object window, |
4308 int (*mapfun) (struct window *w, void *closure), | 4301 int (*mapfun) (struct window *w, void *closure), |
4309 void *closure) | 4302 void *closure) |
4310 { | 4303 { |
4311 int retval; | 4304 int retval; |
4312 | 4305 |
4313 for (; !NILP (window); window = XWINDOW (window)->next) | 4306 for (; !NILP (window); window = XWINDOW (window)->next) |
4314 { | 4307 { |
4315 struct window *w = XWINDOW (window); | 4308 struct window *w = XWINDOW (window); |
4316 if (!NILP (w->vchild)) | 4309 if (!NILP (w->vchild)) |
4531 #define CHECK_WINDOW_CONFIGURATION(x) CHECK_RECORD (x, window_configuration) | 4524 #define CHECK_WINDOW_CONFIGURATION(x) CHECK_RECORD (x, window_configuration) |
4532 | 4525 |
4533 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("window-configuration", | 4526 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("window-configuration", |
4534 window_configuration, | 4527 window_configuration, |
4535 mark_window_config, | 4528 mark_window_config, |
4536 print_window_config, | 4529 print_window_config, |
4537 0, 0, 0, sizeof_window_config, | 4530 0, 0, 0, sizeof_window_config, |
4538 struct window_config); | 4531 struct window_config); |
4539 | 4532 |
4540 static Lisp_Object | 4533 static Lisp_Object |
4541 mark_window_config (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 4534 mark_window_config (Lisp_Object obj, void (*markobj) (Lisp_Object)) |
4572 } | 4565 } |
4573 | 4566 |
4574 static unsigned int | 4567 static unsigned int |
4575 sizeof_window_config (CONST void *h) | 4568 sizeof_window_config (CONST void *h) |
4576 { | 4569 { |
4577 CONST struct window_config *c = h; | 4570 CONST struct window_config *c = (CONST struct window_config *) h; |
4578 return sizeof_window_config_for_n_windows (c->saved_windows_count); | 4571 return sizeof_window_config_for_n_windows (c->saved_windows_count); |
4579 } | 4572 } |
4580 | 4573 |
4581 static void | 4574 static void |
4582 print_window_config (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | 4575 print_window_config (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) |
4761 /* restore the frame characteristics */ | 4754 /* restore the frame characteristics */ |
4762 #ifdef ENERGIZE | 4755 #ifdef ENERGIZE |
4763 if (FRAME_X_P (f)) | 4756 if (FRAME_X_P (f)) |
4764 { | 4757 { |
4765 Lisp_Object new_desired = config->p_sheet_buffer; | 4758 Lisp_Object new_desired = config->p_sheet_buffer; |
4766 | 4759 |
4767 if (BUFFERP (new_desired) && | 4760 if (BUFFERP (new_desired) && |
4768 !BUFFER_LIVE_P (XBUFFER (new_desired))) | 4761 !BUFFER_LIVE_P (XBUFFER (new_desired))) |
4769 new_desired = Qnil; /* the desired buffer was killed */ | 4762 new_desired = Qnil; /* the desired buffer was killed */ |
4770 | 4763 |
4771 /* need to restore the desired buffer */ | 4764 /* need to restore the desired buffer */ |
4772 if (!EQ (new_desired, desired_psheet_buffer (f))) | 4765 if (!EQ (new_desired, desired_psheet_buffer (f))) |
4773 make_psheets_desired (f, new_desired); | 4766 make_psheets_desired (f, new_desired); |
4774 } | 4767 } |
4775 #endif | 4768 #endif |
4776 | 4769 |
4777 new_current_buffer = config->current_buffer; | 4770 new_current_buffer = config->current_buffer; |
4778 if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer))) | 4771 if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer))) |
4779 new_current_buffer = Qnil; | 4772 new_current_buffer = Qnil; |
4780 | 4773 |
4781 /* | 4774 /* |
4847 | 4840 |
4848 /* The window might be dead. In this case, its redisplay | 4841 /* The window might be dead. In this case, its redisplay |
4849 structures were freed, so we need to reallocate them. */ | 4842 structures were freed, so we need to reallocate them. */ |
4850 if (!w->face_cachels) | 4843 if (!w->face_cachels) |
4851 { | 4844 { |
4852 w->face_cachels = Dynarr_new (struct face_cachel); | 4845 w->face_cachels = Dynarr_new (face_cachel); |
4853 reset_face_cachels (w); | 4846 reset_face_cachels (w); |
4854 } | 4847 } |
4855 if (!w->glyph_cachels) | 4848 if (!w->glyph_cachels) |
4856 w->glyph_cachels = Dynarr_new (struct glyph_cachel); | 4849 w->glyph_cachels = Dynarr_new (glyph_cachel); |
4857 if (!w->line_start_cache) | 4850 if (!w->line_start_cache) |
4858 w->line_start_cache = Dynarr_new (struct line_start_cache); | 4851 w->line_start_cache = Dynarr_new (line_start_cache); |
4859 w->dead = 0; | 4852 w->dead = 0; |
4860 | 4853 |
4861 if (p->parent_index >= 0) | 4854 if (p->parent_index >= 0) |
4862 w->parent = SAVED_WINDOW_N (config, p->parent_index)->window; | 4855 w->parent = SAVED_WINDOW_N (config, p->parent_index)->window; |
4863 else | 4856 else |
5235 XWINDOW_CONFIGURATION (allocate_managed_lcrecord | 5228 XWINDOW_CONFIGURATION (allocate_managed_lcrecord |
5236 (Vwindow_configuration_free_list | 5229 (Vwindow_configuration_free_list |
5237 [n_windows - 1])); | 5230 [n_windows - 1])); |
5238 else | 5231 else |
5239 /* More than ten windows; just allocate directly */ | 5232 /* More than ten windows; just allocate directly */ |
5240 config = alloc_lcrecord (sizeof_window_config_for_n_windows (n_windows), | 5233 config = (struct window_config *) |
5241 lrecord_window_configuration); | 5234 alloc_lcrecord (sizeof_window_config_for_n_windows (n_windows), |
5235 lrecord_window_configuration); | |
5242 XSETWINDOW_CONFIGURATION (result, config); | 5236 XSETWINDOW_CONFIGURATION (result, config); |
5243 | 5237 |
5244 config->frame_width = FRAME_WIDTH (f); | 5238 config->frame_width = FRAME_WIDTH (f); |
5245 config->frame_height = FRAME_HEIGHT (f); | 5239 config->frame_height = FRAME_HEIGHT (f); |
5246 config->current_window = FRAME_SELECTED_WINDOW (f); | 5240 config->current_window = FRAME_SELECTED_WINDOW (f); |
5514 set_specifier_caching (Vmodeline_shadow_thickness, | 5508 set_specifier_caching (Vmodeline_shadow_thickness, |
5515 slot_offset (struct window, | 5509 slot_offset (struct window, |
5516 modeline_shadow_thickness), | 5510 modeline_shadow_thickness), |
5517 modeline_shadow_thickness_changed, | 5511 modeline_shadow_thickness_changed, |
5518 0, 0); | 5512 0, 0); |
5519 | 5513 |
5520 DEFVAR_SPECIFIER ("has-modeline-p", &Vhas_modeline_p /* | 5514 DEFVAR_SPECIFIER ("has-modeline-p", &Vhas_modeline_p /* |
5521 *Whether the modeline should be displayed. | 5515 *Whether the modeline should be displayed. |
5522 This is a specifier; use `set-specifier' to change it. | 5516 This is a specifier; use `set-specifier' to change it. |
5523 */ ); | 5517 */ ); |
5524 Vhas_modeline_p = Fmake_specifier (Qboolean); | 5518 Vhas_modeline_p = Fmake_specifier (Qboolean); |