Subject: bug#21415: 25.0.50; Emacs Trunk -- pixelwise width/height for x-create-frame

From: martin rudalics <[email-masked]>
Date: Mon, 07 Sep 2015 09:05:11 +0200

> Using a brand new download of the Emacs master repository and a fresh copy of the patch, I ran:
 >
 > git apply frame.c.diff
 >
 >    error: patch failed: src/frame.c:537
 >    error: src/frame.c: patch does not apply

My apologies.  I've sent you a completely unrelated old patch while the
new one happened to end up in the wrong directory.  The present one
should be OK.

martin
diff --git a/src/frame.c b/src/frame.c
index d3e4780..1cd7c36 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4582,20 +4582,40 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p)
     {
       if (!EQ (width, Qunbound))
 	{
-	  CHECK_NUMBER (width);
-	  if (! (0 <= XINT (width) && XINT (width) <= INT_MAX))
-	    xsignal1 (Qargs_out_of_range, width);
+	  if (FLOATP (width))
+	    {
+	      if (XFLOAT_DATA (width) < 0 || (int) XFLOAT_DATA (width) > INT_MAX)
+		xsignal1 (Qargs_out_of_range, width);
+	      else
+		SET_FRAME_WIDTH (f, (int) XFLOAT_DATA (width));
+	    }
+	  else
+	    {
+	      CHECK_NUMBER (width);
+	      if (! (0 <= XINT (width) && XINT (width) <= INT_MAX))
+		xsignal1 (Qargs_out_of_range, width);

-	  SET_FRAME_WIDTH (f, XINT (width) * FRAME_COLUMN_WIDTH (f));
+	      SET_FRAME_WIDTH (f, XINT (width) * FRAME_COLUMN_WIDTH (f));
+	    }
 	}

       if (!EQ (height, Qunbound))
 	{
-	  CHECK_NUMBER (height);
-	  if (! (0 <= XINT (height) && XINT (height) <= INT_MAX))
-	    xsignal1 (Qargs_out_of_range, height);
+	  if (FLOATP (height))
+	    {
+	      if (XFLOAT_DATA (height) < 0 || (int) XFLOAT_DATA (height) > INT_MAX)
+		xsignal1 (Qargs_out_of_range, height);
+	      else
+		SET_FRAME_HEIGHT (f, (int) XFLOAT_DATA (height));
+	    }
+	  else
+	    {
+	      CHECK_NUMBER (height);
+	      if (! (0 <= XINT (height) && XINT (height) <= INT_MAX))
+		xsignal1 (Qargs_out_of_range, height);

-	  SET_FRAME_HEIGHT (f, XINT (height) * FRAME_LINE_HEIGHT (f));
+	      SET_FRAME_HEIGHT (f, XINT (height) * FRAME_LINE_HEIGHT (f));
+	    }
 	}

       user_size = x_get_arg (dpyinfo, parms, Quser_size, 0, 0, RES_TYPE_NUMBER);