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:
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include "ScreenSaverApp.h"
|
#include "ScreenSaverApp.h"
|
||||||
|
|
||||||
|
const int32 RESUME_SAVER = 'RSSV';
|
||||||
|
|
||||||
|
|
||||||
// Start the server application. Set pulse to fire once per second.
|
// Start the server application. Set pulse to fire once per second.
|
||||||
// Run until the application quits.
|
// Run until the application quits.
|
||||||
@@ -30,7 +32,8 @@ int main(int, char**)
|
|||||||
// Construct the server app. Doesn't do much, at this point.
|
// Construct the server app. Doesn't do much, at this point.
|
||||||
ScreenSaverApp::ScreenSaverApp()
|
ScreenSaverApp::ScreenSaverApp()
|
||||||
: BApplication(SCREEN_BLANKER_SIG),
|
: BApplication(SCREEN_BLANKER_SIG),
|
||||||
fWin(NULL)
|
fWin(NULL),
|
||||||
|
fRunner(NULL)
|
||||||
{
|
{
|
||||||
fBlankTime = system_time();
|
fBlankTime = system_time();
|
||||||
}
|
}
|
||||||
@@ -75,6 +78,8 @@ ScreenSaverApp::ShowPW()
|
|||||||
fPww->Sync();
|
fPww->Sync();
|
||||||
}
|
}
|
||||||
fWin->Unlock();
|
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) {
|
if (strcmp(crypt(fPww->GetPassword(), salt),fPref.Password()) != 0) {
|
||||||
beep();
|
beep();
|
||||||
fPww->SetPassword("");
|
fPww->SetPassword("");
|
||||||
|
delete fRunner;
|
||||||
|
fRunner = new BMessageRunner(BMessenger(this), new BMessage(RESUME_SAVER), fPref.BlankTime(), 1);
|
||||||
} else {
|
} else {
|
||||||
PRINT(("Quitting!\n"));
|
PRINT(("Quitting!\n"));
|
||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case RESUME_SAVER:
|
||||||
|
fWin->Lock();
|
||||||
|
if (B_OK==fWin->SetFullScreen(true)) {
|
||||||
|
HideCursor();
|
||||||
|
}
|
||||||
|
resume_thread(fThreadID);
|
||||||
|
fWin->Unlock();
|
||||||
default:
|
default:
|
||||||
BApplication::MessageReceived(message);
|
BApplication::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#define SCREEN_SAVER_APP_H
|
#define SCREEN_SAVER_APP_H
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <MessageRunner.h>
|
||||||
#include "SSAwindow.h"
|
#include "SSAwindow.h"
|
||||||
#include "ScreenSaverPrefs.h"
|
#include "ScreenSaverPrefs.h"
|
||||||
#include "ScreenSaverThread.h"
|
#include "ScreenSaverThread.h"
|
||||||
@@ -30,6 +31,7 @@ private:
|
|||||||
|
|
||||||
thread_id fThreadID;
|
thread_id fThreadID;
|
||||||
uint32 fBlankTime;
|
uint32 fBlankTime;
|
||||||
|
BMessageRunner *fRunner;
|
||||||
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user