I mentioned somewhere in one of my replies that you know when it’s being run in 
the System Prefs preview because isPreview is passed to the main entry point.

Steve via iPad

> On Dec 11, 2022, at 14:56, Gabriel Zachmann via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> Thanks again for the responses. And sorry for following up so much later.
> (a bit of context is recapped below)
> 
> First of all, thanks for the hint to viewDidMoveToWindow.
> 
> So, currently , I do this in my viewDidMoveToWindow:
> 
> 
> - (void) viewDidMoveToWindow
> {
>    window_ = [self window];
>    NSUInteger idx_of_screen = [NSScreen.screens indexOfObject: 
> window_.screen];
>    displayID_ = [NSNumber numberWithUnsignedLong: idx_of_screen ];
> 
> 
> On my Mac this runs fine, and I get a proper idx_of_screen/displayID_;
> 
> However, one of my users sent me a log file, which shows that on his Mac, 
> [self window] is non-null, but indexOfObject: returns NSNotFound, in the case 
> where my screensaver is running in the preview of System Preferences.
> (One difference between the systems is that I am still using macOS 12, while 
> he is using macOS 13.)
> 
> I guess, there is not much I can do about it, except find some kind of 
> work-around for those cases, where this happens. Right?
_______________________________________________

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