Subject: 25.2; frame moved off display does not return (OS X)

From: [email-masked] (Charles A. Roelli)
Date: Mon, 20 Feb 2017 21:04:58 +0100

After looking into a possible bug in Ediff on OS X
(https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25057) it looks like
there may be a bug in the frame handling code for OS X.

You can evaluate this code from emacs -Q to have a frame gradually moved
in steps of 200 px from position ((top . 1) (left . 1)) until it's just
past the right edge of the display (more or less), and then come back
again:

(let ((display-width (display-pixel-width))
      (dx            200)
      (frame-x       1))
  (setq frame-test (make-frame
		    `((top . 1) (left . ,frame-x))))
  (sleep-for 0.5)
  ;; 1. Move it until it's off-screen.
  (while (< frame-x display-width)
    (setq frame-x (+ frame-x dx))
    (modify-frame-parameters frame-test
			     `((left . ,frame-x)))
    (sleep-for 0.5))
  (sleep-for 1)
  ;; 2. Bring it back.
  (while (> frame-x dx)
    (setq frame-x (- frame-x dx))
    (modify-frame-parameters frame-test
			     `((left . ,frame-x)))
    (sleep-for 0.5))
  (sleep-for 1)
  (delete-frame frame-test))

On GNU/Linux and MS Windows the frame behaves as expected: when the
frame parameters are changed to bring it back onscreen (step 2), the
frame becomes visible again.  On OS X 10.6 the frame stays off screen,
however, and I can't find any way to put it back on screen.  You can
change the frame parameters for `top' and `left', and they'll stick, but
they don't actually seem to have any effect.

Can someone reproduce this on a more recent OS X?  Maybe the problem is
fixed in newer versions.

In GNU Emacs 25.2.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549))
 of 2017-02-07 built on gray
Windowing system distributor 'Apple', version 10.3.1038
Configured using:
 'configure --with-modules'

Configured features:
JPEG RSVG NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES