[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.0
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2008-03-31 16:16:58
Message-ID: 1206980218.859944.18346.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 792196 by lunakl:
Make KDE4 applications restart in saved session using a wrapper script 'kde4'
if not running in a KDE4 session (http://lists.kde.org/?t=120569055200005&r=1&w=2).
M +2 -0 kdebase/runtime/CMakeLists.txt
AM kdebase/runtime/kde4
M +29 -0 kdelibs/kdeui/kernel/kapplication.cpp
--- branches/KDE/4.0/kdebase/runtime/CMakeLists.txt #792195:792196
@@ -79,3 +79,5 @@
macro_display_feature_log()
endif(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+########### install files ###############
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kde4 DESTINATION ${BIN_INSTALL_DIR})
** branches/KDE/4.0/kdebase/runtime/kde4 #property svn:executable
+ *
--- branches/KDE/4.0/kdelibs/kdeui/kernel/kapplication.cpp #792195:792196
@@ -731,6 +731,34 @@
d->session_save = false;
}
+static void checkRestartVersion( QSessionManager& sm )
+{
+ Display* dpy = QX11Info::display();
+ Atom type;
+ int format;
+ unsigned long nitems, after;
+ unsigned char* data;
+ if( XGetWindowProperty( dpy, DefaultRootWindow( dpy ), XInternAtom( dpy, \
"KDE_SESSION_VERSION", False ), + 0, 1, False, AnyPropertyType, &type, \
&format, &nitems, &after, &data ) == Success ) { + if( type == XA_INTEGER && \
format == 32 ) { + int version = *( long* ) data;
+ if( version == KDE_VERSION_MAJOR ) { // we run in our native session
+ XFree( data );
+ return; // no need to wrap
+ }
+ }
+ XFree( data );
+ }
+#define NUM_TO_STRING2( num ) #num
+#define NUM_TO_STRING( num ) NUM_TO_STRING2( num )
+ QString wrapper = KStandardDirs::findExe( "kde" NUM_TO_STRING( KDE_VERSION_MAJOR \
) ); // "kde4", etc. +#undef NUM_TO_STRING
+#undef NUM_TO_STRING2
+ QStringList restartCommand = sm.restartCommand();
+ restartCommand.prepend( wrapper );
+ sm.setRestartCommand( restartCommand );
+}
+
void KApplication::saveState( QSessionManager& sm )
{
d->session_save = true;
@@ -784,6 +812,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