From 341ad02235b9c85cd31782225181ed475b74eaa3 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 9 Aug 2011 09:11:52 +0000 Subject: Fix spurious kompmgr crash dialogs Disable irritating and obsolete warning dialog when kompmgr is enabled git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1245889 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kwin/kcmkwin/kwinoptions/windows.cpp | 8 ++-- kwin/workspace.cpp | 82 ++++++++++++++++++------------------ kwin/workspace.h | 2 +- 3 files changed, 47 insertions(+), 45 deletions(-) diff --git a/kwin/kcmkwin/kwinoptions/windows.cpp b/kwin/kcmkwin/kwinoptions/windows.cpp index 0f5939c6e..f438cd5ef 100644 --- a/kwin/kcmkwin/kwinoptions/windows.cpp +++ b/kwin/kcmkwin/kwinoptions/windows.cpp @@ -1526,7 +1526,7 @@ void KTranslucencyConfig::load( void ) KConfig conf_(TQDir::homeDirPath() + "/.xcompmgrrc"); conf_.setGroup("xcompmgr"); - + disableARGB->setChecked(conf_.readBoolEntry("DisableARGB",FALSE)); useShadows->setChecked(conf_.readEntry("Compmode","CompClientShadows").compare("CompClientShadows") == 0); @@ -1581,7 +1581,7 @@ void KTranslucencyConfig::save( void ) config->writeEntry("DockShadowSize",(int)(200.0 * dockWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value()))); config->writeEntry("ActiveWindowShadowSize",(int)(200.0 * activeWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value()))); config->writeEntry("InactiveWindowShadowSize",(int)(200.0 * inactiveWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value()))); - + config->writeEntry("RemoveShadowsOnMove",removeShadowsOnMove->isChecked()); config->writeEntry("RemoveShadowsOnResize",removeShadowsOnResize->isChecked()); config->writeEntry("OnlyDecoTranslucent", onlyDecoTranslucent->isChecked()); @@ -1671,8 +1671,8 @@ bool KTranslucencyConfig::kompmgrAvailable() void KTranslucencyConfig::showWarning(bool alphaActivated) { - if (alphaActivated) - KMessageBox::information(this, i18n("Translucency support is new and may cause problems
including crashes (sometimes the translucency engine, seldom even X).
"), i18n("Warning")); +// if (alphaActivated) +// KMessageBox::information(this, i18n("Translucency support is new and may cause problems
including crashes (sometimes the translucency engine, seldom even X).
"), i18n("Warning")); } #include "windows.moc" diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp index 078d4d51b..6cf48258c 100644 --- a/kwin/workspace.cpp +++ b/kwin/workspace.cpp @@ -2563,10 +2563,10 @@ void Workspace::startKompmgr() kompmgr_selection = new KSelectionOwner( selection_name ); connect( kompmgr_selection, TQT_SIGNAL( lostOwnership()), TQT_SLOT( stopKompmgr())); kompmgr_selection->claim( true ); - connect(kompmgr, TQT_SIGNAL(processExited(KProcess*)), TQT_SLOT(restartKompmgr())); + connect(kompmgr, TQT_SIGNAL(processExited(KProcess*)), TQT_SLOT(restartKompmgr(KProcess*))); options->useTranslucency = TRUE; - allowKompmgrRestart = FALSE; - TQTimer::singleShot( 60000, this, TQT_SLOT(unblockKompmgrRestart()) ); + //allowKompmgrRestart = FALSE; + //TQTimer::singleShot( 60000, this, TQT_SLOT(unblockKompmgrRestart()) ); TQByteArray ba; TQDataStream arg(ba, IO_WriteOnly); arg << ""; @@ -2601,47 +2601,49 @@ void Workspace::unblockKompmgrRestart() allowKompmgrRestart = TRUE; } -void Workspace::restartKompmgr() +void Workspace::restartKompmgr( KProcess *proc ) // this is for inernal purpose (crashhandling) only, usually you want to use workspace->stopKompmgr(); TQTimer::singleShot(200, workspace, TQT_SLOT(startKompmgr())); { - if (!allowKompmgrRestart) // uh-ohh - { - delete kompmgr_selection; - kompmgr_selection = NULL; - options->useTranslucency = FALSE; - KProcess proc; - proc << "kdialog" << "--error" - << i18n( "The Composite Manager crashed twice within a minute and is therefore disabled for this session.") - << "--title" << i18n("Composite Manager Failure"); - proc.start(KProcess::DontCare); - return; - } - if (!kompmgr) - return; + if (proc->signalled()) { // looks like kompmgr crashed + if (!allowKompmgrRestart) // uh oh, it crashed recently already + { + delete kompmgr_selection; + kompmgr_selection = NULL; + options->useTranslucency = FALSE; + KProcess proc; + proc << "kdialog" << "--error" + << i18n( "The Composite Manager crashed twice within a minute and is therefore disabled for this session.") + << "--title" << i18n("Composite Manager Failure"); + proc.start(KProcess::DontCare); + return; + } + if (!kompmgr) + return; // this should be useless, i keep it for maybe future need -// if (!kcompmgr) -// { -// kompmgr = new KProcess; -// kompmgr->clearArguments(); -// *kompmgr << "kompmgr"; -// } +// if (!kcompmgr) +// { +// kompmgr = new KProcess; +// kompmgr->clearArguments(); +// *kompmgr << "kompmgr"; +// } // ------------------- - if (!kompmgr->start(KProcess::NotifyOnExit, KProcess::Stderr)) - { - delete kompmgr_selection; - kompmgr_selection = NULL; - options->useTranslucency = FALSE; - KProcess proc; - proc << "kdialog" << "--error" - << i18n("The Composite Manager could not be started.\\nMake sure you have \"kompmgr\" in a $PATH directory.") - << "--title" << i18n("Composite Manager Failure"); - proc.start(KProcess::DontCare); - } - else - { - allowKompmgrRestart = FALSE; - TQTimer::singleShot( 60000, this, TQT_SLOT(unblockKompmgrRestart()) ); - } + if (!kompmgr->start(KProcess::NotifyOnExit, KProcess::Stderr)) + { + delete kompmgr_selection; + kompmgr_selection = NULL; + options->useTranslucency = FALSE; + KProcess proc; + proc << "kdialog" << "--error" + << i18n("The Composite Manager could not be started.\\nMake sure you have \"kompmgr\" in a $PATH directory.") + << "--title" << i18n("Composite Manager Failure"); + proc.start(KProcess::DontCare); + } + else + { + allowKompmgrRestart = FALSE; + TQTimer::singleShot( 60000, this, TQT_SLOT(unblockKompmgrRestart()) ); + } + } } void Workspace::handleKompmgrOutput( KProcess* , char *buffer, int buflen) diff --git a/kwin/workspace.h b/kwin/workspace.h index 55043276e..a4aa6d27f 100644 --- a/kwin/workspace.h +++ b/kwin/workspace.h @@ -401,7 +401,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void resetClientOpacity(); void setTransButtonText(int value); void unblockKompmgrRestart(); - void restartKompmgr(); + void restartKompmgr( KProcess *proc ); void handleKompmgrOutput( KProcess *proc, char *buffer, int buflen); void stopKompmgr(); // end -- cgit v1.2.1