Subject: Re: bug#74074: 30.0.92; [NS] Frame position not reported on resize from top left

From: Robert Pluim <[email-masked]>
Date: Wed, 06 Nov 2024 09:29:29 +0100

>>>>> On Mon, 28 Oct 2024 23:36:52 +0000, Jimmy Yuen Ho Wong <[email-masked]> said:

    Jimmy> Same problem as #74064, since I can't close duplicate, I'm filing this
    Jimmy> one against Emacs 30 in the hope that it might get addressed.

    Jimmy> Reproduction

    Jimmy> 1. eval the following in the scratch buffer

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

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

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

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

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

    Jimmy> Expectation:

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

I see that under X11, the `move-frame-functions' are called when
resizing from the top left. I donʼt know what happens on MSWindows or
in a pgtk build.

A quick experiment shows that itʼs fixable on macOS, although there is
a (strong) tendency for the 'moveʼ events to get bunched up until
after the resize ends, which means they all report the same
position. But then again this happens to a lesser extent under X as
well.

The question is: do we *want* to fix this?

Robert
--