Subject: 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 14:50:59 +0100

>>>>> On Wed, 06 Nov 2024 14:58:58 +0200, Eli Zaretskii <[email-masked]> said:

    >> Cc: [email-masked], martin rudalics <[email-masked]>
    >> From: Robert Pluim <[email-masked]>
    >> Date: Wed, 06 Nov 2024 09:29:29 +0100
    >> 
    >> 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.

    Eli> This comes from the MOVE_FRAME_EVENT, which is triggered on Windows as
    Eli> well.

    Eli> Not sure about PGTK, though.  Maybe Po Lu knows.

Po Lu has confirmed: PGTK has no frame positions

    >> 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?

    Eli> What are the arguments against fixing this?

Itʼs changing the number of platforms that this can be depended on
from 2 out of 4 to 3 out of 4, which means itʼs still not useful for
package authors (not that I think itʼs a particularly useful API in
any case :-). But itʼs a small change:

diff --git a/src/nsterm.m b/src/nsterm.m
index 8c405738467..1d18f022713 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7895,6 +7895,9 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
 
   NSTRACE_RETURN_SIZE (frameSize);
 
+  /* Trigger `move-frame-functions'.  */
+  [self windowDidMove:(NSNotification *)sender];
+
   return frameSize;
 }