>
> 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.
>
>

I am not interested in detecting whether or not my screensaver is running in 
System Prefs preview.

I am interested in the *screen* on which I am running, irrespective of whether 
it's inside System Prefs or as a fullscreen screensaver.

Best regards, Gabriel


>> 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?
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
>
> Cocoa-dev mailing list      (Cocoa-dev@lists.apple.com)
>
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins (at) lists.apple.com
>
> https://lists.apple.com/mailman/listinfo/cocoa-dev
>
>
> ------------------------------
>
> End of Cocoa-dev Digest, Vol 19, Issue 65
> *****************************************

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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