Subject: bug#28442: 26.0.50; desktop-save-mode no longer restores correct frame size on macOS

From: martin rudalics <[email-masked]>
Date: Sun, 26 Nov 2017 11:25:40 +0100

>> We'd probably need to save and restore two additional frame parameters
 >> like 'text-pixel-width' and 'text-pixel-height' then.
 >
 > That’d be great.

It would be nice if you could try to do that: First of all you would
have to look at how and why frameset.el ignores the pixel size of
frames.  I suspect it does that by going for the normal 'width' and
'height' parameters instead when saving and restoring frames.

So if the pixel width of a frame differs from what its width times
`frame-char-width' of that frame tells, you would have to add a separate
'text-pixel-width' parameter in `frameset--record-relationships' and
have `frameset--restore-frame' use the value of that parameter instead
of (or maybe after) processing the normal 'width' parameter.

I'd try to not always use 'text-pixel-width' instead of 'width' because
otherwise we might deceive more conservative users.  There's one tricky
case mentioned by this comment in frameset.el:

       ;; Currently Emacs has the limitation that it does not record the size
       ;; and position of a frame before maximizing it, so we cannot save &
       ;; restore that info.  Instead, when restoring, we resort to creating
       ;; invisible "fullscreen" frames of default size and then maximizing them
       ;; (and making them visible) which at least is somewhat user-friendly
       ;; when these frames are later de-maximized.

so I would also propose to not save a 'text-pixel-width' parameter when
a frame is maximized or fullscreen.

I intend to resolve that latter issue eventually by storing some sort of
normal width in the frame structure (which would likely be some pixel
width) but am not yet sure how to do that.

martin