diff options
| author | 2011-01-01 20:19:56 +0000 | |
|---|---|---|
| committer | 2011-01-01 20:19:56 +0000 | |
| commit | c601b5a27f74b16158adafe429faefbe573e64a2 (patch) | |
| tree | a3cde3206a45628f8ac86e8dfbdab70b20c3a831 /src/modules/my/idle_win.cpp | |
| parent | probable compilation fix for rijndaled/crypto++ (diff) | |
| download | KVIrc-c601b5a27f74b16158adafe429faefbe573e64a2.tar.gz KVIrc-c601b5a27f74b16158adafe429faefbe573e64a2.tar.bz2 KVIrc-c601b5a27f74b16158adafe429faefbe573e64a2.zip | |
The big rename for modules. Still some details remaining.
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5284 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/my/idle_win.cpp')
| -rw-r--r-- | src/modules/my/idle_win.cpp | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/src/modules/my/idle_win.cpp b/src/modules/my/idle_win.cpp deleted file mode 100644 index 3a1469928..000000000 --- a/src/modules/my/idle_win.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * idle_win.cpp - detect desktop idle time - * Copyright (C) 2003 Justin Karneges - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ -#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) - - #include "idle.h" - - #include <QLibrary> - #include< windows.h> - - typedef struct tagLASTINPUTINFO { - UINT cbSize; - DWORD dwTime; - } LASTINPUTINFO, *PLASTINPUTINFO; - - class IdlePlatform::Private - { - public: - Private() - { - GetLastInputInfo = 0; - IdleUIGetLastInputTime = 0; - lib = 0; - } - - BOOL (__stdcall * GetLastInputInfo)(PLASTINPUTINFO); - DWORD (__stdcall * IdleUIGetLastInputTime)(void); - QLibrary *lib; - }; - - IdlePlatform::IdlePlatform() - { - d = new Private; - } - - IdlePlatform::~IdlePlatform() - { - delete d->lib; - delete d; - } - - bool IdlePlatform::init() - { - if(d->lib) - return true; - void *p; - - // try to find the built-in Windows 2000 function - d->lib = new QLibrary("user32"); - if(d->lib->load() && (p = d->lib->resolve("GetLastInputInfo"))) { - d->GetLastInputInfo = (BOOL (__stdcall *)(PLASTINPUTINFO))p; - return true; - } - else { - delete d->lib; - d->lib = 0; - } - - // fall back on idleui - d->lib = new QLibrary("idleui"); - if(d->lib->load() && (p = d->lib->resolve("IdleUIGetLastInputTime"))) { - d->IdleUIGetLastInputTime = (DWORD (__stdcall *)(void))p; - return true; - } - else { - delete d->lib; - d->lib = 0; - } - - return false; - } - - int IdlePlatform::secondsIdle() - { - int i; - if(d->GetLastInputInfo) { - LASTINPUTINFO li; - li.cbSize = sizeof(LASTINPUTINFO); - bool ok = d->GetLastInputInfo(&li); - if(!ok) - return 0; - i = li.dwTime; - } - else if(d->IdleUIGetLastInputTime) { - i = d->IdleUIGetLastInputTime(); - } - else - return 0; - - return (GetTickCount() - i) / 1000; - } - -#endif |
