Merge branch 'central-widget'
[krunner.git] / xautolock.h
blobb6c21b306f3ab9982349b8a8f8ecbe542fbb6f2a
1 //===========================================================================
2 //
3 // This file is part of the KDE project
4 //
5 // Copyright (c) 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.
31 void setTimeout(int t);
33 void setDPMS(bool s);
35 //-----------------------------------------------------------------------
37 // Start watching Activity
39 void start();
41 //-----------------------------------------------------------------------
43 // Stop watching Activity
45 void stop();
47 //-----------------------------------------------------------------------
49 // Should be called only from a slot connected to the timeout() signal. Will
50 // result in the timeout() signal being emitted again with a delay (i.e. postponed).
52 void postpone();
54 // internal
55 void resetTrigger();
56 // internal
57 void setTrigger( time_t );
58 // internal
59 bool ignoreWindow( WId );
60 // internal
61 time_t idleTime();
63 Q_SIGNALS:
64 void timeout();
66 protected:
67 virtual void timerEvent(QTimerEvent *ev);
68 virtual bool x11Event( XEvent* );
70 protected:
71 int mTimerId;
72 int mTimeout;
73 time_t mTrigger;
74 bool mActive;
75 time_t mLastTimeout, mLastReset;
76 bool mDPMS;
79 #endif