Correct slight regression from r28777 - screen saver tick size can be adjusted dynamically, and thus we must update it after each complete tick. Fixes ticket #3211.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28792 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
ScreenSaverRunner::ScreenSaverRunner(BWindow* window, BView* view,
|
ScreenSaverRunner::ScreenSaverRunner(BWindow* window, BView* view,
|
||||||
bool preview, ScreenSaverSettings& settings)
|
bool preview, ScreenSaverSettings& settings)
|
||||||
:
|
:
|
||||||
@@ -181,10 +180,10 @@ ScreenSaverRunner::_Run()
|
|||||||
fHasStarted = fSaver->StartSaver(fView, fPreview) == B_OK;
|
fHasStarted = fSaver->StartSaver(fView, fPreview) == B_OK;
|
||||||
fWindow->Unlock();
|
fWindow->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 snoozeCount = 0;
|
int32 snoozeCount = 0;
|
||||||
int32 frame = 0;
|
int32 frame = 0;
|
||||||
int32 tickCounter = 0;
|
bigtime_t lastTickTime = system_time();
|
||||||
bigtime_t tick = fSaver ? fSaver->TickSize() : kTickBase;
|
bigtime_t tick = fSaver ? fSaver->TickSize() : kTickBase;
|
||||||
|
|
||||||
while (!fQuitting) {
|
while (!fQuitting) {
|
||||||
@@ -194,11 +193,16 @@ ScreenSaverRunner::_Run()
|
|||||||
// will result in the screen saver not responding to deactivation
|
// will result in the screen saver not responding to deactivation
|
||||||
// for that length of time
|
// for that length of time
|
||||||
snooze(kTickBase);
|
snooze(kTickBase);
|
||||||
if (++tickCounter * kTickBase < tick)
|
if (system_time() - lastTickTime < tick)
|
||||||
continue;
|
continue;
|
||||||
else
|
else {
|
||||||
tickCounter = 0;
|
// re-evaluate the tick time after each successful wakeup -
|
||||||
|
// screensavers can adjust it on the fly and we must be
|
||||||
|
// prepared to accomodate that
|
||||||
|
tick = fSaver ? fSaver->TickSize() : kTickBase;
|
||||||
|
lastTickTime = system_time();
|
||||||
|
}
|
||||||
|
|
||||||
if (snoozeCount) {
|
if (snoozeCount) {
|
||||||
// if we are sleeping, do nothing
|
// if we are sleeping, do nothing
|
||||||
snoozeCount--;
|
snoozeCount--;
|
||||||
|
|||||||
Reference in New Issue
Block a user