|
Lines 115-157
Link Here
|
| 115 |
int count = config->readNumEntry( "count" ); |
115 |
int count = config->readNumEntry( "count" ); |
| 116 |
appsToStart = count; |
116 |
appsToStart = count; |
| 117 |
|
117 |
|
| 118 |
TQValueList<TQStringList> wmCommands; |
|
|
| 119 |
if ( !wm.isEmpty() ) { |
| 120 |
for ( int i = 1; i <= count; i++ ) { |
| 121 |
TQString n = TQString::number(i); |
| 122 |
if ( wm == config->readEntry( TQString("program")+n ) ) { |
| 123 |
wmCommands << config->readListEntry( TQString("restartCommand")+n ); |
| 124 |
} |
| 125 |
} |
| 126 |
} |
| 127 |
if ( wmCommands.isEmpty() ) |
| 128 |
wmCommands << ( TQStringList() << wm ); |
| 129 |
|
| 130 |
publishProgress( appsToStart, true ); |
118 |
publishProgress( appsToStart, true ); |
|
|
119 |
upAndRunning( "ksmserver" ); |
| 131 |
connectDCOPSignal( launcher, launcher, "autoStart0Done()", |
120 |
connectDCOPSignal( launcher, launcher, "autoStart0Done()", |
| 132 |
"autoStart0Done()", true); |
121 |
"autoStart0Done()", true); |
| 133 |
connectDCOPSignal( launcher, launcher, "autoStart1Done()", |
122 |
connectDCOPSignal( launcher, launcher, "autoStart1Done()", |
| 134 |
"autoStart1Done()", true); |
123 |
"autoStart1Done()", true); |
| 135 |
connectDCOPSignal( launcher, launcher, "autoStart2Done()", |
124 |
connectDCOPSignal( launcher, launcher, "autoStart2Done()", |
| 136 |
"autoStart2Done()", true); |
125 |
"autoStart2Done()", true); |
| 137 |
upAndRunning( "ksmserver" ); |
|
|
| 138 |
|
126 |
|
| 139 |
if ( !wmCommands.isEmpty() ) { |
127 |
// find all commands to launch the wm in the session |
| 140 |
// when we have a window manager, we start it first and give |
128 |
TQValueList<QStringList> wmStartCommands; |
| 141 |
// it some time before launching other processes. Results in a |
129 |
if ( !wm.isEmpty() ) { |
| 142 |
// visually more appealing startup. |
130 |
for ( int i = 1; i <= count; i++ ) { |
| 143 |
for (uint i = 0; i < wmCommands.count(); i++) |
131 |
TQString n = TQString::number(i); |
| 144 |
startApplication( wmCommands[i] ); |
132 |
// special hack for it, both kde3(=native) and kde4 kwin have the same program, |
| 145 |
if ((showFancyLogin) && (!startupNotifierIPDlg)) { |
133 |
// but the command for kde4 kwin starts with the kde4 wrapper |
| 146 |
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP(); |
134 |
if( config->readEntry( TQString("program")+n ) == "kwin" ) { |
| 147 |
} |
135 |
TQStringList command = config->readListEntry( TQString("restartCommand")+n ); |
| 148 |
TQTimer::singleShot( 4000, this, TQT_SLOT( autoStart0() ) ); |
136 |
if( wmCommands.count() > 1 && wmCommands[ 0 ].endsWith( "kde4" ) |
| 149 |
} else { |
137 |
&& command.count() > 1 && command[ 0 ].endsWith( "kde4" )) { |
| 150 |
if ((showFancyLogin) && (!startupNotifierIPDlg)) { |
138 |
wmStartCommands << command; // kde4 wanted, kde4 found |
| 151 |
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP(); |
139 |
} else if(!( wmCommands.count() > 1 && wmCommands[ 0 ].endsWith( "kde4" )) |
|
|
140 |
&& !( command.count() > 1 && command[ 0 ].endsWith( "kde4" ))) { |
| 141 |
wmStartCommands << command; // native wanted, native found |
| 142 |
} |
| 143 |
} else if ( wm == config->readEntry( TQString("program")+n ) ) { |
| 144 |
wmStartCommands << config->readListEntry( TQString("restartCommand")+n ); |
| 145 |
} |
| 152 |
} |
146 |
} |
| 153 |
autoStart0(); |
147 |
} |
|
|
148 |
if( wmStartCommands.isEmpty()) { // otherwise use the configured default |
| 149 |
wmStartCommands << wmCommands; |
| 154 |
} |
150 |
} |
|
|
151 |
launchWM( wmStartCommands ); |
| 155 |
} |
152 |
} |
| 156 |
|
153 |
|
| 157 |
/*! |
154 |
/*! |
|
Lines 180-197
Link Here
|
| 180 |
"autoStart1Done()", true); |
177 |
"autoStart1Done()", true); |
| 181 |
connectDCOPSignal( launcher, launcher, "autoStart2Done()", |
178 |
connectDCOPSignal( launcher, launcher, "autoStart2Done()", |
| 182 |
"autoStart2Done()", true); |
179 |
"autoStart2Done()", true); |
| 183 |
startApplication( wm ); |
180 |
launchWM( TQValueList< TQStringList >() << wmCommands ); |
| 184 |
if ((showFancyLogin) && (!startupNotifierIPDlg)) { |
181 |
if ((showFancyLogin) && (!startupNotifierIPDlg)) { |
| 185 |
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP(); |
182 |
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP(); |
| 186 |
} |
183 |
} |
|
|
184 |
} |
| 185 |
|
| 186 |
void KSMServer::launchWM( const QValueList< QStringList >& wmStartCommands ) |
| 187 |
{ |
| 188 |
assert( state == LaunchingWM ); |
| 189 |
|
| 190 |
// when we have a window manager, we start it first and give |
| 191 |
// it some time before launching other processes. Results in a |
| 192 |
// visually more appealing startup. |
| 193 |
wmProcess = startApplication( wmStartCommands[ 0 ] ); |
| 194 |
connect( wmProcess, TQT_SIGNAL( processExited( KProcess* )), TQT_SLOT( wmProcessChange())); |
| 195 |
// there can be possibly more wm's (because of forking for multihead), |
| 196 |
// but in such case care only about the process of the first one |
| 197 |
for (unsigned int i = 1; i < wmStartCommands.count(); i++) { |
| 198 |
startApplication( wmStartCommands[i] ); |
| 199 |
} |
| 187 |
TQTimer::singleShot( 4000, this, TQT_SLOT( autoStart0() ) ); |
200 |
TQTimer::singleShot( 4000, this, TQT_SLOT( autoStart0() ) ); |
| 188 |
} |
201 |
} |
| 189 |
|
202 |
|
| 190 |
|
203 |
|
| 191 |
void KSMServer::clientSetProgram( KSMClient* client ) |
204 |
void KSMServer::clientSetProgram( KSMClient* client ) |
| 192 |
{ |
205 |
{ |
| 193 |
if ( !wm.isEmpty() && client->program() == wm ) |
206 |
if ( client->program() == wm ) { |
| 194 |
autoStart0(); |
207 |
autoStart0(); |
|
|
208 |
} |
| 209 |
} |
| 210 |
|
| 211 |
void KSMServer::wmProcessChange() |
| 212 |
{ |
| 213 |
if( state != LaunchingWM ) |
| 214 |
{ // don't care about the process when not in the wm-launching state anymore |
| 215 |
wmProcess = NULL; |
| 216 |
return; |
| 217 |
} |
| 218 |
if( !wmProcess->isRunning()) |
| 219 |
{ // wm failed to launch for some reason, go with kwin instead |
| 220 |
kdWarning( 1218 ) << "Window manager '" << wm << "' failed to launch" << endl; |
| 221 |
if( wm == "kwin" ) { |
| 222 |
return; // uhoh, kwin itself failed |
| 223 |
} |
| 224 |
kdDebug( 1218 ) << "Launching KWin" << endl; |
| 225 |
wm = "kwin"; |
| 226 |
wmCommands = ( TQStringList() << "kwin" ); |
| 227 |
// launch it |
| 228 |
launchWM( TQValueList< TQStringList >() << wmCommands ); |
| 229 |
return; |
| 230 |
} |
| 195 |
} |
231 |
} |
| 196 |
|
232 |
|
| 197 |
void KSMServer::autoStart0() |
233 |
void KSMServer::autoStart0() |