GNU bug report logs - #79164
[PATCH] Fix macOS frame position update after resize/move in nsterm.m

Previous Next

Package: emacs;

Reported by: 川本 琢二 (Dr.Sc.KAWAMOTO,Takuji) <kawamoto.takuji <at> gmail.com>

Date: Sun, 3 Aug 2025 06:46:02 UTC

Severity: normal

Tags: patch

Done: Alan Third <alan <at> idiocy.org>

Full log


Message #43 received at 79164-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: 川本 琢二 (Dr.Sc.KAWAMOTO,Takuji)
 <kawamoto.takuji <at> gmail.com>
Cc: gerd.moellmann <at> gmail.com, 79164-done <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#79164: frame position not updated correctly when resizing
 from left edge on macOS
Date: Mon, 11 Aug 2025 22:09:11 +0100
I've pushed this change to master.

Thank you!

On Thu, Aug 07, 2025 at 08:40:10PM +0900, 川本 琢二 (Dr.Sc.KAWAMOTO,Takuji) wrote:
> I am attaching the final commit message corresponding to the patch I
> submitted earlier.
> It includes the requested Copyright-paperwork-exempt line.
> 
> On 2025/08/06 11:31, Eli Zaretskii wrote:
> > > Date: Tue, 5 Aug 2025 21:03:59 +0100
> > > From: Alan Third <alan <at> idiocy.org>
> > > Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
> > > 	Eli Zaretskii <eliz <at> gnu.org>, 79164 <at> debbugs.gnu.org
> > > 
> > > On Tue, Aug 05, 2025 at 08:20:16PM +0900, 川本 琢二 (Dr.Sc.KAWAMOTO,Takuji) wrote:
> > > > Thank you for the reference.
> > > > 
> > > > Yes, I also noticed that Yamamoto-san’s `emacs-mac` port uses similar
> > > > approaches
> > > >   to track window movement and resizing accurately on macOS.
> > > >   That gave me more confidence that this patch’s use of `windowDidMove` and
> > > >   `windowDidEndLiveResize` to update frame geometry is consistent with
> > > > well-tested practice.
> > > > 
> > > > My patch aims to integrate such behavior into upstream Emacs so that even
> > > > the standard
> > > > Cocoa build reports accurate frame positions during edge-resize
> > > > operations—especially
> > > > for use cases relying on `move-frame-functions`.
> > > I think I redid the resizing code a few years ago, and I'm guessing
> > > this got missed. Thank you for the patch.
> > > 
> > > Eli, does this require copyright assignment? I'm guessing not as most
> > > of the code is not new, just moved from A to B.
> > Yes, we can accept this without an assignment.  Just please remember
> > indicating that in the commit log message, with
> > Copyright-paperwork-exempt.
> > 
> > Thanks.

> macOS: Ensure frame position is correctly updated after resizing from left edge
> 
> This patch fixes a bug where frame position is not accurately updated
> when resizing an Emacs frame from the left edge in the macOS (Cocoa)
> build. The issue affected consumers of `move-frame-functions`, which
> would receive outdated frame positions.
> 
> To resolve this, the patch applies the same frame-position update
> logic in `windowDidEndLiveResize` that is already present in
> `windowDidMove`. Since the logic is shared, a new helper method
> `updateFramePosition` is introduced.
> 
> Both `windowDidMove` and `windowDidEndLiveResize` are macOS Cocoa
> framework methods defined by the NSWindowDelegate protocol. They are
> now both calling `updateFramePosition` to ensure that the internal
> Emacs frame geometry reflects the actual macOS window state during
> and after edge-resize operations.
> 
> Tested on macOS 15.5 (Sonoma) with native compilation enabled.
> Based on commit e6c1ec71b72 (2025-07-20, master).
> 
> * src/nsterm.m (windowDidEndLiveResize): Implement NSWindowDelegate method.
> (updateFramePosition): Extract common logic from windowDidMove and windowDidEndLiveResize.
> 
> Bug: #74074
> Copyright-paperwork-exempt: yes


-- 
Alan Third




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.