Thanks a lot for your quick responses!

I would like to understand what you are saying and what is going on, so please 
bear with me.


So, Steve, if I understand correctly, you suggest to write:

- (void) viewWillMoveToWindow: (NSWindow *) newWindow
{
    unsigned long my_screen = [NSScreen.screens indexOfObject: [newWindow 
screen]];
    displayID_ = [[ [NSScreen.screens[my_screen] deviceDescription] 
objectForKey: @"NSScreenNumber"];
...
}

How is this better than using [newWindow screen] directly?

And how can it happen that [newWindow screen] is NULL, as Jack has cited from 
the docs, when my screensaver is running in System Preference's Preview window?
Only when I click on a different screensaver, then switch back to mine, does 
[newWindow screen] get a proper value, most of the time.


What about
  [NSScreen mainScreen]
?


> If a screensaver window is not onscreen, there?s no screen to save, so it 
> wouldn?t matter.

How can a screensaver get launched by macOS and *not* be on screen?
Note that viewWillMoveToWindow gets called inly once during the lifetime of a 
screensaver.

(Unless, maybe, it is running in System Preference's preview window, and the 
user moves the System Preferences window to a different screen. but that is of 
no concern right now.)


Best regards, Gabriel


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