Subject: bug#16013: 24.3.50; Rows in height is interpreted as pixels.

From: martin rudalics <[email-masked]>
Date: Mon, 09 Dec 2013 19:26:38 +0100

I now managed to get the correct number of lines here with
the attached patch.  Tested with GTK3, Lucid and without
xtoolkit.  Not tested with Motif.  Please have a look.

Thanks, martin

martin@NOREST:~/emacs/quickfixes$ bzr diff
=== modified file 'src/dispnew.c'
--- src/dispnew.c	2013-11-30 09:25:31 +0000
+++ src/dispnew.c	2013-12-09 10:20:26 +0000
@@ -5535,6 +5535,10 @@
 	 manipulating video hardware.  */
       if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
 	FrameRows (FRAME_TTY (f)) = new_height;
+
+      FRAME_LINES (f) = new_lines;
+      FRAME_TEXT_HEIGHT (f) = new_text_height;
+      FRAME_PIXEL_HEIGHT (f) = FRAME_TEXT_TO_PIXEL_HEIGHT (f, new_text_height);
     }

   if (new_text_width != FRAME_TEXT_WIDTH (f)
@@ -5547,6 +5551,10 @@
       if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
 	FrameCols (FRAME_TTY (f)) = new_cols;

+      SET_FRAME_COLS (f, new_cols);
+      FRAME_TEXT_WIDTH (f) = new_text_width;
+      FRAME_PIXEL_WIDTH (f) = FRAME_TEXT_TO_PIXEL_WIDTH (f, new_text_width);
+
 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
       if (WINDOWP (f->tool_bar_window))
 	{
@@ -5556,13 +5564,6 @@
 #endif
     }

-  SET_FRAME_COLS (f, new_cols);
-  FRAME_LINES (f) = new_lines;
-  FRAME_TEXT_WIDTH (f) = new_text_width;
-  FRAME_TEXT_HEIGHT (f) = new_text_height;
-  FRAME_PIXEL_WIDTH (f) = FRAME_TEXT_TO_PIXEL_WIDTH (f, new_text_width);
-  FRAME_PIXEL_HEIGHT (f) = FRAME_TEXT_TO_PIXEL_HEIGHT (f, new_text_height);
-
   {
     struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
     int text_area_x, text_area_y, text_area_width, text_area_height;

=== modified file 'src/window.c'
--- src/window.c	2013-12-08 03:07:11 +0000
+++ src/window.c	2013-12-09 17:25:35 +0000
@@ -4056,7 +4056,8 @@
   r->top_line = FRAME_TOP_MARGIN (f);
   r->pixel_top = FRAME_TOP_MARGIN_HEIGHT (f);

-  if (new_pixel_size == old_pixel_size)
+  if (new_pixel_size == old_pixel_size
+      && XWINDOW (mini)->pixel_height == FRAME_LINE_HEIGHT (f))
     return;
   else if (WINDOW_LEAF_P (r))
     /* For a leaf root window just set the size.  */

=== modified file 'src/xfns.c'
--- src/xfns.c	2013-12-03 17:22:05 +0000
+++ src/xfns.c	2013-12-09 17:34:22 +0000
@@ -3069,7 +3069,6 @@
      happen.  */
   init_frame_faces (f);

-#ifdef USE_GTK
   /* PXW: This is a duplicate from below.  We have to do it here since
      otherwise x_set_tool_bar_lines will work with the character sizes
      installed by init_frame_faces while the frame's pixel size is still
@@ -3078,12 +3077,8 @@
      non-pixelwise code apparently worked around this because it had one
      frame line vs one toolbar line which left us with a zero root
      window height which was obviously wrong as well ...  */
-  width = FRAME_TEXT_WIDTH (f);
-  height = FRAME_TEXT_HEIGHT (f);
-  FRAME_TEXT_HEIGHT (f) = 0;
-  SET_FRAME_WIDTH (f, 0);
-  change_frame_size (f, width, height, 1, 0, 0, 1);
-#endif /* USE_GTK */
+  change_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
+		     FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1, 0, 0, 1);

   /* Set the menu-bar-lines and tool-bar-lines parameters.  We don't
      look up the X resources controlling the menu-bar and tool-bar

=== modified file 'src/xterm.c'
--- src/xterm.c	2013-12-07 23:04:10 +0000
+++ src/xterm.c	2013-12-09 17:39:28 +0000
@@ -6622,8 +6622,8 @@
               cancel_mouse_face (f);
             }

-          FRAME_PIXEL_WIDTH (f) = event->xconfigure.width;
-          FRAME_PIXEL_HEIGHT (f) = event->xconfigure.height;
+/**           FRAME_PIXEL_WIDTH (f) = event->xconfigure.width; **/
+/**           FRAME_PIXEL_HEIGHT (f) = event->xconfigure.height; **/
 #endif /* not USE_GTK */
 #endif

@@ -7689,6 +7689,9 @@
   FRAME_COLUMN_WIDTH (f) = font->average_width;
   FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (font);

+  FRAME_TOOL_BAR_HEIGHT (f) = FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);
+  FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);
+
   compute_fringe_widths (f, 1);

   /* Compute the scroll bar width in character columns.  */
@@ -8541,13 +8544,15 @@

   compute_fringe_widths (f, 0);

-  pixelwidth =
-    (pixelwise ? width : FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width))
-    + FRAME_TOOLBAR_WIDTH (f);
-  pixelheight =
-    (pixelwise ? height : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height))
-    + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
-
+  pixelwidth = ((pixelwise
+		 ? FRAME_TEXT_TO_PIXEL_WIDTH (f, width)
+		 : FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width))
+		+ FRAME_TOOLBAR_WIDTH (f));
+  pixelheight = ((pixelwise
+		  ? FRAME_TEXT_TO_PIXEL_HEIGHT (f, height)
+		  : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height))
+		 + FRAME_MENUBAR_HEIGHT (f)
+		 + FRAME_TOOLBAR_HEIGHT (f));
   if (change_gravity) f->win_gravity = NorthWestGravity;
   x_wm_set_size_hint (f, (long) 0, 0);
   XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
@@ -8582,8 +8587,6 @@
   else
     {
       change_frame_size (f, width, height, 0, 1, 0, 1);
-      FRAME_PIXEL_WIDTH (f) = pixelwidth;
-      FRAME_PIXEL_HEIGHT (f) = pixelheight;
       x_sync (f);
     }
 }

martin@NOREST:~/emacs/quickfixes$