Author: mlytwyn
Date: Mon Apr  7 18:19:28 2014
New Revision: 37790

URL: http://svn.gna.org/viewcvs/gnustep?rev=37790&view=rev
Log:
Attempt to fix windows lost in space

Modified:
    libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m?rev=37790&r1=37789&r2=37790&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m        
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m        Mon Apr 
 7 18:19:28 2014
@@ -389,7 +389,7 @@
 */
 - (NSScreen *) _screenForFrame: (NSRect)frame
 {
-  NSInteger  largest   = -1;
+  NSInteger  largest   = 0;
   NSArray   *screens   = [NSScreen screens];
   NSInteger  index     = 0;
   NSScreen  *theScreen = nil;
@@ -4856,8 +4856,8 @@
   if (screen == nil)
     {
       // If the window doesn't show up on any screen then we need
-      // to move it so it can be seen and assign it to the main
-      // screen...
+      // to move it so it can be seen and assign it to the screen
+      // at {0, 0}...
       screen = [NSScreen mainScreen];
       NSDebugLLog(@"NSWindow", @"%s: re-assigning to main screen\n", 
__PRETTY_FUNCTION__);
     }
@@ -4905,6 +4905,14 @@
       }
     }
 
+  // Another sanity check...
+  // Check again whether new window frame shows up on ANY screen...
+  if ([self _screenForFrame: fRect] == nil)
+    {
+      // Just center in first screen...
+      fRect = [self _centerFrame: fRect onScreen: [[NSScreen screens] 
objectAtIndex:0]];
+    }
+  
   // FIXME: Is this check needed?
   /* If we aren't resizable (ie. if we don't have a resize bar), make sure
      we don't change the size. */


_______________________________________________
Gnustep-cvs mailing list
Gnustep-cvs@gna.org
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to