comparison src/window.c @ 28463:4591d285fb65

* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues with int lvalues via casts; instead, just yield lisp object lvalues. (enlarge_window): Variable sizep now points to Lisp_Object. Use proper accessor macros. (shrink_window_lowest_first): w->top is Lisp_Object; use XINT. (grow_mini_window): Fix typo getting int value of root->height.
author Ken Raeburn <raeburn@raeburn.org>
date Sat, 01 Apr 2000 12:39:03 +0000
parents 4b675266db04
children b5a7eb24964c
comparison
equal deleted inserted replaced
28462:0b6c9ff7efe1 28463:4591d285fb65
3104 return XFASTINT (p->width); 3104 return XFASTINT (p->width);
3105 } 3105 }
3106 3106
3107 3107
3108 #define CURBEG(w) \ 3108 #define CURBEG(w) \
3109 *(widthflag ? (int *) &(XWINDOW (w)->left) : (int *) &(XWINDOW (w)->top)) 3109 *(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top))
3110 3110
3111 #define CURSIZE(w) \ 3111 #define CURSIZE(w) \
3112 *(widthflag ? (int *) &(XWINDOW (w)->width) : (int *) &(XWINDOW (w)->height)) 3112 *(widthflag ? &(XWINDOW (w)->width) : &(XWINDOW (w)->height))
3113 3113
3114 3114
3115 /* Enlarge selected_window by DELTA. WIDTHFLAG non-zero means 3115 /* Enlarge selected_window by DELTA. WIDTHFLAG non-zero means
3116 increase its width. Siblings of the selected window are resized to 3116 increase its width. Siblings of the selected window are resized to
3117 fullfil the size request. If they become too small in the process, 3117 fullfil the size request. If they become too small in the process,
3122 Lisp_Object window; 3122 Lisp_Object window;
3123 int delta, widthflag; 3123 int delta, widthflag;
3124 { 3124 {
3125 Lisp_Object parent, next, prev; 3125 Lisp_Object parent, next, prev;
3126 struct window *p; 3126 struct window *p;
3127 int *sizep, maximum; 3127 Lisp_Object *sizep;
3128 int maximum;
3128 int (*sizefun) P_ ((Lisp_Object)) 3129 int (*sizefun) P_ ((Lisp_Object))
3129 = widthflag ? window_width : window_height; 3130 = widthflag ? window_width : window_height;
3130 void (*setsizefun) P_ ((Lisp_Object, int, int)) 3131 void (*setsizefun) P_ ((Lisp_Object, int, int))
3131 = (widthflag ? set_window_width : set_window_height); 3132 = (widthflag ? set_window_width : set_window_height);
3132 3133
3162 sizep = &CURSIZE (window); 3163 sizep = &CURSIZE (window);
3163 3164
3164 { 3165 {
3165 register int maxdelta; 3166 register int maxdelta;
3166 3167
3167 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep 3168 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep)
3168 : !NILP (p->next) ? ((*sizefun) (p->next) 3169 : !NILP (p->next) ? ((*sizefun) (p->next)
3169 - window_min_size (XWINDOW (p->next), 3170 - window_min_size (XWINDOW (p->next),
3170 widthflag, 0, 0)) 3171 widthflag, 0, 0))
3171 : !NILP (p->prev) ? ((*sizefun) (p->prev) 3172 : !NILP (p->prev) ? ((*sizefun) (p->prev)
3172 - window_min_size (XWINDOW (p->prev), 3173 - window_min_size (XWINDOW (p->prev),
3180 the full frame, or make the only window aside from the 3181 the full frame, or make the only window aside from the
3181 minibuffer the full frame. */ 3182 minibuffer the full frame. */
3182 delta = maxdelta; 3183 delta = maxdelta;
3183 } 3184 }
3184 3185
3185 if (*sizep + delta < window_min_size (XWINDOW (window), widthflag, 0, 0)) 3186 if (XINT (*sizep) + delta < window_min_size (XWINDOW (window), widthflag, 0, 0))
3186 { 3187 {
3187 delete_window (window); 3188 delete_window (window);
3188 return; 3189 return;
3189 } 3190 }
3190 3191
3224 { 3225 {
3225 if (this_one > delta) 3226 if (this_one > delta)
3226 this_one = delta; 3227 this_one = delta;
3227 3228
3228 (*setsizefun) (next, (*sizefun) (next) - this_one, 0); 3229 (*setsizefun) (next, (*sizefun) (next) - this_one, 0);
3229 (*setsizefun) (window, *sizep + this_one, 0); 3230 (*setsizefun) (window, XINT (*sizep) + this_one, 0);
3230 3231
3231 delta -= this_one; 3232 delta -= this_one;
3232 } 3233 }
3233 3234
3234 next = XWINDOW (next)->next; 3235 next = XWINDOW (next)->next;
3248 this_one = delta; 3249 this_one = delta;
3249 3250
3250 first_affected = prev; 3251 first_affected = prev;
3251 3252
3252 (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0); 3253 (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0);
3253 (*setsizefun) (window, *sizep + this_one, 0); 3254 (*setsizefun) (window, XINT (*sizep) + this_one, 0);
3254 3255
3255 delta -= this_one; 3256 delta -= this_one;
3256 } 3257 }
3257 3258
3258 prev = XWINDOW (prev)->prev; 3259 prev = XWINDOW (prev)->prev;
3266 first_unaffected = next; 3267 first_unaffected = next;
3267 prev = first_affected; 3268 prev = first_affected;
3268 for (next = XWINDOW (prev)->next; ! EQ (next, first_unaffected); 3269 for (next = XWINDOW (prev)->next; ! EQ (next, first_unaffected);
3269 prev = next, next = XWINDOW (next)->next) 3270 prev = next, next = XWINDOW (next)->next)
3270 { 3271 {
3271 CURBEG (next) = CURBEG (prev) + (*sizefun) (prev); 3272 XSETINT (CURBEG (next), XINT (CURBEG (prev)) + (*sizefun) (prev));
3272 /* This does not change size of NEXT, 3273 /* This does not change size of NEXT,
3273 but it propagates the new top edge to its children */ 3274 but it propagates the new top edge to its children */
3274 (*setsizefun) (next, (*sizefun) (next), 0); 3275 (*setsizefun) (next, (*sizefun) (next), 0);
3275 } 3276 }
3276 } 3277 }
3280 register int opht = (*sizefun) (parent); 3281 register int opht = (*sizefun) (parent);
3281 3282
3282 /* If trying to grow this window to or beyond size of the parent, 3283 /* If trying to grow this window to or beyond size of the parent,
3283 make delta1 so big that, on shrinking back down, 3284 make delta1 so big that, on shrinking back down,
3284 all the siblings end up with less than one line and are deleted. */ 3285 all the siblings end up with less than one line and are deleted. */
3285 if (opht <= *sizep + delta) 3286 if (opht <= XINT (*sizep) + delta)
3286 delta1 = opht * opht * 2; 3287 delta1 = opht * opht * 2;
3287 else 3288 else
3288 { 3289 {
3289 /* Otherwise, make delta1 just right so that if we add 3290 /* Otherwise, make delta1 just right so that if we add
3290 delta1 lines to this window and to the parent, and then 3291 delta1 lines to this window and to the parent, and then
3328 delta1 = n * delta; 3329 delta1 = n * delta;
3329 } 3330 }
3330 3331
3331 /* Add delta1 lines or columns to this window, and to the parent, 3332 /* Add delta1 lines or columns to this window, and to the parent,
3332 keeping things consistent while not affecting siblings. */ 3333 keeping things consistent while not affecting siblings. */
3333 CURSIZE (parent) = opht + delta1; 3334 XSETINT (CURSIZE (parent), opht + delta1);
3334 (*setsizefun) (window, *sizep + delta1, 0); 3335 (*setsizefun) (window, XINT (*sizep) + delta1, 0);
3335 3336
3336 /* Squeeze out delta1 lines or columns from our parent, 3337 /* Squeeze out delta1 lines or columns from our parent,
3337 shriking this window and siblings proportionately. 3338 shriking this window and siblings proportionately.
3338 This brings parent back to correct size. 3339 This brings parent back to correct size.
3339 Delta1 was calculated so this makes this window the desired size, 3340 Delta1 was calculated so this makes this window the desired size,
3427 shrink_window_lowest_first (c, XFASTINT (c->height) - this_one); 3428 shrink_window_lowest_first (c, XFASTINT (c->height) - this_one);
3428 delta -= this_one; 3429 delta -= this_one;
3429 } 3430 }
3430 3431
3431 /* Compute new positions. */ 3432 /* Compute new positions. */
3432 last_top = w->top; 3433 last_top = XINT (w->top);
3433 for (child = w->vchild; !NILP (child); child = c->next) 3434 for (child = w->vchild; !NILP (child); child = c->next)
3434 { 3435 {
3435 c = XWINDOW (child); 3436 c = XWINDOW (child);
3436 c->top = make_number (last_top); 3437 c->top = make_number (last_top);
3437 shrink_window_lowest_first (c, XFASTINT (c->height)); 3438 shrink_window_lowest_first (c, XFASTINT (c->height));
3544 3545
3545 /* Shrink other windows. */ 3546 /* Shrink other windows. */
3546 shrink_window_lowest_first (root, XFASTINT (root->height) - delta); 3547 shrink_window_lowest_first (root, XFASTINT (root->height) - delta);
3547 3548
3548 /* Grow the mini-window. */ 3549 /* Grow the mini-window. */
3549 w->top = make_number (XFASTINT (root->top) + XFASTINT (root)->height); 3550 w->top = make_number (XFASTINT (root->top) + XFASTINT (root->height));
3550 w->height = make_number (XFASTINT (w->height) + delta); 3551 w->height = make_number (XFASTINT (w->height) + delta);
3551 XSETFASTINT (w->last_modified, 0); 3552 XSETFASTINT (w->last_modified, 0);
3552 XSETFASTINT (w->last_overlay_modified, 0); 3553 XSETFASTINT (w->last_overlay_modified, 0);
3553 3554
3554 adjust_glyphs (f); 3555 adjust_glyphs (f);