View | Details | Raw Unified | Return to bug 115123
Collapse All | Expand All

(-)kdesktop/lock/main.cc.sav (+11 lines)
Lines 27-32 Link Here
27
#include <kglobal.h>
27
#include <kglobal.h>
28
#include <kdebug.h>
28
#include <kdebug.h>
29
#include <kglobalsettings.h>
29
#include <kglobalsettings.h>
30
#include <dcopref.h>
30
31
31
#include <stdlib.h>
32
#include <stdlib.h>
32
33
Lines 148-155 int main( int argc, char **argv ) Link Here
148
        process.setParent(parent_connection);
149
        process.setParent(parent_connection);
149
150
150
    bool rt;
151
    bool rt;
152
    bool sig = false;
151
    if( !child && args->isSet( "forcelock" ))
153
    if( !child && args->isSet( "forcelock" ))
154
    {
152
        rt = process.lock();
155
        rt = process.lock();
156
        sig = true;
157
    }
153
    else if( child || args->isSet( "dontlock" ))
158
    else if( child || args->isSet( "dontlock" ))
154
        rt = process.dontLock();
159
        rt = process.dontLock();
155
    else
160
    else
Lines 157-162 int main( int argc, char **argv ) Link Here
157
    if (!rt)
162
    if (!rt)
158
        return 1;
163
        return 1;
159
164
165
    if( sig )
166
    {
167
        DCOPRef ref( "kdesktop", "KScreensaverIface");
168
        ref.send( "saverLockReady" );
169
    }
170
160
    return app.exec();
171
    return app.exec();
161
}
172
}
162
173
(-)kdesktop/lockeng.cc.sav (-7 / +45 lines)
Lines 16-21 Link Here
16
#include <kdebug.h>
16
#include <kdebug.h>
17
#include <klocale.h>
17
#include <klocale.h>
18
#include <qfile.h>
18
#include <qfile.h>
19
#include <dcopclient.h>
19
#include <assert.h>
20
#include <assert.h>
20
21
21
#include "lockeng.h"
22
#include "lockeng.h"
Lines 85-96 SaverEngine::~SaverEngine() Link Here
85
}
86
}
86
87
87
//---------------------------------------------------------------------------
88
//---------------------------------------------------------------------------
89
90
// This should be called only using DCOP.
88
void SaverEngine::lock()
91
void SaverEngine::lock()
89
{
92
{
93
    bool ok = true;
90
    if (mState == Waiting)
94
    if (mState == Waiting)
91
    {
95
    {
92
        startLockProcess( ForceLock );
96
        ok = startLockProcess( ForceLock );
97
    }
98
// It takes a while for kdesktop_lock to start and lock the screen.
99
// Therefore delay the DCOP call until it tells kdesktop that the locking is in effect.
100
// This is done only for --forcelock .
101
    if( ok && mState != Saving )
102
    {
103
        DCOPClientTransaction* trans = kapp->dcopClient()->beginTransaction();
104
        mLockTransactions.append( trans );
105
    }
106
}
107
108
void SaverEngine::processLockTransactions()
109
{
110
    for( QValueVector< DCOPClientTransaction* >::ConstIterator it = mLockTransactions.begin();
111
         it != mLockTransactions.end();
112
         ++it )
113
    {
114
        QCString replyType = "void";
115
        QByteArray arr;
116
        kapp->dcopClient()->endTransaction( *it, replyType, arr );
93
    }
117
    }
118
    mLockTransactions.clear();
119
}
120
121
void SaverEngine::saverLockReady()
122
{
123
    if( mState != Preparing )
124
    {
125
	kdDebug( 1204 ) << "Got unexpected saverReady()" << endl;
126
    }
127
    kdDebug( 1204 ) << "Saver Lock Ready" << endl;
128
    processLockTransactions();
94
}
129
}
95
130
96
//---------------------------------------------------------------------------
131
//---------------------------------------------------------------------------
Lines 105-111 void SaverEngine::save() Link Here
105
//---------------------------------------------------------------------------
140
//---------------------------------------------------------------------------
106
void SaverEngine::quit()
141
void SaverEngine::quit()
107
{
142
{
108
    if (mState == Saving)
143
    if (mState == Saving || mState == Preparing)
109
    {
144
    {
110
        stopLockProcess();
145
        stopLockProcess();
111
    }
146
    }
Lines 213-224 void SaverEngine::setBlankOnly( bool bla Link Here
213
//
248
//
214
// Start the screen saver.
249
// Start the screen saver.
215
//
250
//
216
void SaverEngine::startLockProcess( LockType lock_type )
251
bool SaverEngine::startLockProcess( LockType lock_type )
217
{
252
{
218
    if (mState != Waiting)
253
    if (mState != Waiting)
219
    {
254
    {
220
        kdWarning(1204) << "SaverEngine::startSaver() saver already active" << endl;
255
        kdWarning(1204) << "SaverEngine::startSaver() saver already active" << endl;
221
        return;
256
        return true;
222
    }
257
    }
223
258
224
    kdDebug(1204) << "SaverEngine: starting saver" << endl;
259
    kdDebug(1204) << "SaverEngine: starting saver" << endl;
Lines 233-239 void SaverEngine::startLockProcess( Lock Link Here
233
    if( path.isEmpty())
268
    if( path.isEmpty())
234
    {
269
    {
235
	kdDebug( 1204 ) << "Can't find kdesktop_lock!" << endl;
270
	kdDebug( 1204 ) << "Can't find kdesktop_lock!" << endl;
236
	return;
271
	return false;
237
    }
272
    }
238
    mLockProcess << path;
273
    mLockProcess << path;
239
    switch( lock_type )
274
    switch( lock_type )
Lines 253-266 void SaverEngine::startLockProcess( Lock Link Here
253
    if (mLockProcess.start() == false )
288
    if (mLockProcess.start() == false )
254
    {
289
    {
255
	kdDebug( 1204 ) << "Failed to start kdesktop_lock!" << endl;
290
	kdDebug( 1204 ) << "Failed to start kdesktop_lock!" << endl;
256
	return;
291
	return false;
257
    }
292
    }
258
293
259
    mState = Saving;
294
    mState = Preparing;
260
    if (mXAutoLock)
295
    if (mXAutoLock)
261
    {
296
    {
262
        mXAutoLock->stop();
297
        mXAutoLock->stop();
263
    }
298
    }
299
    return true;
264
}
300
}
265
301
266
//---------------------------------------------------------------------------
302
//---------------------------------------------------------------------------
Lines 284-289 void SaverEngine::stopLockProcess() Link Here
284
    {
320
    {
285
        mXAutoLock->start();
321
        mXAutoLock->start();
286
    }
322
    }
323
    processLockTransactions();
287
    mState = Waiting;
324
    mState = Waiting;
288
}
325
}
289
326
Lines 297-302 void SaverEngine::lockProcessExited() Link Here
297
    {
334
    {
298
        mXAutoLock->start();
335
        mXAutoLock->start();
299
    }
336
    }
337
    processLockTransactions();
300
    mState = Waiting;
338
    mState = Waiting;
301
}
339
}
302
340
(-)kdesktop/lockeng.h.sav (-2 / +12 lines)
Lines 10-19 Link Here
10
10
11
#include <qwidget.h>
11
#include <qwidget.h>
12
#include <kprocess.h>
12
#include <kprocess.h>
13
#include <qvaluevector.h>
13
#include "KScreensaverIface.h"
14
#include "KScreensaverIface.h"
14
#include "xautolock.h"
15
#include "xautolock.h"
15
#include "xautolock_c.h"
16
#include "xautolock_c.h"
16
17
18
class DCOPClientTransaction;
19
17
//===========================================================================
20
//===========================================================================
18
/**
21
/**
19
 * Screen saver engine.  Handles screensaver window, starting screensaver
22
 * Screen saver engine.  Handles screensaver window, starting screensaver
Lines 70-88 public: Link Here
70
     */
73
     */
71
    virtual void setBlankOnly( bool blankOnly );
74
    virtual void setBlankOnly( bool blankOnly );
72
75
76
    /**
77
     * Called by kdesktop_lock when locking is in effect.
78
     */
79
    virtual void saverLockReady();
80
73
protected slots:
81
protected slots:
74
    void idleTimeout();
82
    void idleTimeout();
75
    void lockProcessExited();
83
    void lockProcessExited();
76
84
77
protected:
85
protected:
78
    enum LockType { DontLock, DefaultLock, ForceLock };
86
    enum LockType { DontLock, DefaultLock, ForceLock };
79
    void startLockProcess( LockType lock_type );
87
    bool startLockProcess( LockType lock_type );
80
    void stopLockProcess();
88
    void stopLockProcess();
81
    bool handleKeyPress(XKeyEvent *xke);
89
    bool handleKeyPress(XKeyEvent *xke);
90
    void processLockTransactions();
82
    xautolock_corner_t applyManualSettings(int);
91
    xautolock_corner_t applyManualSettings(int);
83
92
84
protected:
93
protected:
85
    enum State { Waiting, Saving };
94
    enum State { Waiting, Preparing, Saving };
86
    bool        mEnabled;
95
    bool        mEnabled;
87
    bool	mDPMS;
96
    bool	mDPMS;
88
97
Lines 98-103 protected: Link Here
98
    int         mXExposures;
107
    int         mXExposures;
99
108
100
    bool	mBlankOnly;  // only use the blanker, not the defined saver
109
    bool	mBlankOnly;  // only use the blanker, not the defined saver
110
    QValueVector< DCOPClientTransaction* > mLockTransactions;
101
};
111
};
102
112
103
#endif
113
#endif
(-)kdesktop/KScreensaverIface.h.sav (-1 / +4 lines)
Lines 40-46 k_dcop: Link Here
40
   */
40
   */
41
  virtual void setBlankOnly( bool blankOnly ) = 0;
41
  virtual void setBlankOnly( bool blankOnly ) = 0;
42
42
43
  /***
44
   * @internal
45
  */
46
  virtual void saverLockReady() = 0;
43
};
47
};
44
48
45
#endif
49
#endif
46

Return to bug 115123