7#include "windowspoller.h"
13WindowsPoller::WindowsPoller(
QObject *parent)
14 : KWindowBasedIdleTimePoller(parent)
18WindowsPoller::~WindowsPoller()
22int WindowsPoller::getIdleTime()
28 memset(&lii, 0,
sizeof(lii));
30 lii.cbSize =
sizeof(lii);
32 BOOL
ok = GetLastInputInfo(&lii);
34 idle = GetTickCount() - lii.dwTime;
43bool WindowsPoller::additionalSetUp()
45 m_idleTimer =
new QTimer(
this);
50void WindowsPoller::simulateUserActivity()
52 int width = GetSystemMetrics(SM_CXSCREEN);
53 int height = GetSystemMetrics(SM_CYSCREEN);
55 int x = (int)100 * 65536 / width;
56 int y = (int)100 * 65536 / height;
58 mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, x, y, NULL, NULL);
61void WindowsPoller::catchIdleEvent()
63 m_idleTimer->
start(800);
66void WindowsPoller::stopCatchingIdleEvents()
71void WindowsPoller::checkForIdle()
73 if (getIdleTime() < 1000) {
74 stopCatchingIdleEvents();
75 Q_EMIT resumingFromIdle();
79#include "moc_windowspoller.cpp"
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:35 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.