Author: manolo
Date: 2011-10-18 04:46:29 -0700 (Tue, 18 Oct 2011)
New Revision: 9134
Log:
When several screens, allow creation of window on secondary screen by
Fl_Window::Fl_Window(x,y,w,h,title).
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-10-17 13:46:31 UTC (rev 9133)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-10-18 11:46:29 UTC (rev 9134)
@@ -577,7 +577,21 @@
contentRect:(NSRect)rect
styleMask:(NSUInteger)windowStyle
{
- self = [super initWithContentRect:rect styleMask:windowStyle
backing:NSBackingStoreBuffered defer:NO];
+ 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];
if (self) {
w = flw;
containsGLsubwindow = NO;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit