bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37415: Asserting failure setting frame parameters to non-fixnum valu


From: martin rudalics
Subject: bug#37415: Asserting failure setting frame parameters to non-fixnum values in early-init.el
Date: Sun, 22 Sep 2019 10:08:53 +0200

>> Before 572fe798cd0a00ad4a9050a7962cf8e8fbcc209b (from 2014-09-30), the 
computation of left and top
>> was done in w32_createwindow:
>>
>>        /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
>>          for anything that is not a number and is not Qunbound.  */
>>        left = x_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", 
RES_TYPE_NUMBER);
>>        top = x_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
>>
>> and anything not a number was turned to 0.
>>
>> In that commit you moved the code to my_create_window and used XINT:
>>
>>   +  /* When called with RES_TYPE_NUMBER, x_get_arg will return zero for
>>   +     anything that is not a number and is not Qunbound.  */
>>   +  left = x_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", 
RES_TYPE_NUMBER);
>>   +  top = x_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
>>   +  if (EQ (left, Qunbound))
>>   +    coords[0] = CW_USEDEFAULT;
>>   +  else
>>   +    coords[0] = XINT (left);
>>   +  if (EQ (top, Qunbound))
>>   +    coords[1] = CW_USEDEFAULT;
>>   +  else
>>   +    coords[1] = XINT (top);
>>   +
>
> Yes, but contrary to the comment, in the case in point we don't get
> zero from x_get_arg.  Which is why I asked all those questions.

Well, now you really asked it ...

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.  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?

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]