Subject: bug#65840: 29.1; desktop-load moves frames to the right and down

From: Po Lu <[email-masked]>
Date: Sat, 09 Sep 2023 21:35:01 +0800

Eli Zaretskii <[email-masked]> writes:

> You are aware, I hope, that on X and similar GUI systems, the
> coordinates of the frames we request from the window-manager are
> advisory: the WM doesn't have to adhere to what we request.  I'm not
> sure what you see is not a manifestation of that.
>
> Po Lu, can you chime in, please?

Thanks, but I'm not well versed in Mac OS window management.  I would
begin an investigation into this behavior by calling:

  (set-frame-position f 10 10)

waiting for a MOVE_FRAME_EVENT to arrive:

      emacsframe->left_pos = (NSMinX (r)
			      - NS_PARENT_WINDOW_LEFT_POS (emacsframe));
      emacsframe->top_pos = (NS_PARENT_WINDOW_TOP_POS (emacsframe)
			     - NSMaxY (r));

and attempting to establish which factors influence both the position
set by ns_set_offset and that returned within the consequent
MOVE_FRAME_EVENT.  With that information at hand, it should become
possible to then devise a method of compensating for such factors, so as
to guarantee that the frame position through `set-frame-position' is
reflected faithfully within the frame's `left' and `top' properties,
insofar as the window manager elects to respect said position.