Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-12-13 Thread Steve Mills via Cocoa-dev
> On Dec 13, 2022, at 13:50, Gabriel Zachmann via Cocoa-dev > wrote: > > 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

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-12-13 Thread Gabriel Zachmann via Cocoa-dev
> > 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

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-12-11 Thread Steve Mills via Cocoa-dev
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 > wrote: > > Thanks again for the responses. And sorry for

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-12-11 Thread Gabriel Zachmann via Cocoa-dev
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];

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Steve Mills via Cocoa-dev
> On Nov 17, 2022, at 16:11, Gabriel Zachmann via Cocoa-dev > wrote: > > 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)

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Gabriel Zachmann via Cocoa-dev
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 =

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Steve Mills via Cocoa-dev
> On Nov 17, 2022, at 11:59, Jack Brindle via Cocoa-dev > wrote: > > The NSScreen screen property is nullable. From the docs for NSWindow screen: > > "The value of this property is the screen where most of the window is on; it > is nil when the window is offscreen." If a screensaver window

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Jack Brindle via Cocoa-dev
The NSScreen screen property is nullable. From the docs for NSWindow screen: "The value of this property is the screen where most of the window is on; it is nil when the window is offscreen." I would go with Steve’s suggestion as much as possible, The NSScreen class has the info you need.

Re: Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Steve Mills via Cocoa-dev
> On Nov 17, 2022, at 10:44, Gabriel Zachmann via Cocoa-dev > wrote: > > In my screensaver (macOS), > I am trying to retrieve the 'screen number' (NSScreenNumber) for the screen > on which I am running. [NSScreen.screens indexOfObject:window.screen] gives you the zero-based screen index. 0

Proper way to retrieve the NSScreenNumber in a screen saver ?

2022-11-17 Thread Gabriel Zachmann via Cocoa-dev
In my screensaver (macOS), I am trying to retrieve the 'screen number' (NSScreenNumber) for the screen on which I am running. So, in - (void) viewWillMoveToWindow: (NSWindow *) newWindow I have this line of code: displayID_ = [ [[newWindow screen] deviceDescription] objectForKey: