Re: NSScreen.screens under multiple displays
Re: NSScreen.screens under multiple displays
- Subject: Re: NSScreen.screens under multiple displays
- From: Rob Petrovec via Cocoa-dev <email@hidden>
- Date: Thu, 8 Jun 2023 11:45:19 -0600
The order of the screens can change under various user scenarios. One easy one
is simply re-arranging the displays, or even moving the menu bar thing from one
display to another in the Arrange UI Displays prefs pane. Obviously plugging &
unplugging displays or closing a laptop with an external display will change it
too. You should not assume the index of the screen your window is on, if that
is what you were thinking. Hope that helps.
—Rob
> On Jun 8, 2023, at 10:53 AM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> In my method
>
> - (void) viewDidMoveToWindow
>
> I have these lines of code:
>
> window_ = [self window];
> NSUInteger idx_of_screen = [NSScreen.screens indexOfObject:
> window_.screen];
>
> My question is: will this always produce the same results, whether or not the
> user has switched "Displays have separate Spaces" on or off (under Desktop &
> Dock).
>
>
> Best regards, Gabriel
>
> _______________________________________________
>
> 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