Re: Cocoa-dev Digest, Vol 4, Issue 217

  • > From: David Gish <david...>
    > Subject: Screensaver question
    > To: <cocoa-dev...>
    > Message-ID: <54D845A1-2F3B-45C2-AFE9-BA75CB2F5A56...>
    > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
    >
    > Does anyone know of a way to capture keyboard and mouse events in an
    > OS X screensaver app in order to provide a degree of interactivity
    > and allow the screensaver code itself determine when to exit? I'm a
    > relative newbie to Cocoa, but it looks like this would require
    > modifying or replacing the default NSRunLoop instance
    > (currentRunLoop) so events can be redirected. Screen savers are
    > written essentially as plugins and stealing the run loop from the
    > host app (ScreenSaverEngine) seems very unkosher to me. And there's a
    > complicating factor. Sniffing around in gdb, it appears that a system
    > with one display runs ScreenSaverEngine and the screen saver itself
    > in a single thread, but with additional displays, a thread is spawned
    > for each screen saver.
    >
    > My idea at this point is to simply write a screensaver stub that
    > launches a real full-screen app. The control panel preview would have
    > to be handled separately. Any other ideas?
    >
    > Thanks,

    David,

    Did you ever get this working?  I'm finding it's easy to trap keyboard
    events in an ScreenSaverView, but having no luck capturing mouse
    movement.  I too am trying to have my screensaver launch a second app
    that takes over the screen.

    -mike
  • On Nov 13, 2007, at 10:06 AM, Michael Diehr wrote:

    > Did you ever get this working?  I'm finding it's easy to trap
    > keyboard events in an ScreenSaverView, but having no luck capturing
    > mouse movement.  I too am trying to have my screensaver launch a
    > second app that takes over the screen.

    I was able to do this fairly easily in Skyrocket. You can take a look
    at the source code, which is available here: <http://seiryu.home.comcast.net/savers.html>

    Nick Zitzmann
    <http://www.chronosnet.com/>
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today