Subject: bug#74064: 29.4; [NS] Frame position not reported on resize from top left

From: Jimmy Yuen Ho Wong <[email-masked]>
Date: Mon, 28 Oct 2024 16:05:31 +0000

Reproduction

1. eval the following in the scratch buffer

(let ((selected-frame (selected-frame)))
  (add-hook 'move-frame-functions
	          (lambda (frame)
              (with-selected-frame selected-frame
	              (message "frame pos in move-frame-functions: %s" (frame-position frame)))))
  (add-hook 'window-size-change-functions
            (lambda (frame)
              (with-selected-frame selected-frame
	              (message "frame pos in window-size-change-functions %s" (frame-position frame)))))
  (add-hook 'window-state-change-functions
            (lambda (frame)
              (with-selected-frame selected-frame
	              (message "frame pos in window-state-change-functions %s" (frame-position frame))))))

(make-frame '((width . 100) (height . 50)))

2. Resize the new frame from the top left corner on the title bar

3. Check the logs in the *Messages* buffer and notice the frame position
was never changed.

4. Move the new frame by dragging from the title bar, notice the
move-frame-functions hook was run and reported the new position.

Expectation:

When a frame is resized from the top left corner by the window manager, the frame position
should update and be reported to Elisp programs, otherwise Elisp
programs have no way to find out what the X/Y coordinate of the frame is
when its resized from the top left.

In GNU Emacs 29.4 (build 2, aarch64-apple-darwin23.6.0, NS
 appkit-2487.70 Version 14.7 (Build 23H124)) of 2024-10-08 built on
 MobileCat.localdomain
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.7

Configured using:
 'configure --prefix=/opt/local --disable-silent-rules --without-dbus
 --without-gconf --without-libotf --without-m17n-flt --with-libgmp
 --with-gnutls --with-json --with-xml2 --with-modules --with-sqlite3
 --with-webp --infodir /opt/local/share/info/emacs --with-ns
 --with-lcms2 --without-harfbuzz --without-imagemagick --without-xaw3d
 --with-rsvg --with-xwidgets --with-native-compilation=aot
 --with-tree-sitter 'CFLAGS=-pipe -Os -Wno-attributes
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch
 arm64' 'CPPFLAGS=-I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk'
 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie
 -Wl,-rpath /opt/local/lib/gcc14 -Wl,-rpath /opt/local/lib
 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
 -arch arm64''

Configured features:
ACL GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XWIDGETS ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction