By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1499
Collapse All | Expand All

(-)./ksmserver/startup.cpp.ori (-29 / +65 lines)
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()
(-)./ksmserver/server.h.ORI (-1 / +9 lines)
Lines 30-35 Link Here
30
#define SESSION_PREVIOUS_LOGOUT "saved at previous logout"
30
#define SESSION_PREVIOUS_LOGOUT "saved at previous logout"
31
#define SESSION_BY_USER  "saved by user"
31
#define SESSION_BY_USER  "saved by user"
32
32
33
class KProcess;
34
33
typedef TQValueList<TQCString> QCStringList;
35
typedef TQValueList<TQCString> QCStringList;
34
class KSMListener;
36
class KSMListener;
35
class KSMConnection;
37
class KSMConnection;
Lines 98-103 Link Here
98
		      KApplication::ShutdownType sdtype,
100
		      KApplication::ShutdownType sdtype,
99
		      KApplication::ShutdownMode sdmode );
101
		      KApplication::ShutdownMode sdmode );
100
102
103
    void launchWM( const TQValueList< TQStringList >& wmStartCommands );
104
101
public slots:
105
public slots:
102
    void cleanUp();
106
    void cleanUp();
103
107
Lines 120-125 Link Here
120
    void autoStart2();
124
    void autoStart2();
121
    void tryRestoreNext();
125
    void tryRestoreNext();
122
    void startupSuspendTimeout();
126
    void startupSuspendTimeout();
127
    void wmProcessChange();
123
128
124
private:
129
private:
125
    void handlePendingInteractions();
130
    void handlePendingInteractions();
Lines 138-144 Link Here
138
    void startProtection();
143
    void startProtection();
139
    void endProtection();
144
    void endProtection();
140
145
141
    void startApplication( TQStringList command,
146
    KProcess* startApplication( TQStringList command,
142
        const TQString& clientMachine = TQString::null,
147
        const TQString& clientMachine = TQString::null,
143
        const TQString& userId = TQString::null );
148
        const TQString& userId = TQString::null );
144
    void executeCommand( const TQStringList& command );
149
    void executeCommand( const TQStringList& command );
Lines 149-154 Link Here
149
    bool isCM( const TQString& program ) const;
154
    bool isCM( const TQString& program ) const;
150
    bool isNotifier( const KSMClient* client ) const;
155
    bool isNotifier( const KSMClient* client ) const;
151
    bool isNotifier( const TQString& program ) const;
156
    bool isNotifier( const TQString& program ) const;
157
    void selectWm( const TQString& kdewm );
152
    bool defaultSession() const; // empty session
158
    bool defaultSession() const; // empty session
153
    void setupXIOErrorHandler();
159
    void setupXIOErrorHandler();
154
160
Lines 231-236 Link Here
231
    TQString lastIdStarted;
237
    TQString lastIdStarted;
232
    
238
    
233
    TQStringList excludeApps;
239
    TQStringList excludeApps;
240
    TQStringList wmCommands;
241
    KProcess* wmProcess;
234
242
235
    WindowMap legacyWindows;
243
    WindowMap legacyWindows;
236
};
244
};
(-)./ksmserver/CMakeLists.txt.ORI (+2 lines)
Lines 28-33 Link Here
28
  ${DBUS_TQT_LIBRARY_DIRS}
28
  ${DBUS_TQT_LIBRARY_DIRS}
29
)
29
)
30
30
31
add_subdirectory( windowmanagers )
32
31
33
32
##### other data ################################
34
##### other data ################################
33
35
(-)./ksmserver/main.cpp.ori (-2 lines)
Lines 203-210 Link Here
203
    }
203
    }
204
204
205
    TQCString wm = args->getOption("windowmanager");
205
    TQCString wm = args->getOption("windowmanager");
206
    if ( wm.isEmpty() )
207
	wm = "kwin";
208
206
209
    bool only_local = args->isSet("local");
207
    bool only_local = args->isSet("local");
210
#ifndef HAVE__ICETRANSNOLISTEN
208
#ifndef HAVE__ICETRANSNOLISTEN
(-)./ksmserver/server.cpp.ori (-22 / +83 lines)
Lines 77-82 Link Here
77
#include <kprocess.h>
77
#include <kprocess.h>
78
#include <dcopclient.h>
78
#include <dcopclient.h>
79
#include <dcopref.h>
79
#include <dcopref.h>
80
#include <kdesktopfile.h>
81
#include <kshell.h>
80
82
81
#include "server.h"
83
#include "server.h"
82
#include "global.h"
84
#include "global.h"
Lines 98-108 Link Here
98
/*! Utility function to execute a command on the local machine. Used
100
/*! Utility function to execute a command on the local machine. Used
99
 * to restart applications.
101
 * to restart applications.
100
 */
102
 */
101
void KSMServer::startApplication( TQStringList command, const TQString& clientMachine,
103
KProcess* KSMServer::startApplication( TQStringList command, const TQString& clientMachine,
102
    const TQString& userId )
104
    const TQString& userId )
103
{
105
{
104
    if ( command.isEmpty() )
106
    if ( command.isEmpty() )
105
        return;
107
        return NULL;
106
    if ( !userId.isEmpty()) {
108
    if ( !userId.isEmpty()) {
107
        struct passwd* pw = getpwuid( getuid());
109
        struct passwd* pw = getpwuid( getuid());
108
        if( pw != NULL && userId != TQString::fromLocal8Bit( pw->pw_name )) {
110
        if( pw != NULL && userId != TQString::fromLocal8Bit( pw->pw_name )) {
Lines 116-127 Link Here
116
        command.prepend( clientMachine );
118
        command.prepend( clientMachine );
117
	command.prepend( xonCommand ); // "xon" by default
119
	command.prepend( xonCommand ); // "xon" by default
118
    }
120
    }
119
    int n = command.count();
121
    KProcess* process = new KProcess( this );
120
    TQCString app = command[0].latin1();
122
    *process << command;
121
    TQValueList<TQCString> argList;
123
    // make it auto-delete
122
    for ( int i=1; i < n; i++)
124
    connect( process, TQT_SIGNAL( processExited( KProcess* )), process, TQT_SLOT( deleteLater()));
123
       argList.append( TQCString(command[i].latin1()));
125
    process->start();
124
    DCOPRef( launcher ).send( "exec_blind", app, DCOPArg( argList, "TQValueList<TQCString>" ) );
126
    return process;
127
125
}
128
}
126
129
127
/*! Utility function to execute a command on the local machine. Used
130
/*! Utility function to execute a command on the local machine. Used
Lines 579-585 Link Here
579
#endif
582
#endif
580
583
581
KSMServer::KSMServer( const TQString& windowManager, bool _only_local )
584
KSMServer::KSMServer( const TQString& windowManager, bool _only_local )
582
  : DCOPObject("ksmserver"), sessionGroup( "" ), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0)
585
  : DCOPObject("ksmserver"), sessionGroup( "" ), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0), wmProcess( NULL )
583
{
586
{
584
    the_server = this;
587
    the_server = this;
585
    clean = false;
588
    clean = false;
Lines 595-601 Link Here
595
    config->setGroup("General" );
598
    config->setGroup("General" );
596
    clientInteracting = 0;
599
    clientInteracting = 0;
597
    xonCommand = config->readEntry( "xonCommand", "xon" );
600
    xonCommand = config->readEntry( "xonCommand", "xon" );
598
    
601
602
    KGlobal::dirs()->addResourceType( "windowmanagers", "share/apps/ksmserver/windowmanagers" );
603
    selectWm( windowManager );
604
599
    connect( &knotifyTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( knotifyTimeout()));
605
    connect( &knotifyTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( knotifyTimeout()));
600
    connect( &startupSuspendTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( startupSuspendTimeout()));
606
    connect( &startupSuspendTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( startupSuspendTimeout()));
601
    connect( &pendingShutdown, TQT_SIGNAL( timeout()), TQT_SLOT( pendingShutdownTimeout()));
607
    connect( &pendingShutdown, TQT_SIGNAL( timeout()), TQT_SLOT( pendingShutdownTimeout()));
Lines 851-865 Link Here
851
    config->setGroup( sessionGroup );
857
    config->setGroup( sessionGroup );
852
    count =  0;
858
    count =  0;
853
859
854
    if ( !wm.isEmpty() ) {
860
    // put the wm first
855
        // put the wm first
861
    for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
856
        for ( KSMClient* c = clients.first(); c; c = clients.next() )
862
        if ( c->program() == wm ) {
857
            if ( c->program() == wm ) {
863
            clients.prepend( clients.take() );
858
                clients.prepend( clients.take() );
864
            break;
859
                break;
865
        }
860
            }
861
    }
866
    }
862
867
868
863
    for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
869
    for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
864
        int restartHint = c->restartStyleHint();
870
        int restartHint = c->restartStyleHint();
865
        if (restartHint == SmRestartNever)
871
        if (restartHint == SmRestartNever)
Lines 909-919 Link Here
909
915
910
bool KSMServer::isWM( const TQString& program ) const
916
bool KSMServer::isWM( const TQString& program ) const
911
{
917
{
912
    // KWin relies on ksmserver's special treatment in phase1,
918
    return program == wm;
913
    // therefore make sure it's recognized even if ksmserver
914
    // was initially started with different WM, and kwin replaced
915
    // it later
916
    return ((program == wm) || (program == "kwin"));
917
}
919
}
918
920
919
bool KSMServer::isCM( const KSMClient* client ) const
921
bool KSMServer::isCM( const KSMClient* client ) const
Lines 941-943 Link Here
941
{
943
{
942
    return sessionGroup.isEmpty();
944
    return sessionGroup.isEmpty();
943
}
945
}
946
947
static bool noDisplay( KDesktopFile& f )
948
{
949
    KConfigGroup gr( &f, "Desktop Entry" );
950
    if (gr.readBoolEntry("NoDisplay", false)) {
951
        return true;
952
    }
953
    if (gr.hasKey("OnlyShowIn")) {
954
        if (!gr.readListEntry("OnlyShowIn", ';').contains("KDE"))
955
            return true;
956
    }
957
    if (gr.hasKey("NotShowIn")) {
958
        if (gr.readListEntry("NotShowIn", ';').contains("KDE"))
959
            return true;
960
    }
961
    return false;
962
}
963
964
// selection logic:
965
// - $KDEWM is set - use that
966
// - a wm is selected using the kcm - use that
967
// - if that fails, just use KWin
968
void KSMServer::selectWm( const TQString& kdewm )
969
{
970
    wm = "kwin"; // defaults
971
    wmCommands = ( TQStringList() << "kwin" ); 
972
    if( !kdewm.isEmpty())
973
    {
974
        wmCommands = ( TQStringList() << kdewm );
975
        wm = kdewm;
976
        return;
977
    }
978
    KConfigGroup config(KGlobal::config(), "General");
979
    TQString cfgwm = config.readEntry( "windowManager", "kwin" );
980
    KDesktopFile file( cfgwm + ".desktop", true, "windowmanagers" );
981
    if( noDisplay( file )) {
982
        return;
983
    }
984
    if( !file.tryExec()) {
985
        return;
986
    }
987
    file.setDesktopGroup();
988
    TQString testexec = file.readEntry( "X-KDE-WindowManagerTestExec" );
989
    if( !testexec.isEmpty())
990
    {
991
        int ret = system( TQFile::encodeName( testexec ));
992
        if( !WIFEXITED( ret ) || WEXITSTATUS( ret ) != 0 ) {
993
            return;
994
        }
995
    }
996
    TQStringList cfgWmCommands = KShell::splitArgs( file.readEntry( "Exec" ));
997
    if( cfgWmCommands.isEmpty()) {
998
        return;
999
    }
1000
    TQString smname = file.readEntry( "X-KDE-WindowManagerId" );
1001
    // ok
1002
    wm = smname.isEmpty() ? cfgwm : smname;
1003
    wmCommands = cfgWmCommands;
1004
}
(-)ksmserver/windowmanagers/CMakeLists.txt (+4 lines)
Line 0 Link Here
1
install(
2
  FILES compiz-custom.desktop compiz.desktop kwin4.desktop metacity.desktop openbox.desktop
3
  DESTINATION ${DATA_INSTALL_DIR}/ksmserver/windowmanagers
4
)
(-)ksmserver/windowmanagers/openbox.desktop (+5 lines)
Line 0 Link Here
1
[Desktop Entry]
2
Name=Openbox
3
Exec=openbox
4
TryExec=openbox
5
(-)ksmserver/windowmanagers/compiz.desktop (+4 lines)
Line 0 Link Here
1
[Desktop Entry]
2
Name=Compiz
3
Exec=compiz ccp
4
TryExec=compiz
(-)ksmserver/windowmanagers/compiz-custom.desktop (+5 lines)
Line 0 Link Here
1
[Desktop Entry]
2
Name=Compiz custom (create wrapper script 'compiz-kde-launcher' to launch it)
3
Exec=compiz-kde-launcher
4
TryExec=compiz
5
X-KDE-WindowManagerId=compiz
(-)ksmserver/windowmanagers/kwin4.desktop (+6 lines)
Line 0 Link Here
1
[Desktop Entry]
2
Name=KWin (KDE4)
3
Exec=kde4 /usr/bin/kwin
4
TryExec=/usr/bin/kwin
5
X-KDE-WindowManagerId=kwin
6
(-)ksmserver/windowmanagers/metacity.desktop (+4 lines)
Line 0 Link Here
1
[Desktop Entry]
2
Name=Metacity (GNOME)
3
Exec=metacity
4
TryExec=metacity
(-)./kcontrol/smserver/smserverconfigdlg.ui.ori (-3 / +27 lines)
Lines 1-4 Link Here
1
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
1
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
2
<class>SMServerConfigDlg</class>
2
<class>SMServerConfigDlg</class>
3
<widget class="TQWidget">
3
<widget class="TQWidget">
4
    <property name="name">
4
    <property name="name">
Lines 8-15 Link Here
8
        <rect>
8
        <rect>
9
            <x>0</x>
9
            <x>0</x>
10
            <y>0</y>
10
            <y>0</y>
11
            <width>325</width>
11
            <width>334</width>
12
            <height>366</height>
12
            <height>476</height>
13
        </rect>
13
        </rect>
14
    </property>
14
    </property>
15
    <property name="caption">
15
    <property name="caption">
Lines 173-178 Link Here
173
                </widget>
173
                </widget>
174
            </vbox>
174
            </vbox>
175
        </widget>
175
        </widget>
176
        <widget class="TQGroupBox">
177
            <property name="name">
178
                <cstring>windowManagerGroup</cstring>
179
            </property>
180
            <property name="title">
181
                <string>Window Manager</string>
182
            </property>
183
            <hbox>
184
                <property name="name">
185
                    <cstring>unnamed</cstring>
186
                </property>
187
                <widget class="TQComboBox">
188
                    <property name="name">
189
                        <cstring>windowManagerCombo</cstring>
190
                    </property>
191
                </widget>
192
            </hbox>
193
        </widget>
176
        <widget class="TQButtonGroup">
194
        <widget class="TQButtonGroup">
177
            <property name="name">
195
            <property name="name">
178
                <cstring>advancedGroup</cstring>
196
                <cstring>advancedGroup</cstring>
Lines 279-284 Link Here
279
        <receiver>SMServerConfigDlg</receiver>
297
        <receiver>SMServerConfigDlg</receiver>
280
        <slot>configChanged()</slot>
298
        <slot>configChanged()</slot>
281
    </connection>
299
    </connection>
300
    <connection>
301
        <sender>windowManagerCombo</sender>
302
        <signal>activated(int)</signal>
303
        <receiver>SMServerConfigDlg</receiver>
304
        <slot>configChanged()</slot>
305
    </connection>
282
</connections>
306
</connections>
283
<includes>
307
<includes>
284
    <include location="global" impldecl="in implementation">kdialog.h</include>
308
    <include location="global" impldecl="in implementation">kdialog.h</include>
(-)./kcontrol/smserver/kcmsmserver.cpp.ORI (+91 lines)
Lines 22-27 Link Here
22
#include <tqcheckbox.h>
22
#include <tqcheckbox.h>
23
#include <tqlayout.h>
23
#include <tqlayout.h>
24
#include <tqradiobutton.h>
24
#include <tqradiobutton.h>
25
#include <tqcombobox.h>
26
#include <tqfile.h>
25
27
26
#include <dcopclient.h>
28
#include <dcopclient.h>
27
29
Lines 29-34 Link Here
29
#include <kconfig.h>
31
#include <kconfig.h>
30
#include <kgenericfactory.h>
32
#include <kgenericfactory.h>
31
#include <klineedit.h>
33
#include <klineedit.h>
34
#include <kstandarddirs.h>
35
#include <tqregexp.h>
36
#include <kdesktopfile.h>
37
#include <kdebug.h>
38
#include <kprocess.h>
39
#include <kmessagebox.h>
32
40
33
#include "kcmsmserver.h"
41
#include "kcmsmserver.h"
34
#include "smserverconfigimpl.h"
42
#include "smserverconfigimpl.h"
Lines 52-57 Link Here
52
60
53
    dialog->show();
61
    dialog->show();
54
    topLayout->add(dialog);
62
    topLayout->add(dialog);
63
    KGlobal::dirs()->addResourceType( "windowmanagers", "share/apps/ksmserver/windowmanagers" );
55
    load();
64
    load();
56
65
57
}
66
}
Lines 90-95 Link Here
90
    dialog->logoutRadio->setChecked(true);
99
    dialog->logoutRadio->setChecked(true);
91
    break;
100
    break;
92
  }
101
  }
102
  loadWMs(c->readEntry("windowManager", "kwin"));
93
  dialog->excludeLineedit->setText( c->readEntry("excludeApps"));
103
  dialog->excludeLineedit->setText( c->readEntry("excludeApps"));
94
104
95
  c->setGroup("Logout");
105
  c->setGroup("Logout");
Lines 121-126 Link Here
121
                   dialog->rebootRadio->isChecked() ?
131
                   dialog->rebootRadio->isChecked() ?
122
                     int(KApplication::ShutdownTypeReboot) :
132
                     int(KApplication::ShutdownTypeReboot) :
123
                     int(KApplication::ShutdownTypeNone));
133
                     int(KApplication::ShutdownTypeNone));
134
  c->writeEntry("windowManager", currentWM());
124
  c->writeEntry("excludeApps", dialog->excludeLineedit->text());
135
  c->writeEntry("excludeApps", dialog->excludeLineedit->text());
125
  c->setGroup("Logout");
136
  c->setGroup("Logout");
126
  c->writeEntry( "showLogoutStatusDlg", dialog->showLogoutStatusDialog->isChecked());
137
  c->writeEntry( "showLogoutStatusDlg", dialog->showLogoutStatusDialog->isChecked());
Lines 131-136 Link Here
131
  // update the k menu if necessary
142
  // update the k menu if necessary
132
  TQByteArray data;
143
  TQByteArray data;
133
  kapp->dcopClient()->send( "kicker", "kicker", "configure()", data );
144
  kapp->dcopClient()->send( "kicker", "kicker", "configure()", data );
145
  if( oldwm != currentWM())
146
  { // TODO switch it already in the session instead and tell ksmserver
147
    KMessageBox::information( this,
148
        i18n( "The new window manager will be used when TDE is started the next time." ),
149
        i18n( "Window manager change" ), "windowmanagerchange" );
150
  }
134
}
151
}
135
152
136
void SMServerConfig::defaults()
153
void SMServerConfig::defaults()
Lines 138-142 Link Here
138
	load( true );
155
	load( true );
139
}
156
}
140
157
158
static bool noDisplay( KDesktopFile& f )
159
{
160
    KConfigGroup gr( &f, "Desktop Entry" );
161
    if (gr.readBoolEntry("NoDisplay", false)) {
162
        return true;
163
    }
164
    if (gr.hasKey("OnlyShowIn")) {
165
        if (!gr.readListEntry("OnlyShowIn", ';').contains("KDE"))
166
            return true;
167
    }
168
    if (gr.hasKey("NotShowIn")) {
169
        if (gr.readListEntry("NotShowIn", ';').contains("KDE"))
170
            return true;
171
    }
172
    return false;
173
}
174
175
void SMServerConfig::loadWMs( const TQString& current )
176
{
177
  TQString kwinname = i18n( "KWin (KDE default)" );
178
  dialog->windowManagerCombo->insertItem( kwinname );
179
  dialog->windowManagerCombo->setCurrentItem( 0 );
180
  wms[ kwinname ] = "kwin";
181
  oldwm = "kwin";
182
  TQStringList list = KGlobal::dirs()->findAllResources( "windowmanagers", TQString(), false, true );
183
  TQRegExp reg( ".*/([^/\\.]*)\\.[^/\\.]*" );
184
  for( TQStringList::ConstIterator it = list.begin();
185
       it != list.end();
186
       ++it )
187
  {
188
    TQString wmfile = *it;
189
    KDesktopFile file( wmfile );
190
    if( noDisplay( file )) {
191
        continue;
192
    }
193
    if( !file.tryExec()) {
194
        continue;
195
    }
196
    file.setDesktopGroup();
197
    TQString testexec = file.readEntry( "X-KDE-WindowManagerTestExec" );
198
    if( !testexec.isEmpty())
199
    {
200
        int ret = system( TQFile::encodeName( testexec ));
201
        if( !WIFEXITED( ret ) || WEXITSTATUS( ret ) != 0 ) {
202
            continue;
203
        }
204
    }
205
    TQString name = file.readName();
206
    if( name.isEmpty()) {
207
        continue;
208
    }
209
    if( !reg.exactMatch( wmfile )) {
210
        continue;
211
    }
212
    TQString wm = reg.cap( 1 );
213
    if( wms.values().contains( wm )) {
214
        continue;
215
    }
216
    wms[ name ] = wm;
217
    dialog->windowManagerCombo->insertItem( name );
218
    if( wms[ name ] == current ) // make it selected
219
    {
220
        dialog->windowManagerCombo->setCurrentItem( dialog->windowManagerCombo->count() - 1 );
221
        oldwm = wm;
222
    }
223
  }
224
}
225
226
TQString SMServerConfig::currentWM() const
227
{
228
  return wms[ dialog->windowManagerCombo->currentText() ];
229
}
230
231
141
#include "kcmsmserver.moc"
232
#include "kcmsmserver.moc"
142
233
(-)./kcontrol/smserver/kcmsmserver.h.ORI (+4 lines)
Lines 40-45 Link Here
40
40
41
private:
41
private:
42
  SMServerConfigImpl* dialog;
42
  SMServerConfigImpl* dialog;
43
  void loadWMs( const TQString& current );
44
  TQString currentWM() const;
45
  TQMap< TQString, TQString > wms; // i18n text -> internal name
46
  TQString oldwm; // the original value
43
47
44
};
48
};
45
49

Return to bug 1499