Subject: bug#74750: clone-frame and make-frame pixelwise issues

From: martin rudalics <[email-masked]>
Date: Fri, 13 Dec 2024 19:15:45 +0100

> Thank you for the patch and continued focus on this. The following is the
 > behavior I see on NS with the patch applied with target width 1700 and
 > height 1000. These are results from clone-frame using text-pixels which
 > I've included below without explicit pixelwise argument so it respects
 > frame-resize-pixelwise.

Thank you for conducting these experiments.

 > Note: frame-inhibit-implied-resize=(tab-bar-lines) is the default setting
 > on NS:
 >
 > #if defined (USE_GTK) || defined (HAVE_NS)
 >    frame_inhibit_implied_resize = list1 (Qtab_bar_lines);
 >
 > frame-resize-pixelwise=nil frame-inhibit-implied-resize=nil text-width=1692
 > (Δ-8) text-height=984 (Δ-16) native-width=1727 (Δ-8) native-height 988
 > (Δ-16)
 >
 > Result: respects lines/cols as expected.

It's problematic to clone a frame made with 'frame-resize-pixelwise'
non-nil in a setting with 'frame-resize-pixelwise' nil.  I always have
'frame-resize-pixelwise' t and never change it.

 > frame-resize-pixelwise=t frame-inhibit-implied-resize=(tab-bar-lines)
 > text-width=1700 (Δ0) text-height=1000 (Δ0) native-width=1735 (Δ0)
 > native-height 1004 (Δ0)
 >
 > Result: Okay by accident, I think, only because tab-bar-lines parameter is
 > nil during adjust_frame_height invocations?

adjust_frame_size you mean, I suppose.  Does your frame have a tab bar?

 > frame-resize-pixelwise=t frame-inhibit-implied-resize=nil text-width=1700
 > (Δ0) text-height=1000 (Δ0) native-width=1735 (Δ0) native-height 1004 (Δ0)
 >
 > Result: Okay but with frame-inhibit-implied-resize nil, I'd have expected
 > rows/cols vs. pixelwise.

Why?  'frame-inhibit-implied-resize' is about _not_ resizing a frame's
window when one removes/adds one of the items it mentions.  It should
work with pixelwise and normal resizing.

 > frame-resize-pixelwise=t frame-inhibit-implied-resize=t text-width=1685
 > (Δ-15) text-height=1000 (Δ0) native-width=1720 (Δ-15) native-height 1004
 > (Δ0)
 >
 > Result: I think this case remains broken needing the adjustment from your
 > first patch that you wanted to also account for fringes?

15 is an odd number so it can't be the default fringes.  IIUC it's your
scroll bar which gets set up after the "frame was made" and while
resizing is inhibited.  Note that the fringes are purely Emacs internal
- we can set them up any way we like.  The scroll bar is more difficult
since the toolkit usually determines its default width.  You could try
to debug this with a breakpoint in 'gui_set_scroll_bar_width' and after
that one in 'frame_inhibit_resize'.  Here on xfwm/GTK-3 the text width
remains unchanged.

 > My default GUI setup is frame-resize-pixelwise t
 > frame-inhibit-implied-resize t as I expect many people have adopted these
 > days.

Few people have AFAICT.  Note that all these experiments are borderline.
Cloning a frame should respect the settings that were active at the time
the original was made.  We can try to make it behave reasonably when
these values change but I am not sure whether we will succeed.

martin