GNU bug report logs - #37415
Asserting failure setting frame parameters to non-fixnum values in early-init.el

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Sun, 15 Sep 2019 22:35:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: lekktu <at> gmail.com, 37415 <at> debbugs.gnu.org
Subject: bug#37415: Asserting failure setting frame parameters to non-fixnum values in early-init.el
Date: Sun, 22 Sep 2019 19:43:20 +0300
> Cc: 37415 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Sun, 22 Sep 2019 10:08:53 +0200
> 
> When called with PARAM Qleft and ALIST Qnil x_get_arg
> 
> {
>    Lisp_Object tem;
> 
>    tem = Fassq (param, alist);
> 
>    if (!NILP (tem))
>      ...
> 	  XSETCAR (XCAR (tail), Qnil);
>      }
>    else
>      tem = Fassq (param, Vdefault_frame_alist);
> 
>    if (NILP (tem))
>      ...
> 
>    return Fcdr (tem);
> }
> 
> returns the cdr of the 'default-frame-alist' entry for 'left' which
> can be anything.  So that comment is wrong and using x_get_arg here
> probably too.

No, I don't think using x_get_arg is wrong, because we still want to
determine whether to use CW_USEDEFAULT.

> Any reason why we cannot just use f->left_pos
> 
> my_create_window (struct frame * f)
> {
>    MSG msg;
>    static int coords[2];
> 
>    coords[0] = f->left_pos;
>    coords[1] = f->top_pos;
>    if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW,
> 			  (WPARAM)f, (LPARAM)coords))
>      emacs_abort ();
>    GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
> }
> 
> like the X build does?

We cannot do this unless f->size_hint_flags are set so as to tell
w32_createwindow to use f->top_pos and/or f->left_pos.  Otherwise, we
should put CW_USEDEFAULT in coords[].  IOW, how about the below?

diff --git a/src/w32fns.c b/src/w32fns.c
index 34abd02..2ae84fc 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5421,20 +5421,28 @@ my_create_window (struct frame * f)
   Lisp_Object left, top;
   struct w32_display_info *dpyinfo = &one_w32_display_info;
 
-  /* When called with RES_TYPE_NUMBER, gui_display_get_arg will return
-     zero for anything that is not a number and is not Qunbound.  */
-  left = gui_display_get_arg (dpyinfo, Qnil, Qleft, "left", "Left",
-                              RES_TYPE_NUMBER);
-  top = gui_display_get_arg (dpyinfo, Qnil, Qtop, "top", "Top",
-                             RES_TYPE_NUMBER);
-  if (EQ (left, Qunbound))
-    coords[0] = CW_USEDEFAULT;
-  else
-    coords[0] = XFIXNUM (left);
-  if (EQ (top, Qunbound))
-    coords[1] = CW_USEDEFAULT;
-  else
-    coords[1] = XFIXNUM (top);
+  if (!(f->size_hint_flags & USPosition || f->size_hint_flags & PPosition))
+    {
+      /* When called with RES_TYPE_NUMBER, and there's no 'top' or
+	 'left' parameters in the frame's parameter alist,
+	 gui_display_get_arg will return zero for anything that is
+	 neither a number nor Qunbound.  If frame parameter alist does
+	 have 'left' or 'top', they are interpreted by
+	 gui_figure_window_size, which was already called, and which
+	 sets f->size_hint_flags.  */
+      left = gui_display_get_arg (dpyinfo, Qnil, Qleft, "left", "Left",
+				  RES_TYPE_NUMBER);
+      top = gui_display_get_arg (dpyinfo, Qnil, Qtop, "top", "Top",
+				 RES_TYPE_NUMBER);
+      if (EQ (left, Qunbound))
+	coords[0] = CW_USEDEFAULT;
+      else
+	coords[0] = XFIXNUM (left);
+      if (EQ (top, Qunbound))
+	coords[1] = CW_USEDEFAULT;
+      else
+	coords[1] = XFIXNUM (top);
+    }
 
   if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW,
 			  (WPARAM)f, (LPARAM)coords))




This bug report was last modified 5 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.