From 7346f13c6ad2518e14b51cf4a09e11f78be05ff4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 16 Nov 2008 19:43:25 +0100 Subject: [PATCH] Decrease energy usage in idle. When application has lost focus do a 0.1s sleep after video update is done to decrease energy usage. Actual power consumption went down from ~0.4W to ~0.13W. Power consumption w/o OpenTTD running in background is ~0.11W. --- src/timer/symbian/SDL_systimer.cpp | 2 +- src/video/symbian/SDL_epocvideo.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/timer/symbian/SDL_systimer.cpp b/src/timer/symbian/SDL_systimer.cpp index 42cba01..f2198b9 100644 --- a/src/timer/symbian/SDL_systimer.cpp +++ b/src/timer/symbian/SDL_systimer.cpp @@ -49,7 +49,7 @@ extern "C" { void SDL_Delay(Uint32 ms) { - usleep(ms*1000); + User::After(ms*1000); } /* Data to handle a single periodic alarm */ diff --git a/src/video/symbian/SDL_epocvideo.cpp b/src/video/symbian/SDL_epocvideo.cpp index 23ff5a1..90b70c0 100644 --- a/src/video/symbian/SDL_epocvideo.cpp +++ b/src/video/symbian/SDL_epocvideo.cpp @@ -700,6 +700,10 @@ static void S60_DirectUpdate(_THIS, int numrects, SDL_Rect *rects) } EpocSdlEnv::UpdateSwSurface(); } + if(!Private->iIsWindowFocused) + { + User::After(100000); + } } } -- 2.11.4.GIT