wake from sleep
Ben Rubinstein
benr_mc at cogapp.com
Wed Aug 12 12:41:24 EDT 2009
Possibly helpful, but somewhat messy:
* at least on Mac, if the screensaver kicks in when your stack is on top, it
will get a 'suspendStack' message; when the user breaks out of the
screensaver, and the stack becomes active again, it gets a 'resumeStack' message
* at least on Mac, you can use shell commands to find out if the screensaver
is running (er, or applescript as Bnig proposed)
* so in principle, you could use shell commands whenever receiving a
'suspendStack' message to see if the screensaver is responsible for suspending
you; and then deal with the subsequent resumeStack message on the basis that
the screensaver must have ended.
However, this is of severely limited utility (I guess it could be helpful if
you were in a kiosk situation) because, among other reasons (leaving aside the
question of whether something similar happens on Windows):
* if you are suspended because some other app is bought to the front, and the
screensaver then kicks in, you'll never know about it
* if you have multiple stacks open, there's a long standing issue about Rev
bringing the wrong one to the front when Rev becomes the active app after not
being the active app. So depending on how your app is structured, the resume
following breaking out of the screensaver may not be received by the stack
that got the 'matching' suspend message. I guess that's relatively easy to
work around if all the stacks in your app are under your control.
So depending on your situation, you might be able to restrict the checking to
when you've received a suspendStack message.
A more solid approach: I believe that native Mac applications can receive a
signal when the screensaver kicks in, and another when it exits. So in theory
it could be trivial, at least on Mac, for the Rev engine to send
"screensaverStarted" and "screensaverStopped" messages, and you could post
that request in QC. However in practise I can't imagine that such a request
would be granted anytime soon. If your need is serious, though, it might be
quite simple to create a tiny helper app that receives such signals, and
passes them on to your app.
DTH,
Ben
More information about the use-livecode
mailing list