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

List:       kde-commits
Subject:    branches/KDE/3.5
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2008-03-31 16:07:28
Message-ID: 1206979648.228127.17822.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 792190 by lunakl:

Make KDE3 applications restart in saved session using a wrapper script 'kde3'
if not running in a KDE3 session (http://lists.kde.org/?t=120569055200005&r=1&w=2).



 M  +1 -1      kdebase/Makefile.am.in  
 A             kdebase/kde3  
 M  +27 -0     kdelibs/kdecore/kapplication.cpp  


--- branches/KDE/3.5/kdebase/Makefile.am.in #792189:792190
@@ -9,7 +9,7 @@
 
 AUTOMAKE_OPTIONS = foreign 1.6.1
 
-bin_SCRIPTS = startkde
+bin_SCRIPTS = startkde kde3
 
 EXTRA_DIST = admin bsd-port debian kdebase.spec.in README.pam kde.pamd \
kscreensaver.pamd mkpamserv  
--- branches/KDE/3.5/kdelibs/kdecore/kapplication.cpp #792189:792190
@@ -1244,6 +1244,32 @@
     d->session_save = false;
 }
 
+static void checkRestartVersion( QSessionManager& sm )
+{
+    Display* dpy = qt_xdisplay();
+    Atom type;
+    int format;
+    unsigned long nitems, after;
+    unsigned char* data;
+    if( XGetWindowProperty( dpy, DefaultRootWindow( dpy ), XInternAtom( dpy, \
"KDE_FULL_SESSION", False ), +        0, 1, False, AnyPropertyType, &type, &format, \
&nitems, &after, &data ) == Success ) { +        if( type == XA_STRING && format == 8 \
) { // session set, check if KDE_SESSION_VERSION is not set (meaning KDE3) +          \
unsigned char* data; +            if( XGetWindowProperty( dpy, DefaultRootWindow( dpy \
), XInternAtom( dpy, "KDE_SESSION_VERSION", False ), +                0, 1, False, \
AnyPropertyType, &type, &format, &nitems, &after, &data ) == Success ) { +            \
XFree( data ); // KDE4 or newer +            } else {
+                return; // we run in our native session, no need to wrap
+            }
+        }
+        XFree( data );
+    }
+    QString wrapper = KStandardDirs::findExe( "kde3" );
+    QStringList restartCommand = sm.restartCommand();
+    restartCommand.prepend( wrapper );
+    sm.setRestartCommand( restartCommand );
+}
+
 void KApplication::saveState( QSessionManager& sm )
 {
     d->session_save = true;
@@ -1297,6 +1323,7 @@
         sm.setRestartCommand( restartCommand );
     }
 
+    checkRestartVersion( sm );
 
     // finally: do session management
     emit saveYourself(); // for compatibility


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

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