comparison src/window.c @ 16297:701db778b7a4

(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro. (coordinates_in_window): Use WINDOW_LEFT_MARGIN, WINDOW_RIGHT_MARGIN, and WINDOW_RIGHT_EDGE. Adjust for left-side scroll bar margin. (window_loop, Fdisplay_buffer): Use new WINDOW_FULL_WIDTH_P macro. (window_internal_width): Window width now always includes the scroll bar, if any. Use WINDOW_RIGHTMOST_P and WINDOW_FULL_WIDTH_P.
author Richard M. Stallman <rms@gnu.org>
date Mon, 23 Sep 1996 04:36:43 +0000
parents e3a834653117
children c39e44468b7a
comparison
equal deleted inserted replaced
16296:584310941e70 16297:701db778b7a4
357 Lisp_Object window; 357 Lisp_Object window;
358 { 358 {
359 register struct window *w = decode_window (window); 359 register struct window *w = decode_window (window);
360 360
361 return Fcons (w->left, Fcons (w->top, 361 return Fcons (w->left, Fcons (w->top,
362 Fcons (make_number (XFASTINT (w->left) + XFASTINT (w->width)), 362 Fcons (make_number (WINDOW_RIGHT_EDGE (w)),
363 Fcons (make_number (XFASTINT (w->top) 363 Fcons (make_number (XFASTINT (w->top)
364 + XFASTINT (w->height)), 364 + XFASTINT (w->height)),
365 Qnil)))); 365 Qnil))));
366 } 366 }
367 367
378 coordinates_in_window (w, x, y) 378 coordinates_in_window (w, x, y)
379 register struct window *w; 379 register struct window *w;
380 register int *x, *y; 380 register int *x, *y;
381 { 381 {
382 register int left = XINT (w->left); 382 register int left = XINT (w->left);
383 register int width = XINT (w->width); 383 register int right_edge = WINDOW_RIGHT_EDGE (w);
384 register int left_margin = WINDOW_LEFT_MARGIN (w);
385 register int right_margin = WINDOW_RIGHT_MARGIN (w);
384 register int window_height = XINT (w->height); 386 register int window_height = XINT (w->height);
385 register int top = XFASTINT (w->top); 387 register int top = XFASTINT (w->top);
386 388
387 if ( *x < left || *x >= left + width 389 if ( *x < left || *x >= right_edge
388 || *y < top || *y >= top + window_height) 390 || *y < top || *y >= top + window_height)
389 return 0; 391 return 0;
390 392
393 if (left_margin != left && *x < left_margin && *x >= left)
394 return 3;
395
396 if (right_margin != right_edge && *x >= right_margin && *x < right_edge)
397 return 3;
398
391 /* Is the character is the mode line? */ 399 /* Is the character is the mode line? */
392 if (*y == top + window_height - 1 400 if (*y == top + window_height - 1
393 && ! MINI_WINDOW_P (w)) 401 && ! MINI_WINDOW_P (w))
394 return 2; 402 return 2;
395 403
396 /* Is the character in the right border? */ 404 *x -= WINDOW_LEFT_MARGIN (w);
397 if (*x == left + width - 1
398 && left + width != FRAME_WIDTH (XFRAME (w->frame)))
399 return 3;
400
401 *x -= left;
402 *y -= top; 405 *y -= top;
403 return 1; 406 return 1;
404 } 407 }
405 408
406 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, 409 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
1320 return w; 1323 return w;
1321 break; 1324 break;
1322 1325
1323 case GET_LRU_WINDOW: 1326 case GET_LRU_WINDOW:
1324 /* t as arg means consider only full-width windows */ 1327 /* t as arg means consider only full-width windows */
1325 if (!NILP (obj) && XFASTINT (XWINDOW (w)->width) 1328 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (XWINDOW (w)))
1326 != FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (w)))))
1327 break; 1329 break;
1328 /* Ignore dedicated windows and minibuffers. */ 1330 /* Ignore dedicated windows and minibuffers. */
1329 if (MINI_WINDOW_P (XWINDOW (w)) 1331 if (MINI_WINDOW_P (XWINDOW (w))
1330 || !NILP (XWINDOW (w)->dedicated)) 1332 || !NILP (XWINDOW (w)->dedicated))
1331 break; 1333 break;
2132 /* If we got a tall enough full-width window that can be split, 2134 /* If we got a tall enough full-width window that can be split,
2133 split it. */ 2135 split it. */
2134 if (!NILP (window) 2136 if (!NILP (window)
2135 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) 2137 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
2136 && window_height (window) >= split_height_threshold 2138 && window_height (window) >= split_height_threshold
2137 && (XFASTINT (XWINDOW (window)->width) 2139 && WINDOW_FULL_WIDTH_P (XWINDOW (window)))
2138 == FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (window))))))
2139 window = Fsplit_window (window, Qnil, Qnil); 2140 window = Fsplit_window (window, Qnil, Qnil);
2140 else 2141 else
2141 { 2142 {
2142 Lisp_Object upper, lower, other; 2143 Lisp_Object upper, lower, other;
2143 2144
2591 int 2592 int
2592 window_internal_width (w) 2593 window_internal_width (w)
2593 struct window *w; 2594 struct window *w;
2594 { 2595 {
2595 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); 2596 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
2596 int left = XINT (w->left);
2597 int width = XINT (w->width); 2597 int width = XINT (w->width);
2598
2599 /* If this window is flush against the right edge of the frame, its
2600 internal width is its full width. */
2601 if (left + width >= FRAME_WIDTH (f))
2602 return width;
2603
2604 /* If we are not flush right, then our rightmost columns are
2605 occupied by some sort of separator. */
2606 2598
2607 /* Scroll bars occupy a few columns. */ 2599 /* Scroll bars occupy a few columns. */
2608 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) 2600 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
2609 return width - FRAME_SCROLL_BAR_COLS (f); 2601 return width - FRAME_SCROLL_BAR_COLS (f);
2610 2602
2611 /* The column of `|' characters separating side-by-side windows 2603 /* The column of `|' characters separating side-by-side windows
2612 occupies one column only. */ 2604 occupies one column only. */
2613 return width - 1; 2605 if (!WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w))
2606 return width - 1;
2607
2608 return width;
2614 } 2609 }
2615 2610
2616 2611
2617 /* Scroll contents of window WINDOW up N lines. */ 2612 /* Scroll contents of window WINDOW up N lines. */
2618 2613