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

From: [email-masked] (Charles A. Roelli)
Date: Tue, 28 Feb 2017 11:12:27 +0100

The attached patch against master fixes the issue on OS X 10.6 by
constraining frames to the visible area.  Behavior with OS X 10.9+ (and
"Spaces") still needs testing.  The patch also fixes
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=14713, which has
reappeared since it was fixed (at least it has reappeared on 10.6).

Also CCing Jan Djärv who worked on this area of the code previously (see
e61a31bf999b37f32616e5159196d179657ad788).

>From cdc3c31ef47bad37899575c78aa888b4f0bf24f2 Mon Sep 17 00:00:00 2001
From: Charles A. Roelli <[email-masked]>
Date: Tue, 28 Feb 2017 10:58:25 +0100
Subject: [PATCH] Constrain frames in all versions of OS X

* nsterm.m (constrainFrameRect:toScreen:): Constrain
  frames in all versions of OS X.

Fixes: debbugs:25818
---
 src/nsterm.m |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 28764c8..9b479ad 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7841,17 +7841,9 @@ - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
              NSTRACE_ARG_RECT (frameRect));
 
 #ifdef NS_IMPL_COCOA
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
-  // If separate spaces is on, it is like each screen is independent.  There is
-  // no spanning of frames across screens.
-  if ([NSScreen screensHaveSeparateSpaces])
-    {
-      NSTRACE_MSG ("Screens have separate spaces");
-      frameRect = [super constrainFrameRect:frameRect toScreen:screen];
-      NSTRACE_RETURN_RECT (frameRect);
-      return frameRect;
-    }
-#endif
+  frameRect = [super constrainFrameRect:frameRect toScreen:screen];
+  NSTRACE_RETURN_RECT (frameRect);
+  return frameRect;
 #endif
 
   return constrain_frame_rect(frameRect,
--
1.7.4.4