Fixed a bug in the screen saver code that could cause someone to get locked out

of their machine: if the password check is turned on, and the password window
is shown but times out (when the screen saver starts again after the standard
delay), the input filter never knew about this and would never try to end the
screen saver again.

The solution is to take the logic for turning off the screen saver out of the
input filter and put it in the screen blanker itself.

Also while working in the input filter I removed some debugging and a TODO that
I think cannot be fixed.

In the screen_blanker the exit after loading the settings file was removed
since the default settings now work for the screen_blanker.

Plus obviously code was added to handle exit upon user input as well as the
timing out of the password window.

If anyone has a better solution for the 250ms timeout to ignore initial mouse
moves, let me know.

Also I think the new calls should be nothrow, but I am not sure what the rule
is for that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29488 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood
2009-03-13 04:51:52 +00:00
parent f451e14bc2
commit cb6a084f20
5 changed files with 113 additions and 63 deletions
@@ -9,6 +9,26 @@
#include "ScreenSaver.h"
#include <DirectWindow.h>
#include <MessageFilter.h>
#include <MessageRunner.h>
const static uint32 kMsgEnableFilter = 'eflt';
class ScreenSaverFilter : public BMessageFilter {
public:
ScreenSaverFilter()
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
fEnabled(false) {}
virtual filter_result Filter(BMessage* message, BHandler** target);
void SetEnabled(bool enabled);
private:
bool fEnabled;
};
class ScreenSaverWindow : public BDirectWindow {
@@ -18,12 +38,15 @@ class ScreenSaverWindow : public BDirectWindow {
void SetSaver(BScreenSaver *saver);
virtual void MessageReceived(BMessage *message);
virtual bool QuitRequested();
virtual void DirectConnected(direct_buffer_info *info);
private:
BView *fTopView;
BScreenSaver *fSaver;
ScreenSaverFilter *fFilter;
BMessageRunner *fEnableRunner;
};
#endif // SCREEN_SAVER_WINDOW_H