Subject: Re: bug#30141: (26.0.91; text-pixel dimensions not properly saved by desktop-save-mode sometimes)

From: martin rudalics <[email-masked]>
Date: Sat, 20 Jan 2018 11:35:09 +0100

> The issue is when you have the frame sized to be a
 > non-multiple of the font-width (pixel sized), save the desktop, then
 > restart emacs and restore the desktop.
 >
 > At this point you’ll have a pixel width in your frame parameters.
 >
 > Then if you resize the frame to be a multiple of the font-width and
 > save the desktop, you end up writing the previous pixel widths because
 > they were in frame parameters and we do not reset them unless you are
 > using a non-multiple of the font width.
 >
 > If that doesn’t make sense I can try and write up a repro when I get a chance.

Thanks, I understand now.  I'm afraid it's the implementation that
doesn't make sense but your patch does and should be applied.  I'm not
sure whether we still can do that on the release branch.  Eli?

Eventually, we should fix this in a more profound way, though I don't
know yet how.  When I wrote the code to allow pixelwise resizing of
frames, one major aim was to not interfere with existing behavior.  I
decided to use a global variable (`frame-resize-pixelwise') which was
intended for interfacing with the window manager: When nil, Emacs
should continue to work as before, when non-nil, the new pixelwise
behavior would be allowed to take over.

Mixing the two was not intended (at that time frameset.el didn't exist
yet).  Neither were pixel values for the 'width' and 'height' frame
parameters - 'text-pixels' was added later.  Whether an individual
frame would be resized pixelwise was decided by the PIXELWISE argument
of functions like `set-frame-size'.  And to make sure the latter would
succeed, on some systems making `frame-resize-pixelwise' non-nil was a
prerequisite.

This idea breaks when pixelwise and non-pixelwise behavior are mixed
in one and the same session either for one and the same frame or for
different frames.  It might be possible to fix that by adding a
'resize-pixelwise' frame parameter to override the global variable's
value.

But what's really needed are two different parameters for width and
height: One for the value that has been asked for by the user (to be
specified the way it is now now) and one for the value realized by the
windowing system (a simple pixel value).  Unfortunately, I have no
good idea how to keep these two apart.  Maybe we need three parameters
- the old 'width' say, a 'requested-width' and a 'realized-width'.
Which might be still insufficient - what would the 'realized-width' of
a maximized or fullscreen frame be?

martin