changeset 5047:07dcc7000bbf

put width before height consistently, fix a real bug found in the process -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-20 Ben Wing <ben@xemacs.org> * EmacsFrame.c (EmacsFrameRecomputeCellSize): * faces.c (default_face_font_info): * faces.c (default_face_width_and_height): * faces.c (Fface_list): * faces.h: * frame-gtk.c (gtk_set_initial_frame_size): * frame-gtk.c (gtk_set_frame_size): * frame-gtk.c (gtk_recompute_cell_sizes): * frame.c: * frame.c (frame_conversion_internal_1): * frame.c (change_frame_size_1): * frame.c (change_frame_size): * glyphs-msw.c (mswindows_combo_box_instantiate): * glyphs-widget.c (widget_instantiate): * glyphs-widget.c (tree_view_query_geometry): * glyphs-widget.c (Fwidget_logical_to_character_width): * glyphs-widget.c (Fwidget_logical_to_character_height): * indent.c (vmotion_pixels): * redisplay-output.c (get_cursor_size_and_location): * redisplay-xlike-inc.c (XLIKE_output_eol_cursor): * redisplay-xlike-inc.c (XLIKE_flash): * redisplay.c (calculate_baseline): * redisplay.c (start_with_point_on_display_line): * redisplay.c (glyph_to_pixel_translation): * redisplay.c (pixel_to_glyph_translation): * window.c (margin_width_internal): * window.c (frame_size_valid_p): * window.c (frame_pixsize_valid_p): * window.c (check_frame_size): * window.c (set_window_pixsize): * window.c (window_pixel_height_to_char_height): * window.c (window_char_height_to_pixel_height): * window.c (window_displayed_height): * window.c (window_pixel_width_to_char_width): * window.c (window_char_width_to_pixel_width): * window.c (change_window_height): * window.c (window_scroll): * window.h: IMPORTANT: Aidan and Carbon Repo, please pay attention and fix appropriately! Rename: default_face_height_and_width -> default_face_width_and_height and reverse width/height arguments. Reverse width/height arguments to the following functions: -- default_face_font_info -- default_face_height_and_width (see above) -- check_frame_size -- frame_size_valid_p (made into a static function) Fix a redisplay bug where args to default_face_height_and_width were in the wrong order.
author Ben Wing <ben@xemacs.org>
date Sat, 20 Feb 2010 18:56:01 -0600
parents d4f666cda5e6
children 32e1ae4c1e3a
files src/ChangeLog src/EmacsFrame.c src/faces.c src/faces.h src/frame-gtk.c src/frame.c src/glyphs-msw.c src/glyphs-widget.c src/indent.c src/redisplay-output.c src/redisplay-xlike-inc.c src/redisplay.c src/window.c src/window.h
diffstat 14 files changed, 103 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/ChangeLog	Sat Feb 20 18:56:01 2010 -0600
@@ -1,3 +1,59 @@
+2010-02-20  Ben Wing  <ben@xemacs.org>
+
+	* EmacsFrame.c (EmacsFrameRecomputeCellSize):
+	* faces.c (default_face_font_info):
+	* faces.c (default_face_width_and_height):
+	* faces.c (Fface_list):
+	* faces.h:
+	* frame-gtk.c (gtk_set_initial_frame_size):
+	* frame-gtk.c (gtk_set_frame_size):
+	* frame-gtk.c (gtk_recompute_cell_sizes):
+	* frame.c:
+	* frame.c (frame_conversion_internal_1):
+	* frame.c (change_frame_size_1):
+	* frame.c (change_frame_size):
+	* glyphs-msw.c (mswindows_combo_box_instantiate):
+	* glyphs-widget.c (widget_instantiate):
+	* glyphs-widget.c (tree_view_query_geometry):
+	* glyphs-widget.c (Fwidget_logical_to_character_width):
+	* glyphs-widget.c (Fwidget_logical_to_character_height):
+	* indent.c (vmotion_pixels):
+	* redisplay-output.c (get_cursor_size_and_location):
+	* redisplay-xlike-inc.c (XLIKE_output_eol_cursor):
+	* redisplay-xlike-inc.c (XLIKE_flash):
+	* redisplay.c (calculate_baseline):
+	* redisplay.c (start_with_point_on_display_line):
+	* redisplay.c (glyph_to_pixel_translation):
+	* redisplay.c (pixel_to_glyph_translation):
+	* window.c (margin_width_internal):
+	* window.c (frame_size_valid_p):
+	* window.c (frame_pixsize_valid_p):
+	* window.c (check_frame_size):
+	* window.c (set_window_pixsize):
+	* window.c (window_pixel_height_to_char_height):
+	* window.c (window_char_height_to_pixel_height):
+	* window.c (window_displayed_height):
+	* window.c (window_pixel_width_to_char_width):
+	* window.c (window_char_width_to_pixel_width):
+	* window.c (change_window_height):
+	* window.c (window_scroll):
+	* window.h:
+	IMPORTANT: Aidan and Carbon Repo, please pay attention and fix
+	appropriately!
+	
+	Rename: default_face_height_and_width -> default_face_width_and_height
+	and reverse width/height arguments.
+
+	Reverse width/height arguments to the following functions:
+	-- default_face_font_info
+	-- default_face_height_and_width (see above)
+	-- check_frame_size
+	-- frame_size_valid_p (made into a static function)
+
+	Fix a redisplay bug where args to default_face_height_and_width
+	were in the wrong order.
+	
+
 2010-02-20  Ben Wing  <ben@xemacs.org>
 
 	* syswindows.h:
--- a/src/EmacsFrame.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/EmacsFrame.c	Sat Feb 20 18:56:01 2010 -0600
@@ -592,7 +592,7 @@
   if (! XtIsSubclass (w, emacsFrameClass))
     ABORT ();
 
-  default_face_height_and_width (wrap_frame (f), &ch, &cw);
+  default_face_width_and_height (wrap_frame (f), &cw, &ch);
   if (FRAME_X_TOP_LEVEL_FRAME_P (f))
     x_wm_set_cell_size (FRAME_X_SHELL_WIDGET (f), cw, ch);
 }
--- a/src/faces.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/faces.c	Sat Feb 20 18:56:01 2010 -0600
@@ -723,7 +723,7 @@
 
 void
 default_face_font_info (Lisp_Object domain, int *ascent, int *descent,
-			int *height, int *width, int *proportional_p)
+			int *width, int *height, int *proportional_p)
 {
   Lisp_Object font_instance;
   struct face_cachel *cachel;
@@ -782,10 +782,9 @@
 }
 
 void
-default_face_height_and_width (Lisp_Object domain,
-			       int *height, int *width)
+default_face_width_and_height (Lisp_Object domain, int *width, int *height)
 {
-  default_face_font_info (domain, 0, 0, height, width, 0);
+  default_face_font_info (domain, 0, 0, width, height, 0);
 }
 
 DEFUN ("face-list", Fface_list, 0, 1, 0, /*
--- a/src/faces.h	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/faces.h	Sat Feb 20 18:56:01 2010 -0600
@@ -299,10 +299,10 @@
 void face_property_was_changed (Lisp_Object face, Lisp_Object property,
 				Lisp_Object locale);
 void default_face_font_info (Lisp_Object domain, int *ascent,
-			     int *descent, int *height, int *width,
+			     int *descent, int *width, int *height,
 			     int *proportional_p);
-void default_face_height_and_width (Lisp_Object domain,
-				    int *height, int *width);
+void default_face_width_and_height (Lisp_Object domain, int *width,
+				    int *height);
 
 #define FACE_CACHEL_FONT(cachel, charset) \
   (cachel->font[XCHARSET_LEADING_BYTE (charset) - MIN_LEADING_BYTE])
--- a/src/frame-gtk.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/frame-gtk.c	Sat Feb 20 18:56:01 2010 -0600
@@ -373,7 +373,7 @@
     {
       GdkWindowHints geometry_mask = GDK_HINT_RESIZE_INC;
       /* Deal with the cell size */
-      default_face_height_and_width (wrap_frame (f), &geometry.height_inc, &geometry.width_inc);
+      default_face_width_and_height (wrap_frame (f), &geometry.width_inc, &geometry.height_inc);
 
       gtk_window_set_geometry_hints (GTK_WINDOW (shell),
 				     FRAME_GTK_TEXT_WIDGET (f), &geometry, geometry_mask);
@@ -1191,7 +1191,8 @@
       GdkWindowHints geometry_mask = GDK_HINT_RESIZE_INC;
 
       /* Update the cell size */
-      default_face_height_and_width (wrap_frame (f), &geometry.height_inc, &geometry.width_inc);
+      default_face_width_and_height (wrap_frame (f), &geometry.width_inc,
+				     &geometry.height_inc);
 
       gtk_window_set_geometry_hints (GTK_WINDOW (shell),
 				     FRAME_GTK_TEXT_WIDGET (f), &geometry, geometry_mask);
@@ -1372,7 +1373,7 @@
       gint width_inc = 10;
       gint height_inc = 10;
 
-      default_face_height_and_width (wrap_frame (frm), &height_inc, &width_inc);
+      default_face_width_and_height (wrap_frame (frm), &width_inc, &height_inc);
       geometry_mask = GDK_HINT_RESIZE_INC;
       geometry.width_inc = width_inc;
       geometry.height_inc = height_inc;
--- a/src/frame.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/frame.c	Sat Feb 20 18:56:01 2010 -0600
@@ -3295,7 +3295,7 @@
 /* Frame size conversion functions moved here from EmacsFrame.c
    because they're generic and really don't belong in that file.
    Function get_default_char_pixel_size() removed because it's
-   exactly the same as default_face_height_and_width().
+   exactly the same as default_face_width_and_height().
 
    Convert between total pixel size, displayable pixel size and
    character-cell size.  Variables are either "in" or "out"
@@ -3314,7 +3314,7 @@
   Lisp_Object frame, window;
 
   frame = wrap_frame (f);
-  default_face_height_and_width (frame, &cph, &cpw);
+  default_face_width_and_height (frame, &cpw, &cph);
 
   window = FRAME_SELECTED_WINDOW (f);
 
@@ -3583,8 +3583,8 @@
   /* We no longer allow bogus values passed in. */
   assert (newheight && newwidth);
 
-  default_face_height_and_width (wrap_frame (f), &real_font_height,
-				 &real_font_width);
+  default_face_width_and_height (wrap_frame (f), &real_font_width,
+				 &real_font_height);
 
   frame_conversion_internal (f, SIZE_FRAME_UNIT, newwidth, newheight,
 			     SIZE_TOTAL_PIXEL, &new_pixwidth,
@@ -3688,7 +3688,7 @@
   /* sometimes we get passed a size that's too small (esp. when a
      client widget gets resized, since we have no control over this).
      So deal. */
-  check_frame_size (f, &newheight, &newwidth);
+  check_frame_size (f, &newwidth, &newheight);
 
   /* Unconditionally mark that the frame has changed size. This is
      because many things need to know after the
--- a/src/glyphs-msw.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/glyphs-msw.c	Sat Feb 20 18:56:01 2010 -0600
@@ -2780,7 +2780,7 @@
 		      pointer_bg, dest_mask, domain);
 
   /* We now have everything right apart from the height. */
-  default_face_font_info (domain, 0, 0, &height, 0, 0);
+  default_face_font_info (domain, 0, 0, 0, &height, 0);
   GET_LIST_LENGTH (items, len);
 
   height = (height + DEFAULT_WIDGET_BORDER_WIDTH * 2 ) * len;
--- a/src/glyphs-widget.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/glyphs-widget.c	Sat Feb 20 18:56:01 2010 -0600
@@ -811,7 +811,7 @@
   if (tw)
     {
       int charwidth;
-      default_face_font_info (domain, 0, 0, 0, &charwidth, 0);
+      default_face_font_info (domain, 0, 0, &charwidth, 0, 0);
       pw = ROUND_UP (charwidth * tw + 4 * widget_instance_border_width (ii), charwidth);
     }
 
@@ -827,7 +827,7 @@
 	}
       else 
 	{
-	  default_face_font_info (domain, 0, 0, &charheight, 0, 0);
+	  default_face_font_info (domain, 0, 0, 0, &charheight, 0);
 	}
       ph = (charheight + 2 * widget_instance_border_width (ii)) * th;
     }
@@ -949,7 +949,7 @@
     {
       int len, h;
       /* #### widget face would be better here. */
-      default_face_font_info (domain, 0, 0, &h, 0, 0);
+      default_face_font_info (domain, 0, 0, 0, &h, 0);
       GET_LIST_LENGTH (items, len);
       *height = len * h;
     }
@@ -1659,7 +1659,7 @@
   if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), widget_border_width))
     border_width = DEVMETH (DOMAIN_XDEVICE (domain), widget_border_width, ());
 
-  default_face_font_info (domain, 0, 0, 0, &charwidth, 0);
+  default_face_font_info (domain, 0, 0, &charwidth, 0, 0);
   neww = ROUND_UP (charwidth * w + 4 * border_width + 2 * widget_spacing (domain), 
 		charwidth) / charwidth;
   
@@ -1693,7 +1693,7 @@
 
   h = XINT (height);
 
-  default_face_font_info (domain, 0, 0, &charheight, 0, 0);
+  default_face_font_info (domain, 0, 0, 0, &charheight, 0);
   newh = ROUND_UP (logical_unit_height (Fsymbol_name (Qwidget), 
 					Vwidget_face, domain) * h, charheight)
     / charheight;
--- a/src/indent.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/indent.c	Sat Feb 20 18:56:01 2010 -0600
@@ -801,7 +801,7 @@
   eobuf = BUF_ZV (XBUFFER (w->buffer));
   bobuf = BUF_BEGV (XBUFFER (w->buffer));
 
-  default_face_height_and_width (window, &defheight, NULL);
+  default_face_width_and_height (window, NULL, &defheight);
 
   /* guess num lines needed in line start cache + a few extra */
   abspix = abs (pixels);
--- a/src/redisplay-output.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/redisplay-output.c	Sat Feb 20 18:56:01 2010 -0600
@@ -475,7 +475,7 @@
   rb = Dynarr_atp (db->runes, cursor_location);
   *cursor_start = rb->xpos;
 
-  default_face_height_and_width (window, &defheight, &defwidth);
+  default_face_width_and_height (window, &defwidth, &defheight);
   *cursor_height = defheight;
 
   if (rb->type == RUNE_BLANK)
--- a/src/redisplay-xlike-inc.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/redisplay-xlike-inc.c	Sat Feb 20 18:56:01 2010 -0600
@@ -2056,7 +2056,7 @@
 
   gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
 
-  default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
+  default_face_font_info (window, &defascent, 0, 0, &defheight, 0);
 
   /* make sure the cursor is entirely contained between y and y+height */
   cursor_height = min (defheight, height);
@@ -2188,7 +2188,7 @@
   gcv.graphics_exposures = XLIKE_FALSE;
   gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (XDEVICE (f->device)), &gcv,
 			XLIKE_GC_FOREGROUND | XLIKE_GC_FUNCTION | XLIKE_GC_EXPOSURES);
-  default_face_height_and_width (frame, &flash_height, 0);
+  default_face_width_and_height (frame, 0, &flash_height);
 
   /* If window is tall, flash top and bottom line.  */
   if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
--- a/src/redisplay.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/redisplay.c	Sat Feb 20 18:56:01 2010 -0600
@@ -924,8 +924,8 @@
       int scaled_default_font_ascent, scaled_default_font_descent;
 
       default_face_font_info (data->window, &default_font_ascent,
-			      &default_font_descent, &default_font_height,
-			      0, 0);
+			      &default_font_descent, 0, &default_font_height,
+			      0);
 
       scaled_default_font_ascent = data->max_pixmap_height *
 	default_font_ascent / default_font_height;
@@ -8316,7 +8316,7 @@
 	  int defheight;
 
 	  window = wrap_window (w);
-	  default_face_height_and_width (window, &defheight, 0);
+	  default_face_width_and_height (window, 0, &defheight);
 
 	  cur_elt = Dynarr_length (w->line_start_cache) - 1;
 
@@ -8621,7 +8621,7 @@
   int defheight, defwidth;
 
   window = wrap_window (w);
-  default_face_height_and_width (window, &defheight, &defwidth);
+  default_face_width_and_height (window, &defwidth, &defheight);
 
   /* If we get a bogus value indicating somewhere above or to the left of
      the window, use the first window line or character position
@@ -9290,7 +9290,7 @@
 	  int defheight;
 
 	  lwin = wrap_window (*w);
-	  default_face_height_and_width (lwin, 0, &defheight);
+	  default_face_width_and_height (lwin, 0, &defheight);
 
 	  *row += (adj_area / defheight);
 	}
--- a/src/window.c	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/window.c	Sat Feb 20 18:56:01 2010 -0600
@@ -1179,7 +1179,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
@@ -1662,7 +1662,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;
@@ -3482,8 +3482,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);
@@ -3496,13 +3496,13 @@
 {
   int rows, cols;
   pixel_to_char_size (frame, width, height, &cols, &rows);
-  return frame_size_valid_p (frame, rows, cols);
+  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);
   int min_pixwidth, min_pixheight;
@@ -3537,7 +3537,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 ();
@@ -4141,7 +4141,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;
@@ -4165,7 +4165,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 +
@@ -4245,7 +4245,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)
@@ -4288,7 +4288,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);
@@ -4311,7 +4311,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 +
@@ -4394,7 +4394,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)
     {
@@ -4623,7 +4623,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;
--- a/src/window.h	Sat Feb 20 03:24:08 2010 -0600
+++ b/src/window.h	Sat Feb 20 18:56:01 2010 -0600
@@ -2,7 +2,7 @@
    Copyright (C) 1985, 1986, 1992, 1993, 1994, 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.
@@ -148,9 +148,8 @@
 		    Error_Behavior errb);
 int buffer_window_count (struct buffer *b, struct frame *f);
 int buffer_window_mru (struct window *w);
-void check_frame_size (struct frame *frame, int *rows, int *cols);
+void check_frame_size (struct frame *frame, int *cols, int *rows);
 int frame_pixsize_valid_p (struct frame *frame, int width, int height);
-int frame_size_valid_p (struct frame *frame, int rows, int cols);
 struct window *decode_window (Lisp_Object window);
 struct window *find_window_by_pixel_pos (int pix_x, int pix_y, Lisp_Object win);