Subject: Re: bug#79164: frame position not updated correctly when resizing from left edge on macOS

From: 川本 琢二 (Dr.Sc.KAWAMOTO,Takuji)<[email-masked]>
Date: Sun, 3 Aug 2025 16:14:06 +0900

Hello,

Following up on my previous message, here is a more detailed version of 
the logs I captured during frame resizing.

To analyze the issue more precisely, I created an external command 
`listemacswindows_cocoa` which queries the actual window geometry via 
macOS APIs. I also added internal logging to Emacs to compare its 
internal frame state against this external tool during window operations.

Below are full logs from when resizing the frame **by dragging the left 
edge**, before and after applying the patch.

---

### Resize from left edge (before patch)

2025-08-03 08:16:01.306027 ELisp after resize hook 1924x975-1920+0 
1924x975-1920+0
2025-08-03 08:16:08.873112 Obj-C windowWillResize called
2025-08-03 08:16:08.875086 Obj-C windowDidMove called
2025-08-03 08:16:08.984022 ELisp after resize hook 1917x975-1920+0 
1924x975-1920+0
2025-08-03 08:16:09.049381 Obj-C windowWillResize called
2025-08-03 08:16:09.049736 Obj-C windowDidMove called
2025-08-03 08:16:09.057062 Obj-C windowWillResize called
2025-08-03 08:16:09.057092 Obj-C windowDidMove called
2025-08-03 08:16:09.127564 ELisp after resize hook 1908x975-1905+0 
1917x975-1913+0
2025-08-03 08:16:09.187194 Obj-C windowWillResize called
2025-08-03 08:16:09.187235 Obj-C windowDidMove called
2025-08-03 08:16:09.258766 ELisp after resize hook 1905x975-1904+0 
1908x975-1904+0
2025-08-03 08:16:09.317012 Obj-C windowWillResize called
2025-08-03 08:16:09.317461 Obj-C windowDidMove called
2025-08-03 08:16:09.393941 ELisp after resize hook 1902x975-1901+0 
1905x975-1901+0
2025-08-03 08:16:09.587080 ELisp after move hook     1902x975-1901+0 
1902x975-1898+0
2025-08-03 08:16:09.655081 ELisp after move hook     1902x975-1901+0 
1902x975-1898+0
2025-08-03 08:16:09.718153 ELisp after move hook     1902x975-1901+0 
1902x975-1898+0
2025-08-03 08:16:09.777682 ELisp after move hook     1902x975-1901+0 
1902x975-1898+0
2025-08-03 08:16:09.835766 ELisp after move hook     1902x975-1901+0 
1902x975-1898+0

As you can see, `move-frame-functions` and 
`window-size-change-functions` receive frame positions that are **out of 
sync** with the actual window state during the resize operation.

---

### Resize from left edge (after applying the patch)

2025-08-03 09:46:54.217436 Obj-C windowWillResize called
2025-08-03 09:46:54.218742 Obj-C windowDidMove called
2025-08-03 09:46:54.218765 Obj-C updateFramePosition called 
1882x910-1882+56
2025-08-03 09:46:54.328541 ELisp after resize hook 1876x938-1882+31 
1882x938-1882+31
2025-08-03 09:46:54.390137 Obj-C windowWillResize called
2025-08-03 09:46:54.390463 Obj-C windowDidMove called
2025-08-03 09:46:54.390468 Obj-C updateFramePosition called 
1876x910-1882+56
2025-08-03 09:46:54.462142 ELisp after resize hook 1872x938-1876+31 
1876x938-1876+31
2025-08-03 09:46:54.515893 Obj-C windowWillResize called
2025-08-03 09:46:54.515931 Obj-C windowDidMove called
2025-08-03 09:46:54.515936 Obj-C updateFramePosition called 
1872x910-1876+56
2025-08-03 09:46:54.587742 ELisp after resize hook 1871x938-1872+31 
1872x938-1872+31
2025-08-03 09:46:54.704831 Obj-C windowDidEndLiveResize called
2025-08-03 09:46:54.704848 Obj-C updateFramePosition called 
1871x910-1872+56
2025-08-03 09:46:54.798062 ELisp after move hook  1871x938-1871+31 
1871x938-1871+31
2025-08-03 09:46:54.861957 ELisp after move hook  1871x938-1871+31 
1871x938-1871+31
2025-08-03 09:46:54.921596 ELisp after move hook  1871x938-1871+31 
1871x938-1871+31
2025-08-03 09:46:54.979835 ELisp after move hook  1871x938-1871+31 
1871x938-1871+31

After the patch is applied, the internal frame position becomes 
consistent with what is reported by the system. The final 
`move-frame-functions` call correctly reflects the final position at the 
end of the resizing operation.

This confirms that the proposed patch resolves the original inconsistency.

Best regards,
Dr.Sc.KAWAMOTO, Takuji