Mercurial > hg > xemacs-beta
diff src/window.c @ 5126:2a462149bd6a ben-lisp-object
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 24 Feb 2010 19:04:27 -0600 |
parents | b5df3737028a 92dc90c0bb40 |
children | a9c41067dd88 |
line wrap: on
line diff
--- a/src/window.c Wed Feb 24 01:58:04 2010 -0600 +++ b/src/window.c Wed Feb 24 19:04:27 2010 -0600 @@ -1,7 +1,7 @@ /* Window creation, deletion and examination for XEmacs. Copyright (C) 1985-1987, 1992-1995 Free Software Foundation, Inc. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996, 2002 Ben Wing. + Copyright (C) 1995, 1996, 2002, 2010 Ben Wing. Copyright (C) 1996 Chuck Thompson. This file is part of XEmacs. @@ -693,8 +693,7 @@ Lisp_Object retval = real_window_internal (mir->frame->root_window, XWINDOW_MIRROR (mir->frame->root_mirror), mir); - if (NILP (retval) && !no_abort) - ABORT (); + assert (!NILP (retval) || no_abort); return retval; } @@ -756,8 +755,7 @@ if (XFRAME (w->frame)->mirror_dirty) update_frame_window_mirror (XFRAME (w->frame)); t = find_window_mirror (w); - if (!t) - ABORT (); + assert (t); if (which == CURRENT_DISP) return t->current_display_lines; @@ -780,8 +778,7 @@ if (XFRAME (w->frame)->mirror_dirty) update_frame_window_mirror (XFRAME (w->frame)); t = find_window_mirror (w); - if (!t) - ABORT (); + assert (t); return t->buffer; } @@ -794,8 +791,7 @@ if (XFRAME (w->frame)->mirror_dirty) update_frame_window_mirror (XFRAME (w->frame)); t = find_window_mirror (w); - if (!t) - ABORT (); + assert (t); t->buffer = b; } @@ -1170,7 +1166,7 @@ margin_cwidth = (left_margin ? XINT (w->left_margin_width) : XINT (w->right_margin_width)); - default_face_height_and_width (window, 0, &font_width); + default_face_width_and_height (window, &font_width, 0); /* The left margin takes precedence over the right margin so we subtract its width from the space available for the right @@ -1653,7 +1649,7 @@ hlimit = WINDOW_TEXT_HEIGHT (w); eobuf = BUF_ZV (XBUFFER (w->buffer)); - default_face_height_and_width (window, &defheight, NULL); + default_face_width_and_height (window, NULL, &defheight); /* guess lines needed in line start cache + a few extra */ needed = (hlimit + defheight-1) / defheight + 3; @@ -2015,8 +2011,7 @@ Lisp_Object buf = w->buffer; struct buffer *b = XBUFFER (buf); - if (b != XMARKER (w->pointm[CURRENT_DISP])->buffer) - ABORT (); + assert (b == XMARKER (w->pointm[CURRENT_DISP])->buffer); /* FSF disables this check, so I'll do it too. I hope it won't break things. --ben */ @@ -3129,7 +3124,7 @@ w = window_loop (GET_LRU_WINDOW, Qnil, 0, which_frames, 1, which_devices); /* At this point we damn well better have found something. */ - if (NILP (w)) ABORT (); + assert (!NILP (w)); #endif return w; @@ -3473,8 +3468,8 @@ /* Return non-zero if both frame sizes are less than or equal to minimal allowed values. ROWS and COLS are in characters */ -int -frame_size_valid_p (struct frame *frame, int rows, int cols) +static int +frame_size_valid_p (struct frame *frame, int cols, int rows) { return (rows >= frame_min_height (frame) && cols >= MIN_SAFE_WINDOW_WIDTH); @@ -3486,21 +3481,30 @@ frame_pixsize_valid_p (struct frame *frame, int width, int height) { int rows, cols; - pixel_to_real_char_size (frame, width, height, &cols, &rows); - return frame_size_valid_p (frame, rows, cols); + pixel_to_char_size (frame, width, height, &cols, &rows); + return frame_size_valid_p (frame, cols, rows); } /* If *ROWS or *COLS are too small a size for FRAME, set them to the minimum allowable size. */ void -check_frame_size (struct frame *frame, int *rows, int *cols) +check_frame_size (struct frame *frame, int *cols, int *rows) { int min_height = frame_min_height (frame); - - if (*rows < min_height) - *rows = min_height; - if (*cols < MIN_SAFE_WINDOW_WIDTH) - *cols = MIN_SAFE_WINDOW_WIDTH; + int min_pixwidth, min_pixheight; + int min_geomwidth, min_geomheight; + + /* There is no char_to_frame_unit_size(). This can be done with + frame_conversion_internal(), but that's currently static, and we can + do it fine with two steps, as follows. */ + char_to_pixel_size (frame, MIN_SAFE_WINDOW_WIDTH, min_height, + &min_pixwidth, &min_pixheight); + pixel_to_frame_unit_size (frame, min_pixwidth, min_pixheight, + &min_geomwidth, &min_geomheight); + if (*rows < min_geomheight) + *rows = min_geomheight; + if (*cols < min_geomwidth) + *cols = min_geomwidth; } /* Normally the window is deleted if it gets too small. @@ -3519,7 +3523,7 @@ int line_size; int defheight, defwidth; - default_face_height_and_width (window, &defheight, &defwidth); + default_face_width_and_height (window, &defwidth, &defheight); line_size = (set_height ? defheight : defwidth); check_min_window_sizes (); @@ -4122,7 +4126,7 @@ window_top_window_gutter_height (w) + window_bottom_window_gutter_height (w))); - default_face_height_and_width (window, &defheight, &defwidth); + default_face_width_and_height (window, &defwidth, &defheight); if (defheight) char_height = avail_height / defheight; @@ -4146,7 +4150,7 @@ Lisp_Object window = wrap_window (w); - default_face_height_and_width (window, &defheight, &defwidth); + default_face_width_and_height (window, &defwidth, &defheight); avail_height = char_height * defheight; pixel_height = (avail_height + @@ -4226,7 +4230,7 @@ } } - default_face_height_and_width (window, &defheight, &defwidth); + default_face_width_and_height (window, &defwidth, &defheight); /* #### This probably needs to know about the clipping area once a final definition is decided on. */ if (defheight) @@ -4269,7 +4273,7 @@ (include_margins_p ? 0 : window_left_margin_width (w)) - (include_margins_p ? 0 : window_right_margin_width (w))); - default_face_height_and_width (window, &defheight, &defwidth); + default_face_width_and_height (window, &defwidth, &defheight); if (defwidth) char_width = (avail_width / defwidth); @@ -4292,7 +4296,7 @@ Lisp_Object window = wrap_window (w); - default_face_height_and_width (window, &defheight, &defwidth); + default_face_width_and_height (window, &defwidth, &defheight); avail_width = char_width * defwidth; pixel_width = (avail_width + @@ -4375,7 +4379,7 @@ if (EQ (window, FRAME_ROOT_WINDOW (f))) invalid_operation ("Won't change only window", Qunbound); - default_face_height_and_width (window, &defheight, &defwidth); + default_face_width_and_height (window, &defwidth, &defheight); while (1) { @@ -4604,7 +4608,7 @@ if (INTP (Vwindow_pixel_scroll_increment)) fheight = XINT (Vwindow_pixel_scroll_increment); else if (!NILP (Vwindow_pixel_scroll_increment)) - default_face_height_and_width (window, &fheight, &fwidth); + default_face_width_and_height (window, &fwidth, &fheight); if (Dynarr_length (dla) >= 1) modeline = Dynarr_begin (dla)->modeline;