RE: Move window to second display
RE: Move window to second display
- Subject: RE: Move window to second display
- From: "Gary L. Wade" <email@hidden>
- Date: Wed, 16 Jul 2008 13:58:22 -0400
Try breaking out the call path to examine each succeeding value when assigning a value to display. One thing that jumps out at me: are you running this in 64-bit mode? The size of an int in 64-bit mode is 32 bits but a CGDirectDisplayID may have 64 significant bits as it's technically a pointer. I'm not sure how many bits are significant in a CGDirectDisplayID when run in 64-bit mode; at least, if I were Apple, I'd just leave 32 bits significant for cases like this, but I'd still check that.
>Hi,
>
>I only have one monitor, so I'm having a bit of a problem figuring this out.
>
>I have a (borderless) window that should be displayed on any display
>chosen by the user. I figured the code below would do the trick, but
>apparently it's a no go (I use setFrameFromString: when the app is
>launched; this is when settings are changed during runtime):
>
>NSRect screenRect = [[NSScreen mainScreen] frame];
>NSArray *screens = [NSScreen screens];
>int preferredDisplay = [[[NSUserDefaults standardUserDefaults]
>objectForKey:@"PreferredDisplayID"] intValue];
>
>for (id screen in screens ) {
> CGDirectDisplayID display = (CGDirectDisplayID) [[[screen
>deviceDescription] valueForKey:@"NSScreenNumber"] unsignedIntValue];
> if ( preferredDisplay == display ) {
> screenRect = [screen frame];
> break;
> }
>}
>
>[win setFrame:screenRect display:YES];
>
>
>Please advice.
>
>Thanks
>F.
>_______________________________________________
>
>Cocoa-dev mailing list (email@hidden)
>
>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:
>
>
>This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden