moved screensaver server to screen_blanker bin

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13875 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2005-08-02 09:21:22 +00:00
parent 4bf7f3047f
commit 143f3a8060
11 changed files with 126 additions and 93 deletions
+1
View File
@@ -128,6 +128,7 @@ SubInclude OBOS_TOP src bin patch ;
SubInclude OBOS_TOP src bin pc ; SubInclude OBOS_TOP src bin pc ;
SubInclude OBOS_TOP src bin playsound ; SubInclude OBOS_TOP src bin playsound ;
SubInclude OBOS_TOP src bin rmd160 ; SubInclude OBOS_TOP src bin rmd160 ;
SubInclude OBOS_TOP src bin screen_blanker ;
SubInclude OBOS_TOP src bin sed ; SubInclude OBOS_TOP src bin sed ;
SubInclude OBOS_TOP src bin sharutils ; SubInclude OBOS_TOP src bin sharutils ;
SubInclude OBOS_TOP src bin strace ; SubInclude OBOS_TOP src bin strace ;
+11
View File
@@ -0,0 +1,11 @@
SubDir OBOS_TOP src bin screen_blanker ;
UsePrivateHeaders screen_saver ;
BinCommand screen_blanker :
ScreenSaverApp.cpp
SSAwindow.cpp
pwWindow.cpp
: be game libscreensaver.so
;
@@ -1,13 +1,15 @@
/*
* Copyright 2003, Michael Phipps. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "SSAwindow.h" #include "SSAwindow.h"
#include "Locker.h" #include <View.h>
#include "View.h"
#include <memory.h>
#include <stdlib.h>
#include <stdio.h>
// This is the BDirectWindow subclass that rendering occurs in. // This is the BDirectWindow subclass that rendering occurs in.
// A view is added to it so that BView based screensavers will work. // A view is added to it so that BView based screensavers will work.
SSAwindow::SSAwindow(BRect frame) : BDirectWindow(frame, "ScreenSaver Window", SSAwindow::SSAwindow(BRect frame)
: BDirectWindow(frame, "ScreenSaver Window",
B_BORDERED_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE) , fSaver(NULL) B_BORDERED_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE) , fSaver(NULL)
{ {
frame.OffsetTo(0,0); frame.OffsetTo(0,0);
@@ -29,9 +31,11 @@ SSAwindow::QuitRequested(void)
return true; return true;
} }
void void
SSAwindow::DirectConnected(direct_buffer_info *info) SSAwindow::DirectConnected(direct_buffer_info *info)
{ {
if (fSaver) if (fSaver)
fSaver->DirectConnected(info); fSaver->DirectConnected(info);
} }
@@ -1,4 +1,9 @@
#include "DirectWindow.h" /*
* Copyright 2003, Michael Phipps. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <DirectWindow.h>
#include "ScreenSaver.h" #include "ScreenSaver.h"
class SSAwindow : public BDirectWindow { class SSAwindow : public BDirectWindow {
@@ -13,3 +18,4 @@ public:
private: private:
BScreenSaver *fSaver; BScreenSaver *fSaver;
}; };
@@ -1,16 +1,20 @@
#ifndef SCREEN_SAVER_H /*
#include "ScreenSaverApp.h" * Copyright 2003, Michael Phipps. All rights reserved.
#endif * Distributed under the terms of the MIT License.
*/
#include <stdio.h> #include <stdio.h>
#include "Screen.h" #include <Screen.h>
#include "image.h" #include <image.h>
#include "StorageDefs.h" #include <StorageDefs.h>
#include "FindDirectory.h" #include <FindDirectory.h>
#include "SupportDefs.h" #include <SupportDefs.h>
#include "File.h" #include <File.h>
#include "Path.h" #include <Path.h>
#include "string.h" #include <string.h>
#include "Beep.h" #include <Beep.h>
#include <ScreenSaverApp.h>
// Start the server application. Set pulse to fire once per second. // Start the server application. Set pulse to fire once per second.
@@ -23,9 +27,11 @@ 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() : BApplication("application/x-vnd.OBOS-ScreenSaverApp"),fWin(NULL) ScreenSaverApp::ScreenSaverApp()
: BApplication("application/x-vnd.OBOS-ScreenSaverApp"),
fWin(NULL)
{ {
fBlankTime=real_time_clock(); fBlankTime = system_time();
} }
@@ -37,7 +43,7 @@ ScreenSaverApp::ReadyToRun(void)
else { // If everything works OK, create a BDirectWindow and start the render thread. else { // If everything works OK, create a BDirectWindow and start the render thread.
BScreen theScreen(B_MAIN_SCREEN_ID); BScreen theScreen(B_MAIN_SCREEN_ID);
fWin = new SSAwindow(theScreen.Frame()); fWin = new SSAwindow(theScreen.Frame());
fPww=new pwWindow(); fPww = new PasswordWindow();
fThrd = new ScreenSaverThread(fWin,fWin->fView,&fPref); fThrd = new ScreenSaverThread(fWin,fWin->fView,&fPref);
fSaver = fThrd->LoadAddOn(); fSaver = fThrd->LoadAddOn();
@@ -46,7 +52,7 @@ ScreenSaverApp::ReadyToRun(void)
fWin->SetSaver(fSaver); fWin->SetSaver(fSaver);
fWin->SetFullScreen(true); fWin->SetFullScreen(true);
fWin->Show(); fWin->Show();
fThreadID=spawn_thread(threadFunc,"ScreenSaverRenderer",0,fThrd); fThreadID = spawn_thread(ScreenSaverThread::ThreadFunc,"ScreenSaverRenderer",0,fThrd);
resume_thread(fThreadID); resume_thread(fThreadID);
HideCursor(); HideCursor();
} }
@@ -82,14 +88,14 @@ ScreenSaverApp::MessageReceived(BMessage *message)
} }
else { else {
printf ("Quitting!\n"); printf ("Quitting!\n");
shutdown(); Shutdown();
} }
break; break;
case 'MOO1': case 'MOO1':
if (real_time_clock()-fBlankTime>fPref.PasswordTime()) if (real_time_clock()-fBlankTime>fPref.PasswordTime())
ShowPW(); ShowPW();
else else
shutdown(); Shutdown();
break; break;
default: default:
BApplication::MessageReceived(message); BApplication::MessageReceived(message);
@@ -99,7 +105,7 @@ ScreenSaverApp::MessageReceived(BMessage *message)
void void
ScreenSaverApp::shutdown(void) ScreenSaverApp::Shutdown(void)
{ {
if (fWin) if (fWin)
fWin->Hide(); fWin->Hide();
@@ -1,9 +1,12 @@
#ifndef SCREEN_SAVER_H /*
#define SCREEN_SAVER_H * Copyright 2003, Michael Phipps. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef SCREEN_SAVER_APP_H
#define SCREEN_SAVER_APP_H
#ifndef _APPLICATION_H
#include <Application.h> #include <Application.h>
#endif
#include "SSAwindow.h" #include "SSAwindow.h"
#include "ScreenSaverPrefs.h" #include "ScreenSaverPrefs.h"
#include "ScreenSaverThread.h" #include "ScreenSaverThread.h"
@@ -13,23 +16,23 @@ class ScreenSaverApp : public BApplication
{ {
public: public:
ScreenSaverApp(); ScreenSaverApp();
bool LoadAddOn(void); bool LoadAddOn();
void ReadyToRun(void); void ReadyToRun();
// bool QuitRequested(void); // bool QuitRequested();
// void Quit(void); // void Quit();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
void ShowPW(void); void ShowPW();
private: private:
ScreenSaverPrefs fPref; ScreenSaverPrefs fPref;
SSAwindow *fWin; SSAwindow *fWin;
BScreenSaver *fSaver; BScreenSaver *fSaver;
ScreenSaverThread *fThrd; ScreenSaverThread *fThrd;
pwWindow *fPww; PasswordWindow *fPww;
thread_id fThreadID; thread_id fThreadID;
uint32 fBlankTime; uint32 fBlankTime;
void shutdown(void); void Shutdown();
}; };
#endif //SCREEN_SAVER_H #endif //SCREEN_SAVER_APP_H
@@ -1,10 +1,15 @@
/*
* Copyright 2003, Michael Phipps. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <Application.h>
#include <Screen.h>
#include "pwWindow.h" #include "pwWindow.h"
#include "Screen.h"
#include <stdio.h>
#include "Application.h"
void void
pwWindow::setup(void) PasswordWindow::Setup()
{ {
BScreen theScreen(B_MAIN_SCREEN_ID); BScreen theScreen(B_MAIN_SCREEN_ID);
MoveTo((theScreen.Frame().IntegerWidth()-Bounds().IntegerWidth())/2,(theScreen.Frame().IntegerHeight()-Bounds().IntegerHeight())/2); MoveTo((theScreen.Frame().IntegerWidth()-Bounds().IntegerWidth())/2,(theScreen.Frame().IntegerHeight()-Bounds().IntegerHeight())/2);
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright 2003, Michael Phipps. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef PASSWORDWINDOW_H
#define PASSWORDWINDOW_H
#include <Window.h>
#include <Box.h>
#include <TextControl.h>
#include <Button.h>
class PasswordWindow : public BWindow
{
public:
PasswordWindow() : BWindow(BRect(100,100,400,230),"pwView",B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL ,
B_NOT_MOVABLE | B_NOT_CLOSABLE |B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS ,
B_ALL_WORKSPACES), fDie(false) { Setup(); }
void Setup(void);
const char *GetPassword(void) {return fPassword->Text();}
bool fDie;
private:
BView *fBgd;
BBox *fCustomBox;
BTextControl *fPassword;
BButton *fUnlock;
};
#endif // PASSWORDWINDOW_H
-1
View File
@@ -11,5 +11,4 @@ SubInclude OBOS_TOP src servers midi ;
SubInclude OBOS_TOP src servers power ; SubInclude OBOS_TOP src servers power ;
SubInclude OBOS_TOP src servers print ; SubInclude OBOS_TOP src servers print ;
SubInclude OBOS_TOP src servers registrar ; SubInclude OBOS_TOP src servers registrar ;
SubInclude OBOS_TOP src servers screensaver ;
SubInclude OBOS_TOP src servers syslog_daemon ; SubInclude OBOS_TOP src servers syslog_daemon ;
-10
View File
@@ -1,10 +0,0 @@
SubDir OBOS_TOP src servers screensaver ;
UsePrivateHeaders screen_saver ;
Server OBOSscreensaver :
ScreenSaverApp.cpp
SSAwindow.cpp
pwWindow.cpp
;
LinkSharedOSLibs OBOSscreensaver : be game libscreensaver.so ;
-22
View File
@@ -1,22 +0,0 @@
#include "Window.h"
#include "Box.h"
#include "TextControl.h"
#include "Button.h"
class pwWindow : public BWindow
{
public:
pwWindow (void) : BWindow(BRect(100,100,400,230),"pwView",B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL ,
B_NOT_MOVABLE | B_NOT_CLOSABLE |B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS ,
B_ALL_WORKSPACES), fDie(false) {setup();}
void setup(void);
const char *GetPassword(void) {return fPassword->Text();}
bool fDie;
private:
BView *fBgd;
BBox *fCustomBox;
BTextControl *fPassword;
BButton *fUnlock;
};