~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to krunner/screensaver/xautolock.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===========================================================================
 
2
//
 
3
// This file is part of the KDE project
 
4
//
 
5
// Copyright 1999 Martin R. Jones <mjones@kde.org>
 
6
//
 
7
 
 
8
#ifndef __XAUTOLOCK_H__
 
9
#define __XAUTOLOCK_H__
 
10
 
 
11
#include <config-xautolock.h>
 
12
 
 
13
#include <QWidget>
 
14
 
 
15
#include <X11/Xlib.h>
 
16
#ifdef HAVE_XSCREENSAVER
 
17
# include <X11/extensions/scrnsaver.h>
 
18
#endif
 
19
#include <fixx11h.h>
 
20
 
 
21
//===========================================================================
 
22
//
 
23
// Detect user inactivity.
 
24
// Named XAutoLock after the program that it is based on.
 
25
//
 
26
class XAutoLock : public QWidget
 
27
{
 
28
    Q_OBJECT
 
29
public:
 
30
    XAutoLock();
 
31
    ~XAutoLock();
 
32
 
 
33
    //-----------------------------------------------------------------------
 
34
    //
 
35
    // The time in seconds of continuous inactivity.
 
36
    // Need to call start() again afterwards.
 
37
    //
 
38
    void setTimeout(int t);
 
39
    
 
40
    void setDPMS(bool s);
 
41
    
 
42
    //-----------------------------------------------------------------------
 
43
    //
 
44
    // Start watching Activity
 
45
    //
 
46
    void start();
 
47
 
 
48
    //-----------------------------------------------------------------------
 
49
    //
 
50
    // Stop watching Activity
 
51
    //
 
52
    void stop();
 
53
 
 
54
    //-----------------------------------------------------------------------
 
55
    //
 
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).
 
58
    //
 
59
    void postpone();
 
60
 
 
61
    // internal
 
62
    void resetTrigger();
 
63
    // internal
 
64
    void setTrigger( int );
 
65
    // internal
 
66
    bool ignoreWindow( WId );
 
67
    // internal
 
68
    time_t idleTime();
 
69
    
 
70
Q_SIGNALS:
 
71
    void timeout();
 
72
 
 
73
protected:
 
74
    virtual void timerEvent(QTimerEvent *ev);
 
75
    virtual bool x11Event( XEvent* );
 
76
 
 
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
 
89
};
 
90
 
 
91
#endif