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

List:       kde-commits
Subject:    KDE/kdebase/workspace [POSSIBLY UNSAFE]
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2007-03-16 14:04:03
Message-ID: 1174053843.454309.31532.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 643171 by lunakl:

Redo ksplash states.



 M  +2 -4      ksmserver/startup.cpp  
 M  +20 -0     ksplash/README  
 M  +3 -2      ksplash/ksplashx/README  
 M  +46 -24    ksplash/ksplashx/splash.cpp   [POSSIBLY UNSAFE: scanf]
 M  +8 -8      ksplash/ksplashx/themes/default/1600x1200/description.txt  
 M  +1 -1      kwin/main.cpp  


--- trunk/KDE/kdebase/workspace/ksmserver/startup.cpp #643170:643171
@@ -98,7 +98,6 @@
     state = LaunchingWM;
 
     kDebug( 1218 ) << "KSMServer::restoreSession " << sessionName << endl;
-    upAndRunning( "restore session");
     KSharedConfig::Ptr config = KGlobal::config();
 
     sessionGroup = "Session: " + sessionName;
@@ -183,8 +182,8 @@
     if( !checkStartupSuspend())
         return;
     kDebug( 1218 ) << "Autostart 0 done" << endl;
-    upAndRunning( "krunner" );
-    upAndRunning( "kicker" );
+    upAndRunning( "desktop" );
+    upAndRunning( "ready" ); // desktop is more or less ready at this point, tell \
                ksplash to go away
     kcminitSignals = new QDBusInterface("org.kde.kcminit", "/kcminit", \
"org.kde.KCMInit", QDBusConnection::sessionBus(), this );  if( \
!kcminitSignals->isValid())  kWarning() << "kcminit not running?" << endl;
@@ -346,7 +345,6 @@
     if( waitAutoStart2 || waitKcmInit2 )
         return;
 
-    upAndRunning( "session ready" );
     state = Idle;
     setupXIOErrorHandler(); // From now on handle X errors as normal shutdown.
 }
--- trunk/KDE/kdebase/workspace/ksplash/README #643170:643171
@@ -40,3 +40,23 @@
 are shown in the configuration module. Engine selects which splash implementation
 the theme is for (currently 'None', 'Simple' and 'KSplashX' ). There may be futher
 implementation-dependent data in Theme.rc .
+
+
+Startup states:
+===============
+
+These are ksplash states:
+- initial - at the beginning
+- kded - after kded is running (dbus is ready, etc.)
+- confupdate - after kconf_update (settings updated after upgrade, etc.)
+- kcminit - after configuration setup
+- ksmserver - session manager is started
+- wm - window manager is running
+- desktop - desktop (plasma) is running
+- ready - session is ready (not fully actually, still e.g. restoring applications, \
but splash goes away) +
+Note however that these states should not be relied on too much:
+- they do not represent very accurately what is actually going on
+- states may be removed (they'll take 0 time and directly go to another state)
+- states may be added
+- states may be reordered (waiting for a later state and then a sooner state means \
                the sooner state will take 0 time)
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/README #643170:643171
@@ -86,8 +86,9 @@
 # this also clears the animation from the window
 STOP_ANIM number
 
-# wait until the specified ksplash state (1-7)
-# specifying 8 means waiting until whole startup is complete (should be used at the \
very end) +# wait until the specified ksplash state
+# see the splash toplevel README file (one directory up)
+# specifying "ready" means waiting until whole startup is complete (should be used \
at the very end)  WAIT_STATE state
 
 
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/splash.cpp #643170:643171
@@ -1,9 +1,12 @@
 //#define DEBUG
 
 const int MAX_ITEMS = 100;
-const int LAST_STATE = 7;
 const int ANIM_IMAGES_ROW = 10;
 
+// for convering from startup states to (internal) numbers
+const char states[][ 12 ] =
+    { "initial", "kded", "confupdate", "kcminit", "ksmserver", "wm", "desktop", \
"ready" }; +const int LAST_STATE = 7;
 
 #include <config.h>
 
@@ -477,7 +480,7 @@
         }
     time_t test_time = time( NULL ) + 5;
 #ifdef DEBUG
-    fprintf( stderr,"AWATING STATE: %d\n", expected_state );
+    fprintf( stderr,"AWATING STATE: %d (%s)\n", expected_state, states[ \
expected_state ] );  #endif
     if( parent_pipe >= 0 )
         { // wait for paint being finished, and tell parent to exit
@@ -510,24 +513,29 @@
 #ifdef DEBUG
                 fprintf( stderr,"MESSAGE: %s\n", s );
 #endif
-                if( strcmp( s, "dcop" ) == 0 && state < 1 )
-                    state = 1; // not actually used, state starts from 1, because \
                dcop cannot be checked
-                else if( strcmp( s, "kded" ) == 0 && state < 2 )
-                    state = 2;
-                else if( strcmp( s, "kcminit" ) == 0 )
-                    ; // unused
-                else if( strcmp( s, "ksmserver" ) == 0 && state < 3 )
-                    state = 3;
-                else if( strcmp( s, "wm started" ) == 0 && state < 4 )
-                    state = 4;
-                else if( strcmp( s, "kdesktop" ) == 0 && state < 5 )
-                    state = 5;
-                else if(( strcmp( s, "kicker" ) == 0 && state < 6 )
-                    || ( strcmp( s, "session ready" ) == 0 && state < 7 ))
+                int new_state = 0;
+                for( int i = 1;
+                     i <= LAST_STATE;
+                     ++i )
                     {
-                    state = 7;
-                    final_time = time( NULL ) + 1; // quit after short time
+                    if( strcmp( s, states[ i ] ) == 0 )
+                        {
+                        new_state = i;
+                        break;
+                        }
                     }
+                if( new_state == 0 )
+                    {
+#ifdef DEBUG
+                    fprintf( stderr, "UNKNOWN SPLASH STATE: %s\n", s );
+#endif
+                    }
+                else if( new_state > state )
+                    {
+                    state = new_state;
+                    if( state == LAST_STATE )
+                        final_time = time( NULL ) + 1; // quit after short time
+                    }
                 }
             }
         if( test && time( NULL ) >= test_time )
@@ -989,15 +997,29 @@
             delete animations[ number ];
             animations[ number ] = NULL;
             }
-        else if( sscanf( line, "WAIT_STATE %d", &number ) == 1 )
+        else if( sscanf( line, "WAIT_STATE %s", buf ) == 1 )
             {
-            if( number < 0 || number > LAST_STATE + 1 )
+            int new_state = 0;
+            for( int i = 1;
+                 i <= LAST_STATE;
+                 ++i )
                 {
-                fprintf( stderr, "Bad state: %i\n", number );
-                exit( 3 );
+                if( strcmp( buf, states[ i ] ) == 0 )
+                    {
+                    new_state = i;
+                    break;
+                    }
                 }
-            if( waitState( number ))
-                break; // exiting
+            if( new_state == 0 )
+                {
+                fprintf( stderr, "Unknown splash state: %s\n", buf );
+                // don't make fatal, may be a theme for a newer version
+                }
+            else
+                {
+                if( waitState( new_state ))
+                    break; // exiting
+                }
             }
         else
             {
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/themes/default/1600x1200/description.txt \
#643170:643171 @@ -2,38 +2,38 @@
 GEOMETRY_REL CC 0 0 CC 400 270
 IMAGE 0 0 background.png
 ANIM 1 0 190 2 icon1_anim.png 400
-WAIT_STATE 1
+WAIT_STATE kded
 
 STOP_ANIM 1
 IMAGE 0 190 icon1.png
 ANIM 2 58 190 2 icon2_anim.png 400
-WAIT_STATE 2
+WAIT_STATE confupdate
 
 STOP_ANIM 2
 IMAGE 58 190 icon2.png
 ANIM 3 116 190 2 icon3_anim.png 400
-WAIT_STATE 3
+WAIT_STATE kcminit
 
 STOP_ANIM 3
 IMAGE 116 190 icon3.png
 ANIM 4 174 190 2 icon4_anim.png 400
-WAIT_STATE 4
+WAIT_STATE ksmserver
 
 STOP_ANIM 4
 IMAGE 174 190 icon4.png
 ANIM 5 232 190 2 icon5_anim.png 400
-WAIT_STATE 5
+WAIT_STATE wm
 
 STOP_ANIM 5
 IMAGE 232 190 icon5.png
 ANIM 6 290 190 2 icon6_anim.png 400
-WAIT_STATE 6
+WAIT_STATE desktop
 
 STOP_ANIM 6
 IMAGE 290 190 icon6.png
 ANIM 7 340 190 2 icon7_anim.png 400
-WAIT_STATE 7
+WAIT_STATE ready
 
 STOP_ANIM 7
 IMAGE 340 190 icon7.png
-WAIT_STATE 8
+#WAIT_STATE
--- trunk/KDE/kdebase/workspace/kwin/main.cpp #643170:643171
@@ -133,7 +133,7 @@
     e.xclient.display = display();
     e.xclient.window = rootWindow();
     e.xclient.format = 8;
-    strcpy( e.xclient.data.b, "wm started" );
+    strcpy( e.xclient.data.b, "wm" );
     XSendEvent( display(), rootWindow(), False, SubstructureNotifyMask, &e );
     }
 


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

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