Author: manolo
Date: 2011-11-14 07:15:03 -0800 (Mon, 14 Nov 2011)
New Revision: 9176
Log:
Mac OS: better window positioning on secondary displays at creation.

Modified:
   branches/branch-1.3/src/Fl_cocoa.mm

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-11-13 09:13:26 UTC (rev 9175)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-11-14 15:15:03 UTC (rev 9176)
@@ -576,21 +576,7 @@
              contentRect:(NSRect)rect 
                styleMask:(NSUInteger)windowStyle 
 {
-  NSScreen *gd = nil; // gd will point to the screen containing the 
bottom-left of rect
-  NSArray *a = [NSScreen screens]; 
-  for(NSUInteger i = 0; i < [a count]; i++) {
-    NSRect r = [[a objectAtIndex:i] frame];
-    if (rect.origin.x >= r.origin.x && rect.origin.x <= r.origin.x + 
r.size.width
-        && rect.origin.y >= r.origin.y && rect.origin.y <= r.origin.y + 
r.size.height) {
-      gd = [a objectAtIndex:i];
-      rect.origin.x -= r.origin.x; // express rect relatively to gd's origin
-      rect.origin.y -= r.origin.y;
-      break;
-      }
-  }
-  // attempt to create the window on screen gd
-  self = [super initWithContentRect:rect styleMask:windowStyle 
backing:NSBackingStoreBuffered defer:NO
-         screen:gd];
+  self = [super initWithContentRect:rect styleMask:windowStyle 
backing:NSBackingStoreBuffered defer:NO];
   if (self) {
     w = flw;
     containsGLsubwindow = NO;
@@ -2077,6 +2063,7 @@
     FLWindow *cw = [[FLWindow alloc] initWithFl_W:w 
                                      contentRect:crect  
                                        styleMask:winstyle];
+    [cw setFrameOrigin:crect.origin];
     [cw setHasShadow:YES];
     [cw setAcceptsMouseMovedEvents:YES];
     x->xid = cw;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to