* Big time cleanup of the screen saver stuff, not yet finished yet, though.

Renamed lots of things, like ScreenSaverThread to ScreenSaverRunner,
  refactored code, etc. Much cleaner interfaces and code.
* Fixed a couple of bugs and in the add-on handling, especially some settings
  related bugs (ie. testing a screen saver will now use its latest settings,
  etc.).
* Correctly implemented DPMS support in ScreenSaverPrefs and the ScreenSaver
  preferences application - screen_blanker still ignores them, though.
* It's not yet font sensitive either.
* Changed the input_server add-on to not switch to the screen blanker immediately
  when it's in the "blank corner" - doesn't seem to work yet, though (only tested
  under Qemu).
* Correctly implemented the "preview" function (before, a screen saver would
  never know it rendered a preview).
* Evaluates the return value of BScreenSaver::StartSaver().
* The screen saver thread is no longer killed without notice - it's now
  always shut down properly.
* Made the code more robust against failure.
* Introduced some new bugs as well (the screen saver list view doesn't jump to
  the selection anymore, for some reason), those will be fixed later (as the
  remaining issues).
* Probably some more I forgot about.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17731 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-06-06 08:16:46 +00:00
parent ef1974cb9d
commit 7cae4a1ee0
23 changed files with 1478 additions and 1211 deletions
+50 -57
View File
@@ -1,82 +1,75 @@
#if ! defined _SCREENSAVER_H
/*
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SCREENSAVER_H
#define _SCREENSAVER_H
#include <BeBuild.h>
#include <DirectWindow.h> // for direct_buffer_info
#include <DirectWindow.h>
#include <image.h>
#include <Message.h>
class BView;
class BScreenSaver
{
public:
BScreenSaver(BMessage *archive, image_id);
virtual ~BScreenSaver();
// Return an error if something goes wrong or if you don't
// like the running environment (lack of 3D acceleration,
// lack of sound, ...).
virtual status_t InitCheck();
class BScreenSaver {
public:
BScreenSaver(BMessage* archive, image_id thisImage);
virtual ~BScreenSaver();
// Animation start and stop. The view is not yet visible when
// StartSaver is called.
virtual status_t StartSaver(BView *view, bool preview);
virtual void StopSaver();
virtual status_t InitCheck();
// This hook is called periodically, you should
// override it to do the drawing. Notice that you
// should clear the screen when frame == 0 if you
// don't want to paint over the desktop.
virtual void Draw(BView *view, int32 frame);
virtual status_t StartSaver(BView* view, bool preview);
virtual void StopSaver();
// These hooks are for direct screen access, the first is
// called every time the settings change, the second is
// the equivalent of Draw to be called to access the screen
// directly. Draw and DirectDraw can be used at the same time.
virtual void DirectConnected(direct_buffer_info *info);
virtual void DirectDraw(int32 frame);
virtual void Draw(BView* view, int32 frame);
// configuration dialog methods
virtual void StartConfig(BView *configView);
virtual void StopConfig();
// direct screen access
virtual void DirectConnected(direct_buffer_info* info);
virtual void DirectDraw(int32 frame);
// Module should fill this in with metadata
// example: randomizable = true
virtual void SupplyInfo(BMessage *info) const;
// configuration dialog methods
virtual void StartConfig(BView* configView);
virtual void StopConfig();
// Send all the metadata info to the module
virtual void ModulesChanged(const BMessage *info);
// Module should fill this in with metadata
// example: randomizable = true
virtual void SupplyInfo(BMessage* info) const;
// BArchivable like parameter saver method
virtual status_t SaveState(BMessage *into) const;
// Send all the metadata info to the module
virtual void ModulesChanged(const BMessage* info);
// These methods can be used to control drawing frequency.
void SetTickSize(bigtime_t ts);
bigtime_t TickSize() const;
// BArchivable like parameter saver method
virtual status_t SaveState(BMessage* into) const;
// These methods can be used to control animation loop cycles
void SetLoop(int32 on_count, int32 off_count);
int32 LoopOnCount() const;
int32 LoopOffCount() const;
// These methods can be used to control drawing frequency.
void SetTickSize(bigtime_t tickSize);
bigtime_t TickSize() const;
private:
virtual void _ReservedScreenSaver1();
virtual void _ReservedScreenSaver2();
virtual void _ReservedScreenSaver3();
virtual void _ReservedScreenSaver4();
virtual void _ReservedScreenSaver5();
virtual void _ReservedScreenSaver6();
virtual void _ReservedScreenSaver7();
virtual void _ReservedScreenSaver8();
// These methods can be used to control animation loop cycles
void SetLoop(int32 onCount, int32 offCount);
int32 LoopOnCount() const;
int32 LoopOffCount() const;
bigtime_t ticksize;
int32 looponcount;
int32 loopoffcount;
private:
virtual void _ReservedScreenSaver1();
virtual void _ReservedScreenSaver2();
virtual void _ReservedScreenSaver3();
virtual void _ReservedScreenSaver4();
virtual void _ReservedScreenSaver5();
virtual void _ReservedScreenSaver6();
virtual void _ReservedScreenSaver7();
virtual void _ReservedScreenSaver8();
uint32 _reservedScreenSaver[6];
bigtime_t fTickSize;
int32 fLoopOnCount;
int32 fLoopOffCount;
uint32 _reserved[6];
};
extern "C" _EXPORT BScreenSaver *instantiate_screen_saver(BMessage *msg, image_id id);
#endif
#endif // _SCREENSAVER_H