diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2014-10-30 20:07:59 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-11-05 20:59:44 +0000 |
commit | d6e89e7516271d246b255ec5ebc752713da3dfd5 (patch) | |
tree | bcbcf58593f6191eb88057f2da2ea8ff2fa15410 /vcl/source/app | |
parent | 9632045906baf165076d11a97f45b153d8e2acb7 (diff) |
Basic Idle handler implementation
An idle handler will ultimately be a zero time timeout with
prioritisation layered on top of that.
Change-Id: I3f0802d5001172fc7b8409274bc5a3632e5dad34
Diffstat (limited to 'vcl/source/app')
-rw-r--r-- | vcl/source/app/timer.cxx | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index ecbfa7467cdc..5f706abcb88a 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -336,4 +336,61 @@ AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer ) return *this; } +Idle::Idle() + : Timer() +{ + SetPriority(VCL_IDLE_PRIORITY_LOWEST); +} + +Idle::Idle( IdlePriority ePriority ) + : Timer() +{ + SetPriority( ePriority ); +} + +void Idle::SetPriority( IdlePriority ePriority ) +{ + sal_uLong nTimeoutMS = 0; + + // Ultimately this will just be a sort key in a work queue. + switch (ePriority) { + case VCL_IDLE_PRIORITY_HIGHEST: + nTimeoutMS = 0; + break; + case VCL_IDLE_PRIORITY_HIGH: + nTimeoutMS = 1; + break; + case VCL_IDLE_PRIORITY_REPAINT: + nTimeoutMS = 30; + break; + case VCL_IDLE_PRIORITY_RESIZE: + nTimeoutMS = 50; + break; + case VCL_IDLE_PRIORITY_MEDIUM: + nTimeoutMS = 50; + break; + case VCL_IDLE_PRIORITY_LOW: + nTimeoutMS = 100; + break; + case VCL_IDLE_PRIORITY_LOWER: + nTimeoutMS = 200; + break; + case VCL_IDLE_PRIORITY_LOWEST: + default: + nTimeoutMS = 400; + break; + } + SetTimeout( nTimeoutMS ); +} + +void Idle::DoIdle() +{ + maTimeoutHdl.Call( this ); +} + + +Idle::~Idle() +{ +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |