add more spacing
[personal-kdebase.git] / workspace / krunner / screensaver / xautolock.h
blob3db323357d50792501a0a90d48f65dc2c2185fc5
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 <config-xautolock.h>
13 #include <QWidget>
15 #include <X11/Xlib.h>
16 #ifdef HAVE_XSCREENSAVER
17 # include <X11/extensions/scrnsaver.h>
18 #endif
19 #include <fixx11h.h>
21 //===========================================================================
23 // Detect user inactivity.
24 // Named XAutoLock after the program that it is based on.
26 class XAutoLock : public QWidget
28 Q_OBJECT
29 public:
30 XAutoLock();
31 ~XAutoLock();
33 //-----------------------------------------------------------------------
35 // The time in seconds of continuous inactivity.
36 // Need to call start() again afterwards.
38 void setTimeout(int t);
40 void setDPMS(bool s);
42 //-----------------------------------------------------------------------
44 // Start watching Activity
46 void start();
48 //-----------------------------------------------------------------------
50 // Stop watching Activity
52 void stop();
54 //-----------------------------------------------------------------------
56 // Should be called only from a slot connected to the timeout() signal. Will
57 // result in the timeout() signal being emitted again with a delay (i.e. postponed).
59 void postpone();
61 // internal
62 void resetTrigger();
63 // internal
64 void setTrigger( int );
65 // internal
66 bool ignoreWindow( WId );
67 // internal
68 time_t idleTime();
70 Q_SIGNALS:
71 void timeout();
73 protected:
74 virtual void timerEvent(QTimerEvent *ev);
75 virtual bool x11Event( XEvent* );
77 protected:
78 int mTimerId;
79 int mTimeout;
80 time_t mTrigger;
81 bool mActive;
82 time_t mLastReset;
83 time_t mElapsed;
84 bool mDPMS;
85 #ifdef HAVE_XSCREENSAVER
86 XScreenSaverInfo *mMitInfo;
87 ulong mLastIdle;
88 #endif
91 #endif