From 7f8505d6f03fff87f48aecb3838101eb7bee8da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 17 Jan 2005 17:32:27 +0000 Subject: [PATCH] No message boxes directly in KWin - it cannot manage windows created by itself. svn path=/trunk/kdebase/kwin/; revision=379470 --- workspace.cpp | 58 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index 6f68799717..73dfd84201 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -18,7 +18,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include -#include #include #include #include @@ -2321,11 +2320,13 @@ void Workspace::startKompmgr() if (!kompmgr || kompmgr->isRunning()) return; if (!kompmgr->start(KProcess::OwnGroup, KProcess::Stderr)) - { { options->useTranslucency = FALSE; - KMessageBox::information(desktop_widget, i18n("The Composite Manager could not be started.
Make sure you have \"kompmgr\" in a $PATH directory.
"),0, "UseTranslucency"); - } + KProcess proc; + proc << "kdialog" << "--error" + << i18n("The Composite Manager could not be started.\\nMake sure you have \"kompmgr\" in a $PATH directory.") + << "--title" << "Composite Manager failure"; + proc.start(KProcess::DontCare); } else { @@ -2358,7 +2359,11 @@ void Workspace::restartKompmgr() if (!allowKompmgrRestart) // uh-ohh { options->useTranslucency = FALSE; - KMessageBox::information(desktop_widget, i18n("The Composite Manager crashed twice within a minute and is therefore disabled for this session."), i18n("Composite Manager Failure")); + 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) @@ -2374,7 +2379,11 @@ void Workspace::restartKompmgr() if (!kompmgr->start(KProcess::NotifyOnExit, KProcess::Stderr)) { options->useTranslucency = FALSE; - KMessageBox::information(desktop_widget, i18n("The Composite Manager could not be started.
Make sure you have \"kompmgr\" in a $PATH directory.
")); + 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 { @@ -2383,26 +2392,37 @@ void Workspace::restartKompmgr() } } -void Workspace::handleKompmgrOutput( KProcess *proc, char *buffer, int buflen) +void Workspace::handleKompmgrOutput( KProcess* , char *buffer, int buflen) { - if (QString(buffer).contains("Started",false)); // don't do anything, just pass to the connection release - else if (QString(buffer).contains("Can't open display",false)) - KMessageBox::sorry(desktop_widget, i18n("kompmgr failed to open the display
There is probably an invalid display entry in your ~/.xcompmgrrc.
")); - else if (QString(buffer).contains("No render extension",false)) - KMessageBox::sorry(desktop_widget, i18n("kompmgr cannot find the Xrender extension
You are using either an outdated or a crippled version of XOrg.
Get XOrg ≥ 6.8 from www.freedesktop.org.
")); - else if (QString(buffer).contains("No composite extension",false)) - KMessageBox::sorry(desktop_widget, i18n("Composite extension not found
You must use XOrg ≥ 6.8 for translucency and shadows to work.
Additionally, you need to add a new section to your X config file:
" + QString message; + QString output = QString::fromLocal8Bit( buffer, buflen ); + if (output.contains("Started",false)) + ; // don't do anything, just pass to the connection release + else if (output.contains("Can't open display",false)) + message = i18n("kompmgr failed to open the display
There is probably an invalid display entry in your ~/.xcompmgrrc.
"); + else if (output.contains("No render extension",false)) + message = i18n("kompmgr cannot find the Xrender extension
You are using either an outdated or a crippled version of XOrg.
Get XOrg ≥ 6.8 from www.freedesktop.org.
"); + else if (output.contains("No composite extension",false)) + message = i18n("Composite extension not found
You must use XOrg ≥ 6.8 for translucency and shadows to work.
Additionally, you need to add a new section to your X config file:
" "Section \"Extensions\"
" "Option \"Composite\" \"Enable\"
" - "EndSection
")); - else if (QString(buffer).contains("No damage extension",false)) - KMessageBox::sorry(desktop_widget, i18n("Damage extension not found
You must use XOrg ≥ 6.8 for translucency and shadows to work.
")); - else if (QString(buffer).contains("No XFixes extension",false)) - KMessageBox::sorry(desktop_widget, i18n("XFixes extension not found
You must use XOrg ≥ 6.8 for translucency and shadows to work.
")); + "EndSection
"); + else if (output.contains("No damage extension",false)) + message = i18n("Damage extension not found
You must use XOrg ≥ 6.8 for translucency and shadows to work.
"); + else if (output.contains("No XFixes extension",false)) + message = i18n("XFixes extension not found
You must use XOrg ≥ 6.8 for translucency and shadows to work.
"); else return; //skip others // kompmgr startup failed or succeeded, release connection kompmgr->closeStderr(); disconnect(kompmgr, SIGNAL(receivedStderr(KProcess*, char*, int)), this, SLOT(handleKompmgrOutput(KProcess*, char*, int))); + if( !message.isEmpty()) + { + KProcess proc; + proc << "kdialog" << "--error" + << message + << "--title" << i18n("Composite Manager failure"); + proc.start(KProcess::DontCare); + } }