Subject: bug#52666: 27.0.50; Unexpected mode line flickering when creating frames

From: Markus Triska <[email-masked]>
Date: Mon, 20 Dec 2021 19:23:22 +0100

martin rudalics <[email-masked]> writes:

> immediately after the frame has been created is bad karma and should be
> avoided at all costs.  The right approach is
>
> (while t
>   (let ((f (make-frame `((parent-frame . ,(selected-frame))
>                          (left . 200)
>                          (top . 200)
> 			 (width . 200)
> 			 (height . 200)))))

This seems not equivalent to what I posted: In the original snippet, I
set the width and height to 200 pixels, by specifying pixelwise as t.

In contrast, this version now sets the width and height to 200 columns
and rows, respectively, yielding a much larger frame.

> This is the second problem: 200 x 200 is way too large for the parent
> frame so the WM has to clip the child frame and where it overlaps with

On my configuration, a frame of 200x200 pixels fits well within the
parent frame at the given position, so this should not be a problem.

You can evaluate the following form in isolation to see that the frame
that is created with the original snippet fits within the parent frame:

  (let ((f (make-frame `((parent-frame . ,(selected-frame))
                         (left . 200)
                         (top . 200)))))
    (set-frame-width f 200 nil t)
    (set-frame-height f 200 nil t))

If you execute it repeatedly, you will sometimes see the flickering in
the mode line, and sometimes not. Putting this in a loop as in the
original snippet lets you easily observe the flickering.

Is there a way to set the pixelwise frame hight and width already when
the frame is created?

Thank you and all the best,
Markus