Subject: Re: bug#34680: Display monitor frames not warmed up

From: Juri Linkov <[email-masked]>
Date: Thu, 28 Feb 2019 23:09:05 +0200

> I guess calling the function ‘message’ before calling
> ‘display-monitor-attributes-list’ performs some redisplay that adds
> the frame to the list of frames in ‘display-monitor-attributes-list’.

It also fixes the issue when using any of the following
‘redisplay’, ‘redraw-display’, ‘redraw-frame’, or just
‘display-monitor-attributes-list’ before calling
‘frame-monitor-attributes’ for the first time.

Just calling ‘display-monitor-attributes-list’ somehow “registers” the
frame in the list of frames, so the next call of ‘display-monitor-attributes-list’
returns the attribute ‘frames’ containing the frame.

This is not a real patch, it only demonstrates what changes
can fix this issue:

diff --git a/lisp/frameset.el b/lisp/frameset.el
index ac034ec82a..18fed46e97 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -879,7 +879,11 @@ frameset-move-onscreen
 When forced onscreen, frames wider than the monitor's workarea are converted
 to fullwidth, and frames taller than the workarea are converted to fullheight.
 NOTE: This only works for non-iconified frames."
+  ;; (redisplay)
+  ;; (redraw-display)
+  ;; (redraw-frame)
+  (display-monitor-attributes-list frame)
   (pcase-let* ((`(,left ,top ,width ,height) (cl-cdadr (frame-monitor-attributes frame)))
 	       (right (+ left width -1))
 	       (bottom (+ top height -1))
 	       (fr-left (frameset-compute-pos (frame-parameter frame 'left) left right))