Exit screen saver programmatically?

2009-09-23 Thread Gabriel Zachmann
Does anyone know whether it is possible to exit a screensaver programmatically, i.e., from within the screensaver code, but *without* exiting the System Preferences, if the screensaver was run from System Preferences? I tried [NSApp terminate: self] but that also makes System Preferences

Re: Exit screen saver programmatically?

2009-09-23 Thread Nick Zitzmann
On Sep 23, 2009, at 4:39 PM, Gabriel Zachmann wrote: Does anyone know whether it is possible to exit a screensaver programmatically, i.e., from within the screensaver code, but *without* exiting the System Preferences, if the screensaver was run from System Preferences? It's possible; you'

Re: Exit screen saver programmatically?

2009-09-24 Thread Gabriel Zachmann
Post a mouse down event and the sceensaver engine will remove it for you. That is a good idea -- except I have no idea how to do that. Could you give me a hint how to achieve that? (class / method names?) (Sorry, for asking shuch a dumbquestion.) BTW: just a mouse move event would suffice, is t

Re: Exit screen saver programmatically?

2009-09-24 Thread Nick Zitzmann
On Sep 24, 2009, at 2:14 AM, Gabriel Zachmann wrote: I want to catch a few key events in my screen saver (like cursor keys, space, return), but if the user clicks any other key, I want the screen saver to exit, just like other screen savers that don't catch any keyboard events. In that c

Re: Exit screen saver programmatically?

2009-09-24 Thread Gabriel Zachmann
In that case, then you should pass the unwanted event to the superclass, which will handle the event in that case. Ah, you mean like this, I suppose? [super keyDown: theEvent]; That seems to work like a charm. Thanks a million! (For the record, I thought that user code is not

Re: Exit screen saver programmatically?

2009-09-24 Thread John Horigan
If you send the unwanted events to ScreenSaverView parent of your view then it should terminate gracefully. [super theEvent]; -- john On Sep 24, 2009, at 1:14 AM, Gabriel Zachmann wrote: Post a mouse down event and the sceensaver engine will remove it for you. That is a good idea -- exc