Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / krunner / xautolock.h
blobb4c0c82f5322331e530e0c538d437d74e27db2fa
1 //===========================================================================
2 //
3 // This file is part of the KDE project
4 //
5 // Copyright 1999 Martin R. Jones <mjones@kde.org>
6 //
8 #ifndef __XAUTOLOCK_H__
9 #define __XAUTOLOCK_H__
11 #include <QWidget>
13 #include <X11/Xlib.h>
14 #include <fixx11h.h>
15 //===========================================================================
17 // Detect user inactivity.
18 // Named XAutoLock after the program that it is based on.
20 class XAutoLock : public QWidget
22 Q_OBJECT
23 public:
24 XAutoLock();
25 ~XAutoLock();
27 //-----------------------------------------------------------------------
29 // The time in seconds of continuous inactivity.
30 // Need to call start() again afterwards.
32 void setTimeout(int t);
34 void setDPMS(bool s);
36 //-----------------------------------------------------------------------
38 // Start watching Activity
40 void start();
42 //-----------------------------------------------------------------------
44 // Stop watching Activity
46 void stop();
48 //-----------------------------------------------------------------------
50 // Should be called only from a slot connected to the timeout() signal. Will
51 // result in the timeout() signal being emitted again with a delay (i.e. postponed).
53 void postpone();
55 // internal
56 void resetTrigger();
57 // internal
58 void setTrigger( time_t );
59 // internal
60 bool ignoreWindow( WId );
61 // internal
62 time_t idleTime();
64 Q_SIGNALS:
65 void timeout();
67 protected:
68 virtual void timerEvent(QTimerEvent *ev);
69 virtual bool x11Event( XEvent* );
71 protected:
72 int mTimerId;
73 int mTimeout;
74 time_t mTrigger;
75 bool mActive;
76 time_t mLastTimeout, mLastReset;
77 bool mDPMS;
80 #endif