[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kdesktop/lock
From:       Chris Howells <howells () kde ! org>
Date:       2004-11-17 17:03:35
Message-ID: 20041117170335.D715216BD6 () office ! kde ! org
[Download RAW message or body]

CVS commit by howells: 

* The fading can be interrupted
* should be a bit ligher on resources


  M +25 -12    lockprocess.cc   1.47
  M +2 -0      lockprocess.h   1.24


--- kdebase/kdesktop/lock/lockprocess.cc  #1.46:1.47
@@ -102,5 +102,6 @@ LockProcess::LockProcess(bool child, boo
       mRestoreXF86Lock(false),
       mForbidden(false),
-      mAutoLogout(false)
+      mAutoLogout(false),
+      mFadeValue(0)
 {
     setupSignals();
@@ -637,6 +638,6 @@ bool LockProcess::startSaver()
     XSync(qt_xdisplay(), False);
     setVRoot( winId(), winId() );
-     if (!startHack())
-         setBackgroundColor(black); // failed to start a hack.  Just show a blank \
screen +    mOriginal = QPixmap::grabWindow(winId());
+    QTimer::singleShot(1, this, SLOT(slotFade()));
     return true;
 }
@@ -732,14 +733,24 @@ bool LockProcess::startLock()
 //---------------------------------------------------------------------------
 //
-bool LockProcess::startHack()
-{
-    mOriginal = QPixmap::grabWindow(winId());
 
-    for (double i = 0; i < 1.0; i = i + 0.08)
+
+void  LockProcess::slotFade()
+{
+    mFadeValue = mFadeValue + 0.1;
+    if (mFadeValue > 0.5)
     {    
-        KPixmap pixmap = mOriginal;
-        KPixmapEffect::fade(pixmap, i, Qt::black);
-        bitBlt(this, 0, 0, &pixmap);
+        startHack();
+        return;
+    }
+    else
+    {
+        KPixmapEffect::fade(mOriginal, mFadeValue, Qt::black);
+        bitBlt(this, 0, 0, &mOriginal);
+        QTimer::singleShot(1, this, SLOT(slotFade()));
     }
+ }
+
+bool LockProcess::startHack()
+{
     if (mSaverExec.isEmpty())
     {
@@ -787,5 +798,7 @@ bool LockProcess::startHack()
                 }
         }
-        else // we aren't allowed to start the specified screensaver according to \
the kiosk restrictions +        else
+        // we aren't allowed to start the specified screensaver either because it \
didn't run for some reason +        // according to the kiosk restrictions forbid it
         {
                 setBackgroundColor(black);

--- kdebase/kdesktop/lock/lockprocess.h  #1.23:1.24
@@ -72,4 +72,5 @@ private slots:
     void checkDPMSActive();
     void slotDeadTimePassed();
+    void slotFade();
 
 private:
@@ -127,4 +128,5 @@ private:
     bool        mAutoLogout;
     KPixmap     mOriginal;
+    double      mFadeValue; 
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic