Subject: Re: 31.0.50; Change in fit-frame-to-buffer doesn't work with transient-posframe

From: Gerd Möllmann <[email-masked]>
Date: Mon, 19 May 2025 16:08:13 +0200

Gerd Möllmann <[email-masked]> writes:

> martin rudalics <[email-masked]> writes:
>
>>>> When on macOS with 'frame-resize-pixelwise' nil you drag a frame border
>>>> with the mouse, does it resize by pixels or by character increments?
>>>
>>> I think it resizes to character bounds with frame-resize-pixelwise nil,
>>> and to pixels with it being t.
>>
>> But did you try?  
>
> Sure. With frame-resize-pixelwise t, I can drag the right side of the
> frame so that I get this:
>
> x
>
>
> Note that I can make it end in the middle of the 'm' in the header-line.
> With frame-resize-pixel-wise nil I can't get that. It "snaps" to character
> boundaries like so
>
> x
>
>
>> I see PResizeInc defined in nsgui.h but I nowhere see it used. Same
>> goes for Wayland builds. AFAICT size increments are only recognized by
>> X11. Everywhere else they are a pure nuisance.
>
> Don't know what that means, sorry. And I don't know what is causing
> this different behavior.

Could be this, maybe

nsterm.m:
 7967   /* Restrict the new size to the text grid.
 7968 
 7969      Don't restrict the width if the user only adjusted the height, and
 7970      vice versa.  (Without this, the frame would shrink, and move
 7971      slightly, if the window was resized by dragging one of its
 7972      borders.)  */
 7973   if (!frame_resize_pixelwise)
 7974     {
 7975       NSRect r = [[self window] frame];
 7976 
 7977       if (r.size.width != frameSize.width)
 7978         {
 7979           frameSize.width =
 7980             FRAME_TEXT_COLS_TO_PIXEL_WIDTH  (*emacsframe, cols);
 7981         }
 7982 
 7983       if (r.size.height != frameSize.height)
 7984         {
 7985           frameSize.height =
 7986             FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (*emacsframe, rows) + extra;
 7987         }
 7988     }

in - (NSSize)windowWillResize: