emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116706: * nsterm.h (MAC_OS_X_VERSION_10_9): Add.


From: Jan D.
Subject: [Emacs-diffs] trunk r116706: * nsterm.h (MAC_OS_X_VERSION_10_9): Add.
Date: Sat, 08 Mar 2014 15:50:05 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116706
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/14713
committer: Jan Djärv <address@hidden>
branch nick: trunk
timestamp: Sat 2014-03-08 16:49:59 +0100
message:
  * nsterm.h (MAC_OS_X_VERSION_10_9): Add.
  
  * nsterm.m (constrainFrameRect:toScreen:): Constrain normally when frame
  is only on one screen.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/nsterm.h                   nsterm.h-20091113204419-o5vbwnq5f7feedwu-8746
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-03-08 10:54:43 +0000
+++ b/src/ChangeLog     2014-03-08 15:49:59 +0000
@@ -1,3 +1,10 @@
+2014-03-08  Jan Djärv  <address@hidden>
+
+       * 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  <address@hidden>
 
        * xdisp.c (move_it_in_display_line_to): If word-wrap is ON, and

=== modified file 'src/nsterm.h'
--- a/src/nsterm.h      2014-01-20 19:44:56 +0000
+++ b/src/nsterm.h      2014-03-08 15:49:59 +0000
@@ -42,6 +42,9 @@
 #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

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2014-02-16 09:51:41 +0000
+++ b/src/nsterm.m      2014-03-08 15:49:59 +0000
@@ -6963,7 +6963,8 @@
 {
   /* 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 (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]