summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2014-03-08 16:49:59 +0100
committerJan Djärv <jan.h.d@swipnet.se>2014-03-08 16:49:59 +0100
commite61a31bf999b37f32616e5159196d179657ad788 (patch)
tree57a9332a04ad8e3cbf3e295a5f2ef7282f59aee5 /src
parent281ae1808d7b470e0aa11858ea0b3100d20d1694 (diff)
downloademacs-e61a31bf999b37f32616e5159196d179657ad788.tar.gz
* nsterm.h (MAC_OS_X_VERSION_10_9): Add.
* nsterm.m (constrainFrameRect:toScreen:): Constrain normally when frame is only on one screen. Fixes: debbugs:14713
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/nsterm.h3
-rw-r--r--src/nsterm.m28
3 files changed, 37 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 18f412362f1..5b75161f91c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-08 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsterm.h (MAC_OS_X_VERSION_10_9): Add.
+
+ * nsterm.m (constrainFrameRect:toScreen:): Constrain normally when frame
+ is only on one screen (Bug#14713).
+
2014-03-08 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (move_it_in_display_line_to): If word-wrap is ON, and
diff --git a/src/nsterm.h b/src/nsterm.h
index f058541027a..8e8a9b7f36f 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -42,6 +42,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef MAC_OS_X_VERSION_10_8
#define MAC_OS_X_VERSION_10_8 1080
#endif
+#ifndef MAC_OS_X_VERSION_10_9
+#define MAC_OS_X_VERSION_10_9 1090
+#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
#define HAVE_NATIVE_FS
diff --git a/src/nsterm.m b/src/nsterm.m
index b8dd8bc8ad2..0e8fc56fdd9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6963,7 +6963,8 @@ if (cols > 0 && rows > 0)
{
/* When making the frame visible for the first time or if there is just
one screen, we want to constrain. Other times not. */
- NSUInteger nr_screens = [[NSScreen screens] count];
+ NSArray *screens = [NSScreen screens];
+ NSUInteger nr_screens = [screens count], nr_eff_screens = 0, i;
struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
NSTRACE (constrainFrameRect);
NSTRACE_RECT ("input", frameRect);
@@ -6971,6 +6972,31 @@ if (cols > 0 && rows > 0)
if (ns_menu_bar_should_be_hidden ())
return frameRect;
+ if (nr_screens == 1)
+ return [super constrainFrameRect:frameRect toScreen:screen];
+
+#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])
+ return [super constrainFrameRect:frameRect toScreen:screen];
+#endif
+#endif
+
+ for (i = 0; i < nr_screens; ++i)
+ {
+ NSScreen *s = [screens objectAtIndex: i];
+ NSRect scrrect = [s frame];
+ NSRect intersect = NSIntersectionRect (frameRect, scrrect);
+
+ if (intersect.size.width > 0 || intersect.size.height > 0)
+ ++nr_eff_screens;
+ }
+
+ if (nr_eff_screens == 1)
+ return [super constrainFrameRect:frameRect toScreen:screen];
+
/* The default implementation does two things 1) ensure that the top
of the rectangle is below the menu bar (or below the top of the
screen) and 2) resizes windows larger than the screen. As we