Patch by Obaro Ogbo (nastee) with small changes by myself: The check of the

input_server filter if the screen saver should be run could be confused if
additional option flags were turned on. I've removed the SAVER_DISABLED
definition completely. Also, I renamed the confusing "fEnabled" member, which
really means "saver already running".

Thanks a lot! Fixes ticket #3474.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30207 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-04-16 20:00:01 +00:00
parent b447670286
commit bd949d1715
3 changed files with 16 additions and 13 deletions

View File

@ -22,7 +22,6 @@ enum screen_corner {
// time flags // time flags
enum { enum {
SAVER_DISABLED = 0x00,
ENABLE_SAVER = 0x01, ENABLE_SAVER = 0x01,
ENABLE_DPMS_STAND_BY = 0x02, ENABLE_DPMS_STAND_BY = 0x02,
ENABLE_DPMS_SUSPEND = 0x04, ENABLE_DPMS_SUSPEND = 0x04,

View File

@ -67,7 +67,7 @@ ScreenSaverController::MessageReceived(BMessage *message)
const char *signature; const char *signature;
if (message->FindString("be:signature", &signature) == B_OK if (message->FindString("be:signature", &signature) == B_OK
&& strcasecmp(signature, SCREEN_BLANKER_SIG) == 0) { && strcasecmp(signature, SCREEN_BLANKER_SIG) == 0) {
fFilter->SetEnabled(message->what == B_SOME_APP_LAUNCHED); fFilter->SetIsRunning(message->what == B_SOME_APP_LAUNCHED);
} }
break; break;
} }
@ -100,7 +100,7 @@ ScreenSaverFilter::ScreenSaverFilter()
fCornerRunner(NULL), fCornerRunner(NULL),
fWatchingDirectory(false), fWatchingDirectory(false),
fWatchingFile(false), fWatchingFile(false),
fEnabled(false) fIsRunning(false)
{ {
fController = new (std::nothrow) ScreenSaverController(this); fController = new (std::nothrow) ScreenSaverController(this);
if (fController == NULL) if (fController == NULL)
@ -173,13 +173,16 @@ void
ScreenSaverFilter::_Invoke() ScreenSaverFilter::_Invoke()
{ {
if (fCurrentCorner == fNeverBlankCorner && fNeverBlankCorner != NO_CORNER if (fCurrentCorner == fNeverBlankCorner && fNeverBlankCorner != NO_CORNER
|| fSettings.TimeFlags() == SAVER_DISABLED || (fSettings.TimeFlags() & ENABLE_SAVER) == 0
|| fEnabled || fIsRunning
|| be_roster->IsRunning(SCREEN_BLANKER_SIG)) || be_roster->IsRunning(SCREEN_BLANKER_SIG))
return; return;
if (be_roster->Launch(SCREEN_BLANKER_SIG) == B_OK) if (be_roster->Launch(SCREEN_BLANKER_SIG) == B_OK) {
fEnabled = true; // Already set the running state to avoid launching
// the blanker twice in any case.
fIsRunning = true;
}
} }
@ -224,10 +227,11 @@ ScreenSaverFilter::ReloadSettings()
void void
ScreenSaverFilter::SetEnabled(bool enabled) ScreenSaverFilter::SetIsRunning(bool isRunning)
{ {
// called from the controller BLooper
BAutolock _(this); BAutolock _(this);
fEnabled = enabled; fIsRunning = isRunning;
} }
@ -247,7 +251,7 @@ ScreenSaverFilter::CheckTime()
// snooze for blankTime. // snooze for blankTime.
// Otherwise, there was an event in the middle of the last snooze, so snooze // Otherwise, there was an event in the middle of the last snooze, so snooze
// for the remainder. // for the remainder.
if (fEnabled || fLastEventTime + fBlankTime <= now) if (fIsRunning || fLastEventTime + fBlankTime <= now)
fSnoozeTime = fBlankTime; fSnoozeTime = fBlankTime;
else else
fSnoozeTime = fLastEventTime + fBlankTime - now; fSnoozeTime = fLastEventTime + fBlankTime - now;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2008, Haiku. * Copyright 2003-2009, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@ -47,7 +47,7 @@ public:
void CheckCornerInvoke(); void CheckCornerInvoke();
void ReloadSettings(); void ReloadSettings();
void SetEnabled(bool enabled); void SetIsRunning(bool isRunning);
private: private:
uint32 _SnoozeTime() {return fSnoozeTime;} uint32 _SnoozeTime() {return fSnoozeTime;}
@ -76,7 +76,7 @@ private:
bool fWatchingDirectory; bool fWatchingDirectory;
bool fWatchingFile; bool fWatchingFile;
bool fEnabled; bool fIsRunning;
}; };
#endif /* SCREEN_SAVER_FILTER_H */ #endif /* SCREEN_SAVER_FILTER_H */