summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-02-04 18:12:45 -0600
committerTimothy Pearson <[email protected]>2012-02-04 18:12:45 -0600
commit4546adf40c34f1ad89a8924e81cf94a5af768093 (patch)
tree897ed37b8aa2d15d68a14b80c590d22f439675fa
parentb5d92fb45b0796f0140c2917c238fd0b6a192300 (diff)
downloadtdebase-4546adf40c34f1ad89a8924e81cf94a5af768093.tar.gz
tdebase-4546adf40c34f1ad89a8924e81cf94a5af768093.zip
Initial attempt at adding third part WM support to TDE
-rw-r--r--CMakeLists.txt1
-rw-r--r--ksmserver/main.cpp4
-rw-r--r--ksmserver/server.cpp3
-rw-r--r--ksmserver/server.h3
-rw-r--r--ksmserver/startup.cpp10
-rw-r--r--starttde3
-rw-r--r--tdeinit/CMakeLists.txt28
-rw-r--r--tdeinit/phase1.cpp82
8 files changed, 128 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 830eea998..093626569 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,6 +157,7 @@ set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
##### tdebase directories #######################
add_subdirectory( tdmlib )
+add_subdirectory( tdeinit )
tde_conditional_add_subdirectory( BUILD_L10N l10n )
tde_conditional_add_subdirectory( BUILD_PICS pics )
diff --git a/ksmserver/main.cpp b/ksmserver/main.cpp
index a7f8ef3d9..c971c2dde 100644
--- a/ksmserver/main.cpp
+++ b/ksmserver/main.cpp
@@ -35,6 +35,7 @@ static const KCmdLineOptions options[] =
{ "restore", I18N_NOOP("Restores the saved user session if available"), 0},
{ "w", 0, 0 },
{ "windowmanager <wm>", I18N_NOOP("Starts 'wm' in case no other window manager is \nparticipating in the session. Default is 'twin'"), 0},
+ { "windowmanageraddargs <wm>", I18N_NOOP("Pass additional arguments to the window manager. Default is ''"), 0},
{ "nolocal", I18N_NOOP("Also allow remote connections"), 0},
KCmdLineLastOption
};
@@ -203,6 +204,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char* argv[] )
}
TQCString wm = args->getOption("windowmanager");
+ TQCString wmaddargs = args->getOption("windowmanageraddargs");
if ( wm.isEmpty() )
wm = "twin";
@@ -218,7 +220,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char* argv[] )
only_local = false;
#endif
- KSMServer *server = new KSMServer( TQString::fromLatin1(wm), only_local);
+ KSMServer *server = new KSMServer( TQString::fromLatin1(wm), TQString::fromLatin1(wmaddargs), only_local);
kapp->dcopClient()->setDefaultObject( server->objId() );
IceSetIOErrorHandler( IoErrorHandler );
diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp
index 91cfb7544..f47f10ab2 100644
--- a/ksmserver/server.cpp
+++ b/ksmserver/server.cpp
@@ -578,12 +578,13 @@ static Status KSMNewClientProc ( SmsConn conn, SmPointer manager_data,
extern "C" int _IceTransNoListen(const char * protocol);
#endif
-KSMServer::KSMServer( const TQString& windowManager, bool _only_local )
+KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManagerAddArgs, bool _only_local )
: DCOPObject("ksmserver"), sessionGroup( "" ), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0)
{
the_server = this;
clean = false;
wm = windowManager;
+ wmAddArgs = windowManagerAddArgs;
shutdownType = KApplication::ShutdownTypeNone;
diff --git a/ksmserver/server.h b/ksmserver/server.h
index 9464d5275..ca73c3a86 100644
--- a/ksmserver/server.h
+++ b/ksmserver/server.h
@@ -58,7 +58,7 @@ k_dcop:
void kcmPhase1Done();
void kcmPhase2Done();
public:
- KSMServer( const TQString& windowManager, bool only_local );
+ KSMServer( const TQString& windowManager, const TQString& windowManagerAddArgs, bool only_local );
~KSMServer();
static KSMServer* self();
@@ -203,6 +203,7 @@ private:
bool clean;
KSMClient* clientInteracting;
TQString wm;
+ TQString wmAddArgs;
TQString sessionGroup;
TQString sessionName;
TQCString launcher;
diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp
index b53ae3d18..eaee5f20c 100644
--- a/ksmserver/startup.cpp
+++ b/ksmserver/startup.cpp
@@ -180,7 +180,15 @@ void KSMServer::startDefaultSession()
"autoStart1Done()", true);
connectDCOPSignal( launcher, launcher, "autoStart2Done()",
"autoStart2Done()", true);
- startApplication( wm );
+ if (!wmAddArgs.isEmpty()) {
+ TQStringList wmstartupcommand;
+ wmstartupcommand.split(" ", wmAddArgs);
+ wmstartupcommand.prepend(wm);
+ startApplication( wmstartupcommand );
+ }
+ else {
+ startApplication( wm );
+ }
if ((showFancyLogin) && (!startupNotifierIPDlg)) {
startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP();
}
diff --git a/starttde b/starttde
index 38b621a87..ebc7f958c 100644
--- a/starttde
+++ b/starttde
@@ -575,8 +575,7 @@ fi
# We only check for 255 which means that the ksmserver process could not be
# started, any problems thereafter, e.g. ksmserver failing to initialize,
# will remain undetected.
-test -n "$TDEWM" && TDEWM="--windowmanager $TDEWM"
-kwrapper ksmserver $TDEWM
+tdeinit_phase1
if test $? -eq 255; then
# Startup error
echo '[starttde] Could not start ksmserver. Check your installation.' 1>&2
diff --git a/tdeinit/CMakeLists.txt b/tdeinit/CMakeLists.txt
new file mode 100644
index 000000000..817492c6c
--- /dev/null
+++ b/tdeinit/CMakeLists.txt
@@ -0,0 +1,28 @@
+#################################################
+#
+# (C) 2010-2011 Timothy Pearson
+# kb9vqf (AT) pearsoncomputing.net
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### tdeinit_phase1 (executable) #######################
+
+tde_add_executable( tdeinit_phase1
+ SOURCES phase1.cpp
+ LINK udev
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/tdeinit/phase1.cpp b/tdeinit/phase1.cpp
new file mode 100644
index 000000000..286d7da2d
--- /dev/null
+++ b/tdeinit/phase1.cpp
@@ -0,0 +1,82 @@
+/***************************************************************************
+ * Copyright (C) 2012 Timothy Pearson <[email protected]> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include <pwd.h>
+#include <signal.h>
+
+static const char description[] = I18N_NOOP("TDE Initialization Phase 1");
+
+static const char version[] = "0.1";
+
+static KCmdLineOptions options[] =
+{
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ int return_code = -1;
+
+ KAboutData about("tdeinit_phase1", I18N_NOOP("tdeinit_phase1"), version, description,
+ KAboutData::License_GPL, "(C) 2012 Timothy Pearson", 0, 0, "[email protected]");
+ about.addAuthor( "Timothy Pearson", 0, "[email protected]" );
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions( options );
+
+ KApplication app;
+
+ KConfig config("twinrc", true);
+ config.setGroup( "ThirdPartyWM" );
+ TQString wmToLaunch = config.readEntry("WMExecutable", "");
+ TQString wmArguments = config.readEntry("WMAdditionalArguments", "");
+
+ // Check for TWIN override environment variable
+ const char * twin_env = getenv("TWIN");
+ if (twin_env) {
+ wmToLaunch = twin_env;
+ }
+
+ // Make sure the specified WM exists
+ if (KStandardDirs::findExe(wmToLaunch) == TQString::null) {
+ wmToLaunch = "";
+
+ }
+
+ // Launch the WM!
+ if (wmToLaunch == "") {
+ return_code = system("kwrapper ksmserver");
+ }
+ else {
+ return_code = system((TQString("kwrapper ksmserver --windowmanager %1 --windowmanageraddargs %2").arg(wmToLaunch).arg(wmArguments)).ascii());
+ }
+
+ return return_code;
+}
+