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 
> <cocoa-dev@lists.apple.com> 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 (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/petrock%40mac.com
> 
> This email sent to petr...@mac.com

_______________________________________________

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