added a message runner so that rendering screensaver is resumed after some time has passed

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13980 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2005-08-19 09:26:45 +00:00
parent 31ac1cfb0b
commit 056ae67fb4
2 changed files with 17 additions and 1 deletions

View File

@ -17,6 +17,8 @@
#include "ScreenSaverApp.h"
const int32 RESUME_SAVER = 'RSSV';
// Start the server application. Set pulse to fire once per second.
// Run until the application quits.
@ -30,7 +32,8 @@ int main(int, char**)
// Construct the server app. Doesn't do much, at this point.
ScreenSaverApp::ScreenSaverApp()
: BApplication(SCREEN_BLANKER_SIG),
fWin(NULL)
fWin(NULL),
fRunner(NULL)
{
fBlankTime = system_time();
}
@ -75,6 +78,8 @@ ScreenSaverApp::ShowPW()
fPww->Sync();
}
fWin->Unlock();
delete fRunner;
fRunner = new BMessageRunner(BMessenger(this), new BMessage(RESUME_SAVER), fPref.BlankTime(), 1);
}
@ -89,12 +94,21 @@ ScreenSaverApp::MessageReceived(BMessage *message)
if (strcmp(crypt(fPww->GetPassword(), salt),fPref.Password()) != 0) {
beep();
fPww->SetPassword("");
delete fRunner;
fRunner = new BMessageRunner(BMessenger(this), new BMessage(RESUME_SAVER), fPref.BlankTime(), 1);
} else {
PRINT(("Quitting!\n"));
Shutdown();
}
break;
}
case RESUME_SAVER:
fWin->Lock();
if (B_OK==fWin->SetFullScreen(true)) {
HideCursor();
}
resume_thread(fThreadID);
fWin->Unlock();
default:
BApplication::MessageReceived(message);
break;

View File

@ -7,6 +7,7 @@
#define SCREEN_SAVER_APP_H
#include <Application.h>
#include <MessageRunner.h>
#include "SSAwindow.h"
#include "ScreenSaverPrefs.h"
#include "ScreenSaverThread.h"
@ -30,6 +31,7 @@ private:
thread_id fThreadID;
uint32 fBlankTime;
BMessageRunner *fRunner;
void Shutdown();
};