Hi everybody,

I have two screens on my MacPro (10.7.3)

When opening a window with the following code :

    // create a reference rect
    NSRect  contentSize = NSMakeRect( iX, iY, iW, iH );

    // allocate window
    NSUInteger  styleMask =
        NSTitledWindowMask |
        NSClosableWindowMask |
        NSMiniaturizableWindowMask |
        NSResizableWindowMask;

    mWindow = [[NSWindow alloc] initWithContentRect: contentSize styleMask: 
styleMask backing: NSBackingStoreBuffered defer: YES];
    Cocoa_WindowDelegate*  delegate = [[Cocoa_WindowDelegate  alloc]  init];
    [mWindow  setDelegate: delegate];

    // show window
    [mWindow  makeKeyAndOrderFront: mWindow];
    [mWindow  makeMainWindow];

where iX,iY,iW,iH are the wanted position and w/h of the window, the window always 
"snaps" to the main screen.
It's y,w,h are correct, but x is adjusted so the window either fits entirely on the main screen (flush at the right border), or if it's too wide, x is set to 0. Even if the asked for position is entirely on the second screen and doesn't straddle the boundary between the screens.
Other apps don't have this problem.

What am I doing wrong or what did I forget to do ?

Thanks for your help.

--
Eric M.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to