Merge branch 'central-widget'
[krunner.git] / lock / lockprocess.h
blob1aace7387ba1037dcb7ac0658d2d615e33899b52
1 //===========================================================================
2 //
3 // This file is part of the KDE project
4 //
5 // Copyright (c) 1999 Martin R. Jones <mjones@kde.org>
6 // Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org>
7 //
9 #ifndef __LOCKENG_H__
10 #define __LOCKENG_H__
12 #include <kgreeterplugin.h>
14 #include <k3process.h>
16 #include <QWidget>
17 #include <QTimer>
18 #include <QStack>
19 #include <QList>
20 #include <QMessageBox>
21 #include <QPixmap>
23 #include <X11/Xlib.h>
24 #include <fixx11h.h>
26 class KLibrary;
28 struct GreeterPluginHandle {
29 KLibrary *library;
30 kgreeterplugin_info *info;
33 //===========================================================================
35 // Screen saver handling process. Handles screensaver window,
36 // starting screensaver hacks, and password entry.
38 class LockProcess
39 : public QWidget
41 Q_OBJECT
42 public:
43 LockProcess(bool child_saver = false, bool useBlankOnly = false);
44 ~LockProcess();
46 bool lock();
48 bool defaultSave();
50 bool dontLock();
52 void setChildren(QList<int> children) { child_sockets = children; }
53 void setParent(int fd) { mParent = fd; }
55 void msgBox( QMessageBox::Icon type, const QString &txt );
56 int execDialog( QDialog* dlg );
58 public Q_SLOTS:
59 void quitSaver();
60 void preparePopup();
61 void cleanupPopup();
63 protected:
64 virtual bool x11Event(XEvent *);
65 virtual void timerEvent(QTimerEvent *);
67 private Q_SLOTS:
68 void hackExited(K3Process *);
69 void signalPipeSignal();
70 bool startLock();
71 void suspend();
72 void checkDPMSActive();
73 void slotDeadTimePassed();
75 private:
76 void configure();
77 void readSaver();
78 void createSaverWindow();
79 void hideSaverWindow();
80 void saveVRoot();
81 void setVRoot(Window win, Window rw);
82 void removeVRoot(Window win);
83 bool grabKeyboard();
84 bool grabMouse();
85 bool grabInput();
86 void ungrabInput();
87 void cantLock(const QString &reason);
88 bool startSaver();
89 void stopSaver();
90 bool startHack();
91 void stopHack();
92 void setupSignals();
93 bool checkPass();
94 void stayOnTop();
95 void lockXF86();
96 void unlockXF86();
97 void resume( bool force );
98 static QVariant getConf(void *ctx, const char *key, const QVariant &dflt);
100 bool mLocked;
101 int mLockGrace;
102 int mPriority;
103 bool mBusy;
104 K3Process mHackProc;
105 int mRootWidth;
106 int mRootHeight;
107 QString mSaverExec;
108 QString mSaver;
109 bool mOpenGLVisual;
110 bool child_saver;
111 QList<int> child_sockets;
112 int mParent;
113 bool mUseBlankOnly;
114 bool mSuspended;
115 QTimer mSuspendTimer;
116 bool mVisibility;
117 bool mDPMSDepend;
118 QTimer mCheckDPMS;
119 QStack< QWidget* > mDialogs;
120 bool mRestoreXF86Lock;
121 bool mForbidden;
122 QStringList mPlugins, mPluginOptions;
123 QString mMethod;
124 GreeterPluginHandle greetPlugin;
125 QPixmap mSavedScreen;
126 int mAutoLogoutTimerId;
127 int mAutoLogoutTimeout;
128 bool mAutoLogout;
131 #endif