From: Ship Mints <shipmints@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Eli Zaretskii <eliz@gnu.org>, 74750@debbugs.gnu.org
Subject: bug#74750: clone-frame and make-frame pixelwise issues
Date: Tue, 10 Dec 2024 11:24:12 -0500 [thread overview]
Message-ID: <CAN+1HbpHUguAbwTRQc1bnxfVWYZK_6G9Ac0Bqaxnw1C3U+XKsg@mail.gmail.com> (raw)
In-Reply-To: <f320347e-d3ce-46e4-b358-5a94336f04fa@gmx.at>
[-- Attachment #1: Type: text/plain, Size: 4482 bytes --]
On Tue, Dec 10, 2024 at 10:56 AM martin rudalics <rudalics@gmx.at> wrote:
> >> clone-frame does not correctly clone frames on a pixelwise basis.
> >>
> >> make-frame's text-pixels geometry support does not produce specified
> >> pixelwise geometry. This also impacts frameset-restore's ability to
> >> precisely reproduce pixelwise frame sizes.
>
> This would be a bug in frameset.el. One problem I see is that
> 'frame-resize-pixelwise' must be set "very early" when restoring a
> session - at least _before_ the first time we send size hints to the
> window manager.
>
The goal is, I think, to achieve pixelwise harmony among clone, make, and
restore. FWIW, my GUI sessions always run with frame-resize-pixelwise set
to t and see these sizing issues consistently. My reproducer is intended to
engender the conversation as an illustration. I have resorted to manual
labor to set frame sizes in various places and including squirreling away
frame pixel size in frameset-save just to manually reset it after
restoration due to text-pixel reliability issues. Somewhere in the bowels
of frame.c, et.al., is an issue where text-pixels behaves differently than
set-frame-size which is reliable on NS where make-frame using text-pixels
is incorrect by the vertical scroll bar width. GTK it's off, too, but I
didn't analyze that further.
> >> I consider these to be related as clone-frame's use of make-frame
> could be
> >> using text-pixels but if that doesn't work then pixelwise cloning won't
> >> work. I did read through the code base as best as I could but could not
> >> find the source of the text-pixels issue.
> >>
> >> The following reproducer, under -Q, shows the same results on 29.4 and
> >> 30.0.92. My main platform is NS and I also did some testing on GTK.
> GTK's
> >> issues seem a bit "messier" and I didn't spend any time trying to
> >> understand them in depth as I was more interested to know if GTK worked
> >> correctly or not, which it doesn't.
>
> Your code binds 'frame-resize-pixelwise' temporarily. This cannot work
> reliably. That variable should never change in an Emacs session because
> its value affects the way we send size hint increments to the window
> manager.
>
Again, this is just a reproducer for discussion and is intended to
illustrate the issues, not to specifically discuss user habits for
frame-resize-pixelwise across a GUI session. I think most people these days
probably do have it set to t, even if it's become reflexive.
This is, admittedly, a design error that would have to be fixed as
> follows:
>
> - Implement a new frame parameter 'resize-pixelwise'.
>
I certainly prefer something more explicit such as this.
- Send size hints according to the value of this parameter. When the
> parameter is set, new size hints must be sent.
>
> Alternatively, we could send new size hints for all live frames whenever
> 'frame-resize-pixelwise' is changed. This would have to be done with a
> variable watcher. Still, let-binding this variable would confuse the
> hell out of our interactions with the window manager. When the scope of
> the let-binding is left, we would have to send size hints again.
>
No, please.
>> This is an implementation of clone-frame that uses text-pixels under
> >> make-frame. This depends on make-frame text-pixels being corrected.
> Happy
> >> to supply this as a patch should the discussion of these issues
> progress in
> >> that direction.
> >>
> >> (defun clone-frame (&optional frame no-windows pixelwise)
>
> What would the WM do in a situation where PIXELWISE is non-nil and
> 'frame-resize-pixelwise' is nil?
>
The simple interim code (vs. the resize-pixelwise proposal) respects
frame-resize-pixelwise as the user's preference. Same with being explicit
by saying 'pixelwise, it's user intention.
(when (and (display-graphic-p frame)
(or pixelwise frame-resize-pixelwise))
FWIW, there are surely weird WM issues but at the very least, we're talking
about the inner geometry text-width and text-height that Emacs controls and
I stayed away from external geometry to start off at least seeing if we can
correct for what Emacs controls completely. GTK is definitely worse than NS
but at least in NS every user has the same experience as the WM options and
behaviors are more constrained than X11-derived kind of free-for-all WMs.
martin
>
[-- Attachment #2: Type: text/html, Size: 6900 bytes --]
next prev parent reply other threads:[~2024-12-10 16:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 15:51 bug#74750: clone-frame and make-frame pixelwise issues Ship Mints
2024-12-10 12:27 ` Eli Zaretskii
2024-12-10 15:56 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 16:24 ` Ship Mints [this message]
2024-12-11 9:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN+1HbpHUguAbwTRQc1bnxfVWYZK_6G9Ac0Bqaxnw1C3U+XKsg@mail.gmail.com \
--to=shipmints@gmail.com \
--cc=74750@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).