Index: window.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/window.c,v retrieving revision 1.41.2.39 diff -u -r1.41.2.39 window.c --- window.c 2000/02/21 23:07:01 1.41.2.39 +++ window.c 2000/02/25 12:48:20 @@ -1010,32 +1010,55 @@ relative to the frame, not the window. ****************************************************************************/ -int -window_top_gutter_height (struct window *w) +static int +window_top_frame_gutter_height (struct window *w) { - int gutter = WINDOW_REAL_TOP_GUTTER_BOUNDS (w); - if (!NILP (w->hchild) || !NILP (w->vchild)) return 0; + else + return WINDOW_REAL_TOP_GUTTER_BOUNDS (w); +} +static int +window_top_window_gutter_height (struct window *w) +{ + if (!NILP (w->hchild) || !NILP (w->vchild)) + return 0; + #ifdef HAVE_SCROLLBARS if (!NILP (w->scrollbar_on_top_p)) - return window_scrollbar_height (w) + gutter; + return window_scrollbar_height (w); else #endif - return gutter; + return 0; } int -window_bottom_gutter_height (struct window *w) +window_top_gutter_height (struct window *w) { - int gutter = WINDOW_REAL_BOTTOM_GUTTER_BOUNDS (w); + return window_top_window_gutter_height (w) + + window_top_frame_gutter_height (w); +} +static int +window_bottom_frame_gutter_height (struct window *w) +{ if (!NILP (w->hchild) || !NILP (w->vchild)) return 0; + else + return WINDOW_REAL_BOTTOM_GUTTER_BOUNDS (w); +} - gutter += window_modeline_height (w); +static int +window_bottom_window_gutter_height (struct window *w) +{ + int gutter; + if (!NILP (w->hchild) || !NILP (w->vchild)) + return 0; + + gutter = window_modeline_height (w); + #ifdef HAVE_SCROLLBARS if (NILP (w->scrollbar_on_top_p)) return window_scrollbar_height (w) + gutter; @@ -1045,25 +1068,46 @@ } int -window_left_gutter_width (struct window *w, int modeline) +window_bottom_gutter_height (struct window *w) { - int gutter = WINDOW_REAL_LEFT_GUTTER_BOUNDS (w); + return window_bottom_window_gutter_height (w) + + window_bottom_frame_gutter_height (w); +} +static int +window_left_window_gutter_width (struct window *w, int modeline) +{ if (!NILP (w->hchild) || !NILP (w->vchild)) return 0; #ifdef HAVE_SCROLLBARS if (!modeline && !NILP (w->scrollbar_on_left_p)) - gutter += window_scrollbar_width (w); + return window_scrollbar_width (w); #endif - return gutter; + return 0; +} + +static int +window_left_frame_gutter_width (struct window *w) +{ + if (!NILP (w->hchild) || !NILP (w->vchild)) + return 0; + else + return WINDOW_REAL_LEFT_GUTTER_BOUNDS (w); } int -window_right_gutter_width (struct window *w, int modeline) +window_left_gutter_width (struct window *w, int modeline) +{ + return window_left_window_gutter_width (w, modeline) + + window_left_frame_gutter_width (w); +} + +static int +window_right_window_gutter_width (struct window *w, int modeline) { - int gutter = WINDOW_REAL_RIGHT_GUTTER_BOUNDS (w); + int gutter = 0; if (!NILP (w->hchild) || !NILP (w->vchild)) return 0; @@ -1079,6 +1123,30 @@ return gutter; } +static int +window_right_frame_gutter_width (struct window *w) +{ + if (!NILP (w->hchild) || !NILP (w->vchild)) + return 0; + else + return WINDOW_REAL_RIGHT_GUTTER_BOUNDS (w); +} + +int +window_right_gutter_width (struct window *w, int modeline) +{ + return window_right_window_gutter_width (w, modeline) + + window_right_frame_gutter_width (w); +} + +static int +window_pixel_height (struct window* w) +{ + return WINDOW_HEIGHT (w) - + (window_top_frame_gutter_height (w) + + window_bottom_frame_gutter_height (w)); +} + DEFUN ("windowp", Fwindowp, 1, 1, 0, /* Return t if OBJ is a window. @@ -1320,7 +1388,7 @@ */ (window)) { - return make_int (decode_window (window)->pixel_height); + return make_int (window_pixel_height (decode_window (window))); } DEFUN ("window-text-area-pixel-height", @@ -3464,9 +3532,11 @@ CHECK_INT (chsize); size = XINT (chsize); if (!NILP (horflag)) - psize = window_char_width_to_pixel_width (o, size, 0); + psize = window_char_width_to_pixel_width (o, size, 0) + + window_left_frame_gutter_width (o); else - psize = window_char_height_to_pixel_height (o, size, 1); + psize = window_char_height_to_pixel_height (o, size, 1) + + window_top_frame_gutter_height (o); } if (MINI_WINDOW_P (o)) @@ -3617,12 +3687,6 @@ } static int -window_pixel_height (Lisp_Object window) -{ - return WINDOW_HEIGHT (XWINDOW (window)); -} - -static int window_pixel_height_to_char_height (struct window *w, int pixel_height, int include_gutters_p) { @@ -3635,8 +3699,8 @@ avail_height = (pixel_height - (include_gutters_p ? 0 : - window_top_gutter_height (w) + - window_bottom_gutter_height (w))); + window_top_window_gutter_height (w) + + window_bottom_window_gutter_height (w))); default_face_height_and_width (window, &defheight, &defwidth); @@ -3667,8 +3731,8 @@ avail_height = char_height * defheight; pixel_height = (avail_height + (include_gutters_p ? 0 : - window_top_gutter_height (w) + - window_bottom_gutter_height (w))); + window_top_window_gutter_height (w) + + window_bottom_window_gutter_height (w))); /* It's the calling function's responsibility to check these values and make sure they're not out of range. @@ -3681,11 +3745,12 @@ /* Return number of default lines of text can fit in the window W. If INCLUDE_GUTTERS_P is 1, include "gutter" space (modeline plus horizontal scrollbar) in the space that is used for the calculation. + This doesn't include space used by the frame gutters. */ int window_char_height (struct window *w, int include_gutters_p) { - return window_pixel_height_to_char_height (w, WINDOW_HEIGHT (w), + return window_pixel_height_to_char_height (w, window_pixel_height (w), include_gutters_p); } @@ -3765,6 +3830,8 @@ return WINDOW_WIDTH (XWINDOW (window)); } +/* Calculate the pixel of a window, optionally including margin space + but no vertical gutters. */ static int window_pixel_width_to_char_width (struct window *w, int pixel_width, int include_margins_p) @@ -3809,8 +3876,8 @@ avail_width = char_width * defwidth; pixel_width = (avail_width + - window_left_gutter_width (w, 0) + - window_right_gutter_width (w, 0) + + window_left_window_gutter_width (w, 0) + + window_right_window_gutter_width (w, 0) + (include_margins_p ? 0 : window_left_margin_width (w)) + (include_margins_p ? 0 : window_right_margin_width (w))); @@ -3849,6 +3916,12 @@ (widthflag ? window_min_width : MINI_WINDOW_P (XWINDOW (window)) \ ? 1 : window_min_height) +static int +window_pixheight (Lisp_Object w) +{ + return window_pixel_height (XWINDOW (w)); +} + /* Unlike set_window_pixheight, this function also changes the heights of the siblings so as to keep everything consistent. */ @@ -3864,7 +3937,7 @@ int *sizep; int (*sizefun) (Lisp_Object) = (widthflag ? window_pixel_width - : window_pixel_height); + : window_pixheight); void (*setsizefun) (Lisp_Object, int, int) = (widthflag ? set_window_pixwidth : set_window_pixheight);